IDEA-121220 Focus remains on Document tabs instead of Editor area when tabs switching

This commit is contained in:
Konstantin Bulenkov
2014-02-25 12:01:06 +01:00
parent 34a53430bd
commit 0b53dbe09d
2 changed files with 6 additions and 3 deletions
@@ -37,7 +37,8 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe
private final JComponent myDragComponent;
protected Point myPressPointScreen;
private Point myPressPointScreen;
protected Point myPressedOnScreenPoint;
private Point myPressPointComponent;
private boolean myDraggingNow;
@@ -114,6 +115,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe
if (!canStartDragging(e)) return;
myPressPointScreen = new RelativePoint(e).getScreenPoint();
myPressedOnScreenPoint = new Point(myPressPointScreen);
myPressPointComponent = e.getPoint();
processMousePressed(e);
@@ -131,6 +133,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe
return;
}
boolean wasDragging = myDraggingNow;
myPressPointScreen = null;
myDraggingNow = false;
myDragJustStarted = false;
@@ -143,7 +146,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe
}
}
finally {
myPressPointScreen = null;
myPressedOnScreenPoint = null;
resetDragState();
e.consume();
if (myDetachPostponed) {
@@ -243,7 +243,7 @@ class DragHelper extends MouseDragHelper {
if (!willDragOutStart && JBEditorTabs.isAlphabeticalMode() && position != JBTabsPosition.top && position != JBTabsPosition.bottom) {
Point p = new Point(event.getPoint());
p = SwingUtilities.convertPoint(event.getComponent(), p, myTabs);
if (myTabs.getVisibleRect().contains(p) && myPressPointScreen.distance(new RelativePoint(event).getScreenPoint()) > 15) {
if (myTabs.getVisibleRect().contains(p) && myPressedOnScreenPoint.distance(new RelativePoint(event).getScreenPoint()) > 15) {
final int answer = Messages.showOkCancelDialog(myTabs,
IdeBundle.message("alphabetical.mode.is.on.warning"),
IdeBundle.message("title.warning"),