From 9d7db806bf043b94efd372b1d0c73f7dfc858ad6 Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Tue, 23 Oct 2012 19:23:50 +0400 Subject: [PATCH] IDEA-90515 Editor tab dragged by dragging Configuration Menu pop-out items --- .../src/com/intellij/ui/MouseDragHelper.java | 11 +++-------- .../src/com/intellij/ui/tabs/impl/DragHelper.java | 11 ++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java index 52f0d57f5d4c..3aab2f8df622 100644 --- a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java @@ -186,15 +186,10 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe } } - boolean needConsume = true; if (myDetachingMode) { processDragOut(e, draggedTo, (Point)myPressPointScreen.clone(), dragOutStarted); } else { - needConsume = processDrag(e, draggedTo, (Point)myPressPointScreen.clone()); - } - - if (needConsume) { - e.consume(); + processDrag(e, draggedTo, (Point)myPressPointScreen.clone()); } } } @@ -232,14 +227,14 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe return myDragJustStarted; } - protected abstract boolean processDrag(MouseEvent event, Point dragToScreenPoint, Point startScreenPoint); + protected abstract void processDrag(MouseEvent event, Point dragToScreenPoint, Point startScreenPoint); protected boolean isDragOut(MouseEvent event, Point dragToScreenPoint, Point startScreenPoint) { return false; } protected void processDragOut(MouseEvent event, Point dragToScreenPoint, Point startScreenPoint, boolean justStarted) { - + event.consume(); } private boolean isWithinDeadZone(final MouseEvent e) { diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java index d052c9f999e0..bd8364813049 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java @@ -71,6 +71,7 @@ class DragHelper extends MouseDragHelper { } else { delegate.processDragOut(event, myDragOutSource); } + event.consume(); } @Override @@ -92,13 +93,13 @@ class DragHelper extends MouseDragHelper { myPressedTabLabel = findLabel(new RelativePoint(event).getPoint(myTabs)); } - protected boolean processDrag(MouseEvent event, Point targetScreenPoint, Point startPointScreen) { - if (!myTabs.isTabDraggingEnabled() || !isDragSource(event)) return false; + protected void processDrag(MouseEvent event, Point targetScreenPoint, Point startPointScreen) { + if (!myTabs.isTabDraggingEnabled() || !isDragSource(event)) return; SwingUtilities.convertPointFromScreen(startPointScreen, myTabs); if (isDragJustStarted()) { - if (myPressedTabLabel == null) return false; + if (myPressedTabLabel == null) return; final Rectangle labelBounds = myPressedTabLabel.getBounds(); @@ -111,7 +112,7 @@ class DragHelper extends MouseDragHelper { myDragOriginalRec.y -= myHoldDelta.height; } else { - if (myDragRec == null) return false; + if (myDragRec == null) return; final Point toPoint = SwingUtilities.convertPoint(event.getComponent(), event.getPoint(), myTabs); @@ -163,7 +164,7 @@ class DragHelper extends MouseDragHelper { headerRec.height += border * 2; myTabs.repaint(headerRec); } - return true; + event.consume(); } private boolean isDragSource(MouseEvent event) {