Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2016-01-07 15:59:23 +0000
committerPierre-Charles David2016-04-11 12:49:08 +0000
commite7e750220c510043ee52030a48e1a01df2e44f4a (patch)
tree0eafc13ddc238249db8bae1d7f9ce76f48434075
parent24a87959f7d6720a3da2855ef3a086f21d27a1d2 (diff)
downloadorg.eclipse.sirius-e7e750220c510043ee52030a48e1a01df2e44f4a.tar.gz
org.eclipse.sirius-e7e750220c510043ee52030a48e1a01df2e44f4a.tar.xz
org.eclipse.sirius-e7e750220c510043ee52030a48e1a01df2e44f4a.zip
[491208] Provide an easy way to move in all directions for diagrams
- Update RubberbandDragTracker for move with diagram in selection - Update SnapToAllDragEditPartsTracker for move with DDiagramElement in selection. - Update SiriusDragEditPartsTrackerEx to manage move with port DDiagramElement in selection. - Update SiriusSelectConnectionEditPartTracker for move with DEdge in selection. - Add MoveInDiagramDragTracker interface to declare states used by all DragTrackers which manage move in diagram using mouse middle click. Bug: 491208 Change-Id: I28ffe062c3ebd12a9240ba80436b736b55cab897 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusDragEditPartsTrackerEx.java51
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusSelectConnectionEditPartTracker.java47
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java52
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html12
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile4
-rw-r--r--plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/MoveInDiagramDragTracker.java38
-rw-r--r--plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/RubberbandDragTracker.java53
7 files changed, 246 insertions, 11 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusDragEditPartsTrackerEx.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusDragEditPartsTrackerEx.java
index a926819a2d..1a23bc09f1 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusDragEditPartsTrackerEx.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusDragEditPartsTrackerEx.java
@@ -10,24 +10,30 @@
*******************************************************************************/
package org.eclipse.sirius.diagram.ui.tools.internal.ui;
+import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.SharedCursors;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker;
+import org.eclipse.swt.events.MouseEvent;
/**
* Specific implementation of
- * {@link org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx}. <br/>
+ * {@link org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx}.
+ * <br/>
* It adds margins around parent dragged edit part in order to lower drag 'n
* drop sensibility.
*
* @author dlecan
*/
-public class SiriusDragEditPartsTrackerEx extends DragEditPartsTrackerEx {
+public class SiriusDragEditPartsTrackerEx extends DragEditPartsTrackerEx implements MoveInDiagramDragTracker {
/**
* The x margin used when moving bordered node to not have drag'n drop
@@ -41,6 +47,8 @@ public class SiriusDragEditPartsTrackerEx extends DragEditPartsTrackerEx {
*/
private static final int Y_MARGIN = X_MARGIN;
+ private Point previousMouseLocation;
+
/**
* Constructor.
*
@@ -183,4 +191,43 @@ public class SiriusDragEditPartsTrackerEx extends DragEditPartsTrackerEx {
protected void setCloneActive(boolean cloneActive) {
super.setCloneActive(false);
}
+
+ @Override
+ protected boolean handleButtonDown(int button) {
+ if (button == 2) {
+ setCursor(SharedCursors.HAND);
+ return stateTransition(STATE_INITIAL, STATE_SCROLL_DIAGRAM);
+ } else {
+ return super.handleButtonDown(button);
+ }
+ }
+
+ @Override
+ public void mouseDrag(MouseEvent me, EditPartViewer viewer) {
+ previousMouseLocation = getCurrentInput().getMouseLocation().getCopy();
+ super.mouseDrag(me, viewer);
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ if (isInState(STATE_SCROLL_DIAGRAM)) {
+ return stateTransition(STATE_SCROLL_DIAGRAM, STATE_SCROLL_DIAGRAM_IN_PROGRESS);
+ }
+ return super.handleDragStarted();
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ if (isInState(STATE_SCROLL_DIAGRAM_IN_PROGRESS)) {
+ if (getCurrentViewer().getControl() instanceof FigureCanvas) {
+ FigureCanvas figureCanvas = (FigureCanvas) getCurrentViewer().getControl();
+ Point currentMouseLocation = getCurrentInput().getMouseLocation();
+ Dimension difference = previousMouseLocation.getDifference(currentMouseLocation);
+ Point location = figureCanvas.getViewport().getViewLocation();
+ figureCanvas.scrollTo(location.x + difference.width, location.y + difference.height);
+ }
+ return true;
+ }
+ return super.handleDragInProgress();
+ }
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusSelectConnectionEditPartTracker.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusSelectConnectionEditPartTracker.java
index 205f61d906..ccdb6f2103 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusSelectConnectionEditPartTracker.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SiriusSelectConnectionEditPartTracker.java
@@ -10,17 +10,21 @@
*******************************************************************************/
package org.eclipse.sirius.diagram.ui.tools.internal.ui;
+import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;
import org.eclipse.gef.SharedCursors;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.BendpointRequest;
import org.eclipse.gmf.runtime.gef.ui.internal.tools.SelectConnectionEditPartTracker;
import org.eclipse.sirius.diagram.ui.graphical.edit.policies.MoveEdgeGroupManager;
+import org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Cursor;
/**
@@ -30,7 +34,7 @@ import org.eclipse.swt.graphics.Cursor;
*
*/
@SuppressWarnings("restriction")
-public class SiriusSelectConnectionEditPartTracker extends SelectConnectionEditPartTracker {
+public class SiriusSelectConnectionEditPartTracker extends SelectConnectionEditPartTracker implements MoveInDiagramDragTracker {
private boolean moveGroupActivated;
@@ -40,6 +44,8 @@ public class SiriusSelectConnectionEditPartTracker extends SelectConnectionEditP
*/
private BendpointRequest bendpointRequest;
+ private Point previousMouseLocation;
+
/**
* Method SelectConnectionEditPartTracker.
*
@@ -135,4 +141,43 @@ public class SiriusSelectConnectionEditPartTracker extends SelectConnectionEditP
return cursorToReturn;
}
+ @Override
+ protected boolean handleButtonDown(int button) {
+ if (button == 2) {
+ setCursor(SharedCursors.HAND);
+ return stateTransition(STATE_INITIAL, STATE_SCROLL_DIAGRAM);
+ } else {
+ return super.handleButtonDown(button);
+ }
+ }
+
+ @Override
+ public void mouseDrag(MouseEvent me, EditPartViewer viewer) {
+ previousMouseLocation = getCurrentInput().getMouseLocation().getCopy();
+ super.mouseDrag(me, viewer);
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ if (isInState(STATE_SCROLL_DIAGRAM)) {
+ return stateTransition(STATE_SCROLL_DIAGRAM, STATE_SCROLL_DIAGRAM_IN_PROGRESS);
+ }
+ return super.handleDragStarted();
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ if (isInState(STATE_SCROLL_DIAGRAM_IN_PROGRESS)) {
+ if (getCurrentViewer().getControl() instanceof FigureCanvas) {
+ FigureCanvas figureCanvas = (FigureCanvas) getCurrentViewer().getControl();
+ Point currentMouseLocation = getCurrentInput().getMouseLocation();
+ Dimension difference = previousMouseLocation.getDifference(currentMouseLocation);
+ Point location = figureCanvas.getViewport().getViewLocation();
+ figureCanvas.scrollTo(location.x + difference.width, location.y + difference.height);
+ }
+ return true;
+ }
+ return super.handleDragInProgress();
+ }
+
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java
index 429f2baec6..245c1ea43e 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/ui/SnapToAllDragEditPartsTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2015, 2016 THALES GLOBAL SERVICES.
* 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
@@ -10,11 +10,18 @@
*******************************************************************************/
package org.eclipse.sirius.diagram.ui.tools.internal.ui;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.SharedCursors;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
/**
* A specific dragEditPartTracket that allows to change the behavior of
@@ -23,7 +30,7 @@ import org.eclipse.swt.events.KeyEvent;
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
*
*/
-public class SnapToAllDragEditPartsTracker extends DragEditPartsTrackerEx {
+public class SnapToAllDragEditPartsTracker extends DragEditPartsTrackerEx implements MoveInDiagramDragTracker {
/**
* Constant passed to extended data of the request to keep the chosen mode
@@ -52,6 +59,8 @@ public class SnapToAllDragEditPartsTracker extends DragEditPartsTrackerEx {
*/
boolean snapToAllShape = SnapToAllDragEditPartsTracker.DEFAULT_SNAP_TO_SHAPE_MODE;
+ private Point previousMouseLocation;
+
/**
* Default constructor.
*
@@ -103,4 +112,43 @@ public class SnapToAllDragEditPartsTracker extends DragEditPartsTrackerEx {
snapToAllShape = SnapToAllDragEditPartsTracker.DEFAULT_SNAP_TO_SHAPE_MODE;
return result;
}
+
+ @Override
+ protected boolean handleButtonDown(int button) {
+ if (button == 2) {
+ setCursor(SharedCursors.HAND);
+ return stateTransition(STATE_INITIAL, STATE_SCROLL_DIAGRAM);
+ } else {
+ return super.handleButtonDown(button);
+ }
+ }
+
+ @Override
+ public void mouseDrag(MouseEvent me, EditPartViewer viewer) {
+ previousMouseLocation = getCurrentInput().getMouseLocation().getCopy();
+ super.mouseDrag(me, viewer);
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ if (isInState(STATE_SCROLL_DIAGRAM)) {
+ return stateTransition(STATE_SCROLL_DIAGRAM, STATE_SCROLL_DIAGRAM_IN_PROGRESS);
+ }
+ return super.handleDragStarted();
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ if (isInState(STATE_SCROLL_DIAGRAM_IN_PROGRESS)) {
+ if (getCurrentViewer().getControl() instanceof FigureCanvas) {
+ FigureCanvas figureCanvas = (FigureCanvas) getCurrentViewer().getControl();
+ Point currentMouseLocation = getCurrentInput().getMouseLocation();
+ Dimension difference = previousMouseLocation.getDifference(currentMouseLocation);
+ Point location = figureCanvas.getViewport().getViewLocation();
+ figureCanvas.scrollTo(location.x + difference.width, location.y + difference.height);
+ }
+ return true;
+ }
+ return super.handleDragInProgress();
+ }
}
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 6702e13a7e..d1ee13c1fe 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -300,6 +300,14 @@
<code>org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertySource.collector</code> field is now in protected visibility to be modifiable and accessible by subclass.
</li>
</ul>
+ <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime">Changes in
+ <code>org.eclipse.sirius.ext.gmf.runtime</code>
+ </h4>
+ <ul>
+ <li><span class="label label-success">Added</span> The interface
+ <code>org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker</code> has been added to declare states used by all DragTrackers which manage move in diagram using mouse middle click.
+ </li>
+ </ul>
<h4 id="Changesinorg.eclipse.sirius.ui2">Changes in
<code>org.eclipse.sirius.ui</code>
</h4>
@@ -920,7 +928,7 @@
<code>org.eclipse.sirius.ext.jface.viewers.IToolTipProvider</code> has been copied from JFace 3.10 from Luna, so that we can use it with Juno and Kepler too.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime2">Changes in
<code>org.eclipse.sirius.ext.gmf.runtime</code>
</h4>
<ul>
@@ -2213,7 +2221,7 @@
<code>EObject</code> from its container after a check by the permission authority that all changeable feature to modify can be edited.
</li>
</ul>
- <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime2">Changes in
+ <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime3">Changes in
<code>org.eclipse.sirius.ext.gmf.runtime</code>
</h4>
<ul>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 2afc55fb09..8fa5771b2f 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -86,6 +86,10 @@ h4. Changes in @org.eclipse.sirius.ext.emf.ui@
* <span class="label label-info">Modified</span> @org.eclipse.sirius.ext.emf.ui.properties.ExtensiblePropertySource.collector@ field is now in protected visibility to be modifiable and accessible by subclass.
+h4. Changes in @org.eclipse.sirius.ext.gmf.runtime@
+
+* <span class="label label-success">Added</span> The interface @org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker@ has been added to declare states used by all DragTrackers which manage move in diagram using mouse middle click.
+
h4. Changes in @org.eclipse.sirius.ui@
* <span class="label label-success">Added</span> @org.eclipse.sirius.ui.tools.api.properties.SiriusExtensiblePropertyDescriptor@ has been added to provide a specific @ExtensiblePropertyDescriptor@ which test @IPermissionAuthority@ to make properties view editable or not.
diff --git a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/MoveInDiagramDragTracker.java b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/MoveInDiagramDragTracker.java
new file mode 100644
index 0000000000..aa222c6db9
--- /dev/null
+++ b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/MoveInDiagramDragTracker.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2016 THALES GLOBAL SERVICES 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools;
+
+import org.eclipse.gef.DragTracker;
+
+/**
+ * A specific {@link DragTracker} which declares move in diagram specific
+ * states.
+ *
+ * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a>
+ */
+// CHECKSTYLE:OFF
+public interface MoveInDiagramDragTracker extends DragTracker {
+ // CHECKSTYLE:ON
+ /**
+ * The state indicating that the middle button is pressed, but the user has
+ * not moved past the scroll threshold. Many tools will do nothing during
+ * this state but wait until {@link #STATE_SCROLL_DIAGRAM_IN_PROGRESS} is
+ * entered.
+ */
+ int STATE_SCROLL_DIAGRAM = 64;
+
+ /**
+ * The state indicating that the scroll detection threshold has been passed,
+ * and a scroll is in progress.
+ */
+ int STATE_SCROLL_DIAGRAM_IN_PROGRESS = 128;
+
+}
diff --git a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/RubberbandDragTracker.java b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/RubberbandDragTracker.java
index c162628c72..5a2e0a9430 100644
--- a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/RubberbandDragTracker.java
+++ b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/diagram/ui/tools/RubberbandDragTracker.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 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
@@ -11,7 +11,12 @@
// CHECKSTYLE:OFF
package org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools;
-import org.eclipse.gef.DragTracker;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.SharedCursors;
+import org.eclipse.swt.events.MouseEvent;
/**
* @author tisrar
@@ -19,11 +24,51 @@ import org.eclipse.gef.DragTracker;
*
*
*/
-public class RubberbandDragTracker extends RubberbandSelectionTool implements DragTracker {
+public class RubberbandDragTracker extends RubberbandSelectionTool implements MoveInDiagramDragTracker {
+
+ private Point previousMouseLocation;
+
+ @Override
+ protected boolean handleButtonDown(int button) {
+ if (button == 2) {
+ setCursor(SharedCursors.HAND);
+ return stateTransition(STATE_INITIAL, STATE_SCROLL_DIAGRAM);
+ } else {
+ return super.handleButtonDown(button);
+ }
+ }
+
+ @Override
+ public void mouseDrag(MouseEvent me, EditPartViewer viewer) {
+ previousMouseLocation = getCurrentInput().getMouseLocation().getCopy();
+ super.mouseDrag(me, viewer);
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ if (isInState(STATE_SCROLL_DIAGRAM)) {
+ return stateTransition(STATE_SCROLL_DIAGRAM, STATE_SCROLL_DIAGRAM_IN_PROGRESS);
+ }
+ return super.handleDragStarted();
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ if (isInState(STATE_SCROLL_DIAGRAM_IN_PROGRESS)) {
+ if (getCurrentViewer().getControl() instanceof FigureCanvas) {
+ FigureCanvas figureCanvas = (FigureCanvas) getCurrentViewer().getControl();
+ Point currentMouseLocation = getCurrentInput().getMouseLocation();
+ Dimension difference = previousMouseLocation.getDifference(currentMouseLocation);
+ Point location = figureCanvas.getViewport().getViewLocation();
+ figureCanvas.scrollTo(location.x + difference.width, location.y + difference.height);
+ }
+ return true;
+ }
+ return super.handleDragInProgress();
+ }
/*
* (non-Javadoc)
- *
* @see org.eclipse.gef.tools.AbstractTool#handleFinished()
*/
@Override

Back to the top