IDEA-145132 Esc while editing push target closes the push dialog
authorAnton Tarasov <anton.tarasov@jetbrains.com>
Fri, 5 Aug 2016 15:28:18 +0000 (18:28 +0300)
committerAnton Tarasov <anton.tarasov@jetbrains.com>
Fri, 5 Aug 2016 15:29:43 +0000 (18:29 +0300)
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushLog.java

index 973bfaf3a2f8e010bb2a11a2e93b61125ad350f1..6b2f00defe0e43a36b904ea0af861e9507133f69 100644 (file)
@@ -62,6 +62,7 @@ public class PushLog extends JPanel implements DataProvider {
 
   private static final String CONTEXT_MENU = "Vcs.Push.ContextMenu";
   private static final String START_EDITING = "startEditing";
+  private static final String STOP_EDITING = "stopEditing";
   private final ChangesBrowser myChangesBrowser;
   private final CheckboxTree myTree;
   private final MyTreeCellRenderer myTreeCellRenderer;
@@ -213,6 +214,13 @@ public class PushLog extends JPanel implements DataProvider {
       }
     });
     myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), START_EDITING);
+    myTree.getActionMap().put(STOP_EDITING, new AbstractAction() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        myTree.stopEditing();
+      }
+    });
+    myTree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false), STOP_EDITING);
     //override default tree behaviour.
     myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "");
     MyShowCommitInfoAction showCommitInfoAction = new MyShowCommitInfoAction();