### Eclipse Workspace Patch 1.0 #P org.eclipse.gef Index: src/org/eclipse/gef/tools/DragEditPartsTracker.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.gef/src/org/eclipse/gef/tools/DragEditPartsTracker.java,v retrieving revision 1.54 diff -u -r1.54 DragEditPartsTracker.java --- src/org/eclipse/gef/tools/DragEditPartsTracker.java 21 Dec 2007 19:28:47 -0000 1.54 +++ src/org/eclipse/gef/tools/DragEditPartsTracker.java 30 Apr 2008 21:20:28 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,13 +18,17 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Control; +import org.eclipse.draw2d.FigureCanvas; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.Viewport; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PrecisionPoint; import org.eclipse.draw2d.geometry.PrecisionRectangle; +import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.AutoexposeHelper; import org.eclipse.gef.EditPart; @@ -349,10 +353,43 @@ showTargetFeedback(); showSourceFeedback(); setCurrentCommand(getCommand()); + + // Expose the diagram as the user scrolls in the area handled by the + // autoexpose helper. + updateAutoexposeHelper(); } return true; } +protected Cursor calculateCursor() { + if (isInState(STATE_DRAG_IN_PROGRESS) + || isInState(STATE_ACCESSIBLE_DRAG_IN_PROGRESS)) { + + // Give some feedback so the user knows the area where autoscrolling + // will occur. + if (getAutoexposeHelper() != null) { + return SharedCursors.HAND; + } else { + + // Give some feedback so the user knows that they can't drag + // outside the viewport. + Control control = getCurrentViewer().getControl(); + if (control instanceof FigureCanvas) { + Viewport viewport = ((FigureCanvas) control).getViewport(); + Rectangle rect = Rectangle.SINGLETON; + viewport.getClientArea(rect); + viewport.translateToParent(rect); + viewport.translateToAbsolute(rect); + + if (!rect.contains(getLocation())) { + return getDisabledCursor(); + } + } + } + } + return super.calculateCursor(); +} + /** * Calls {@link TargetingTool#updateAutoexposeHelper()} if a drag is in progress. * @see org.eclipse.gef.tools.TargetingTool#handleHover()