Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 18-30
Link Here
|
18 |
import org.eclipse.swt.SWT; |
18 |
import org.eclipse.swt.SWT; |
19 |
import org.eclipse.swt.events.KeyEvent; |
19 |
import org.eclipse.swt.events.KeyEvent; |
20 |
import org.eclipse.swt.graphics.Cursor; |
20 |
import org.eclipse.swt.graphics.Cursor; |
|
|
21 |
import org.eclipse.swt.widgets.Control; |
21 |
|
22 |
|
|
|
23 |
import org.eclipse.draw2d.FigureCanvas; |
22 |
import org.eclipse.draw2d.IFigure; |
24 |
import org.eclipse.draw2d.IFigure; |
23 |
import org.eclipse.draw2d.PositionConstants; |
25 |
import org.eclipse.draw2d.PositionConstants; |
|
|
26 |
import org.eclipse.draw2d.Viewport; |
24 |
import org.eclipse.draw2d.geometry.Dimension; |
27 |
import org.eclipse.draw2d.geometry.Dimension; |
25 |
import org.eclipse.draw2d.geometry.Point; |
28 |
import org.eclipse.draw2d.geometry.Point; |
26 |
import org.eclipse.draw2d.geometry.PrecisionPoint; |
29 |
import org.eclipse.draw2d.geometry.PrecisionPoint; |
27 |
import org.eclipse.draw2d.geometry.PrecisionRectangle; |
30 |
import org.eclipse.draw2d.geometry.PrecisionRectangle; |
|
|
31 |
import org.eclipse.draw2d.geometry.Rectangle; |
28 |
|
32 |
|
29 |
import org.eclipse.gef.AutoexposeHelper; |
33 |
import org.eclipse.gef.AutoexposeHelper; |
30 |
import org.eclipse.gef.EditPart; |
34 |
import org.eclipse.gef.EditPart; |
Lines 349-358
Link Here
|
349 |
showTargetFeedback(); |
353 |
showTargetFeedback(); |
350 |
showSourceFeedback(); |
354 |
showSourceFeedback(); |
351 |
setCurrentCommand(getCommand()); |
355 |
setCurrentCommand(getCommand()); |
|
|
356 |
|
357 |
// Expose the diagram as the user scrolls in the area handled by the |
358 |
// autoexpose helper. |
359 |
updateAutoexposeHelper(); |
352 |
} |
360 |
} |
353 |
return true; |
361 |
return true; |
354 |
} |
362 |
} |
355 |
|
363 |
|
|
|
364 |
protected Cursor calculateCursor() { |
365 |
if (isInState(STATE_DRAG_IN_PROGRESS) |
366 |
|| isInState(STATE_ACCESSIBLE_DRAG_IN_PROGRESS)) { |
367 |
|
368 |
// Give some feedback so the user knows the area where autoscrolling |
369 |
// will occur. |
370 |
if (getAutoexposeHelper() != null) { |
371 |
return SharedCursors.HAND; |
372 |
} else { |
373 |
|
374 |
// Give some feedback so the user knows that they can't drag |
375 |
// outside the viewport. |
376 |
Control control = getCurrentViewer().getControl(); |
377 |
if (control instanceof FigureCanvas) { |
378 |
Viewport viewport = ((FigureCanvas) control).getViewport(); |
379 |
Rectangle rect = Rectangle.SINGLETON; |
380 |
viewport.getClientArea(rect); |
381 |
viewport.translateToParent(rect); |
382 |
viewport.translateToAbsolute(rect); |
383 |
|
384 |
if (!rect.contains(getLocation())) { |
385 |
return getDisabledCursor(); |
386 |
} |
387 |
} |
388 |
} |
389 |
} |
390 |
return super.calculateCursor(); |
391 |
} |
392 |
|
356 |
/** |
393 |
/** |
357 |
* Calls {@link TargetingTool#updateAutoexposeHelper()} if a drag is in progress. |
394 |
* Calls {@link TargetingTool#updateAutoexposeHelper()} if a drag is in progress. |
358 |
* @see org.eclipse.gef.tools.TargetingTool#handleHover() |
395 |
* @see org.eclipse.gef.tools.TargetingTool#handleHover() |