diff options
| author | Eric Moffatt | 2013-09-16 18:07:31 +0000 |
|---|---|---|
| committer | Eric Moffatt | 2013-11-22 19:24:52 +0000 |
| commit | 974fa9bc13db93a54a5eaa83b5aef2cb7bb614e0 (patch) | |
| tree | e0ccc2f81252ad59475fd240c07818cc860e4fa3 | |
| parent | a344d7bf164e67da3b2c58480d7edb5f4dd7e335 (diff) | |
| download | eclipse.platform.ui-974fa9bc13db93a54a5eaa83b5aef2cb7bb614e0.tar.gz eclipse.platform.ui-974fa9bc13db93a54a5eaa83b5aef2cb7bb614e0.tar.xz eclipse.platform.ui-974fa9bc13db93a54a5eaa83b5aef2cb7bb614e0.zip | |
Tweaks for Bug 364046 - [regression] Perspective switcher does not allow
to reorder prespectives
| -rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java index b87e4704be7..a90490e5e30 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java @@ -44,6 +44,8 @@ import org.eclipse.swt.accessibility.AccessibleAdapter; import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.DragDetectEvent; +import org.eclipse.swt.events.DragDetectListener; import org.eclipse.swt.events.MenuDetectEvent; import org.eclipse.swt.events.MenuDetectListener; import org.eclipse.swt.events.MenuEvent; @@ -97,7 +99,6 @@ public class PerspectiveSwitcher { /** * */ - private static final int DRAG_TOLERANCE = 5; public static final String PERSPECTIVE_SWITCHER_ID = "org.eclipse.e4.ui.PerspectiveSwitcher"; //$NON-NLS-1$ @Inject protected IEventBroker eventBroker; @@ -425,7 +426,7 @@ public class PerspectiveSwitcher { private void createFeedback() { dragShell = new Shell(SWT.NO_TRIM | SWT.NO_BACKGROUND); dragShell.setAlpha(175); - ToolBar dragTB = new ToolBar(dragShell, SWT.NONE); + ToolBar dragTB = new ToolBar(dragShell, SWT.RIGHT); ToolItem newTI = new ToolItem(dragTB, SWT.RADIO); newTI.setText(dragItem.getText()); newTI.setImage(dragItem.getImage()); @@ -494,20 +495,19 @@ public class PerspectiveSwitcher { } }); + bar.addDragDetectListener(new DragDetectListener() { + public void dragDetected(DragDetectEvent e) { + if (dragItem != null) { + dragging = true; + track(e); + } + } + }); + bar.addMouseMoveListener(new MouseMoveListener() { public void mouseMove(MouseEvent e) { - if (dragItem == null) - return; - if (dragging) { track(e); - } else { - Point curPos = new Point(e.x, e.y); - if (Math.abs(curPos.x - downPos.x) > DRAG_TOLERANCE - || Math.abs(curPos.y - downPos.y) > DRAG_TOLERANCE) { - dragging = true; - track(e); - } } } }); |
