diff --git a/platform/diff-impl/src/com/intellij/diff/actions/CompareFilesAction.java b/platform/diff-impl/src/com/intellij/diff/actions/CompareFilesAction.java index e0d802ccf0d8..39f47ddda532 100644 --- a/platform/diff-impl/src/com/intellij/diff/actions/CompareFilesAction.java +++ b/platform/diff-impl/src/com/intellij/diff/actions/CompareFilesAction.java @@ -83,16 +83,20 @@ public class CompareFilesAction extends BaseShowDiffAction { } if (files.length == 1) { - return files[0].isValid(); + return isValidAndLocal(files[0]); } else if (files.length == 2) { - return files[0].isValid() && files[1].isValid(); + return isValidAndLocal(files[0]) && isValidAndLocal(files[1]); } else { return false; } } + private static boolean isValidAndLocal(VirtualFile file) { + return file.isValid() && file.isInLocalFileSystem(); + } + @Nullable @Override protected DiffRequest getDiffRequest(@NotNull AnActionEvent 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 b0df0917dfe0..8c3cc72f683c 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 @@ -17,6 +17,7 @@ package com.intellij.ui.tabs.impl; import com.intellij.ide.IdeBundle; import com.intellij.openapi.ui.Messages; +import com.intellij.reference.SoftReference; import com.intellij.ui.InplaceButton; import com.intellij.ui.MouseDragHelper; import com.intellij.ui.ScreenUtil; @@ -29,6 +30,8 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; class DragHelper extends MouseDragHelper { @@ -40,7 +43,7 @@ class DragHelper extends MouseDragHelper { private Dimension myHoldDelta; private TabInfo myDragOutSource; - private TabLabel myPressedTabLabel; + private Reference myPressedTabLabel; public DragHelper(JBTabsImpl tabs) { super(tabs, tabs); @@ -57,10 +60,8 @@ class DragHelper extends MouseDragHelper { int dX = dragToScreenPoint.x - startScreenPoint.x; int dY = dragToScreenPoint.y - startScreenPoint.y; - boolean dragOut = - myTabs.getEffectiveLayout().isDragOut(label, dX, dY); - return dragOut; + return myTabs.getEffectiveLayout().isDragOut(label, dX, dY); } @Override @@ -90,7 +91,8 @@ class DragHelper extends MouseDragHelper { protected void processMousePressed(MouseEvent event) { // since selection change can cause tabs to be reordered, we need to remember the tab on which the mouse was pressed, otherwise // we'll end up dragging the wrong tab (IDEA-65073) - myPressedTabLabel = findLabel(new RelativePoint(event).getPoint(myTabs)); + TabLabel label = findLabel(new RelativePoint(event).getPoint(myTabs)); + myPressedTabLabel = label == null ? null : new WeakReference(label); } protected void processDrag(MouseEvent event, Point targetScreenPoint, Point startPointScreen) { @@ -99,12 +101,13 @@ class DragHelper extends MouseDragHelper { SwingUtilities.convertPointFromScreen(startPointScreen, myTabs); if (isDragJustStarted()) { - if (myPressedTabLabel == null) return; + TabLabel pressedTabLabel = SoftReference.dereference(myPressedTabLabel); + if (pressedTabLabel == null) return; - final Rectangle labelBounds = myPressedTabLabel.getBounds(); + final Rectangle labelBounds = pressedTabLabel.getBounds(); myHoldDelta = new Dimension(startPointScreen.x - labelBounds.x, startPointScreen.y - labelBounds.y); - myDragSource = myPressedTabLabel.getInfo(); + myDragSource = pressedTabLabel.getInfo(); myDragRec = new Rectangle(startPointScreen, labelBounds.getSize()); myDragOriginalRec = (Rectangle)myDragRec.clone(); diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 72e211cfd5a5..678daf053711 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -318,7 +318,7 @@ find.search.in.project.files=true structureView.coalesceTime=500 keymap.show.alias.actions=false -keymap.windows.as.meta=true +keymap.windows.as.meta=false frameworks.download.libraries.server.url=http://pluginsrepo-test:8080 caches.indexerThreadsCount=-1 navBar.updateMergeTime=100