unregister custom shortcuts on dispose
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 18 Aug 2015 19:03:30 +0000 (22:03 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 18 Aug 2015 19:04:29 +0000 (22:04 +0300)
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java

index 2ee541d21d056d7136d34ab210fb128806e80060..fc697864c2599a488413d5a382506502a7006403 100644 (file)
@@ -1224,7 +1224,7 @@ public abstract class DialogWrapper {
         expandNextOptionButton();
       }
     };
-    toggleShowOptions.registerCustomShortcutSet(sc, root);
+    toggleShowOptions.registerCustomShortcutSet(sc, root, myDisposable);
 
     JComponent titlePane = createTitlePane();
     if (titlePane != null) {
@@ -1267,7 +1267,7 @@ public abstract class DialogWrapper {
       startTrackingValidation();
     }
     if (SystemInfo.isWindows) {
-      installEnterHook(root);
+      installEnterHook(root, myDisposable);
     }
     myErrorTextAlarm.setActivationComponent(root);
   }
@@ -1277,7 +1277,7 @@ public abstract class DialogWrapper {
     return new BorderLayout();
   }
 
-  private static void installEnterHook(JComponent root) {
+  private static void installEnterHook(JComponent root, Disposable disposable) {
     new AnAction() {
       @Override
       public void actionPerformed(AnActionEvent e) {
@@ -1292,7 +1292,7 @@ public abstract class DialogWrapper {
         final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
         e.getPresentation().setEnabled(owner instanceof JButton && owner.isEnabled());
       }
-    }.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), root);
+    }.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), root, disposable);
   }
 
   private void expandNextOptionButton() {