IDEA-134049 log: ctrl+click to select a single root
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Mon, 6 Jul 2015 08:12:27 +0000 (11:12 +0300)
committerJulia Beliaeva <Julia.Beliaeva@jetbrains.com>
Tue, 25 Aug 2015 14:08:47 +0000 (17:08 +0300)
(cherry picked from commit 3b405063e7aa52fa15320c61387014246d4eccff)

platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java
platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/StructureFilterPopupComponent.java

index 55dd37d3089fd252b7d4a851e148360a73d0c6b4..1613fe69689682b5e6632d5ac5c914649539a491 100644 (file)
@@ -521,6 +521,11 @@ public class ListPopupImpl extends WizardPopup implements ListPopup {
 
     @Override
     protected void processMouseEvent(MouseEvent e) {
+      if (!isMultiSelectionEnabled() &&
+          (e.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0) {
+        // do not toggle selection with ctrl+click event in single-selection mode
+        e.consume();
+      }
       if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED) && isOnNextStepButton(e)) {
         e.consume();
       }
index e90fdb873cc890953c46cf70319dac87ecd981ed..e66766a788bcb7986dffd7c7ce0c5de66468ecb1 100644 (file)
@@ -40,6 +40,7 @@ import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
+import java.awt.event.InputEvent;
 import java.util.*;
 import java.util.List;
 
@@ -244,7 +245,12 @@ class StructureFilterPopupComponent extends FilterPopupComponent<VcsLogFileFilte
         setVisibleOnly(myRoot);
       }
       else {
-        setVisible(myRoot, state);
+        if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) {
+            setVisibleOnly(myRoot);
+        }
+        else {
+          setVisible(myRoot, state);
+        }
       }
 
       myIcon.prepare(state);