added replace-all option to shortcut element from plugin configuration xml, also...
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 8 Sep 2010 13:37:02 +0000 (17:37 +0400)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 8 Sep 2010 13:45:58 +0000 (17:45 +0400)
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java
plugins/devkit/src/dom/KeyboardShortcut.java

index cfbc67d31b0359393eeda021fd8c1e66f04fb0e0..5ebf68925382abe5912e0815c7c191434ef5d182 100644 (file)
@@ -108,6 +108,7 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
   @NonNls public static final String FIRST_KEYSTROKE_ATTR_NAME = "first-keystroke";
   @NonNls public static final String SECOND_KEYSTROKE_ATTR_NAME = "second-keystroke";
   @NonNls public static final String REMOVE_SHORTCUT_ATTR_NAME = "remove";
+  @NonNls public static final String REPLACE_SHORTCUT_ATTR_NAME = "replace-all";
   @NonNls public static final String KEYMAP_ATTR_NAME = "keymap";
   @NonNls public static final String KEYSTROKE_ATTR_NAME = "keystroke";
   @NonNls public static final String REF_ATTR_NAME = "ref";
@@ -761,9 +762,14 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
     }
     final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
     final KeyboardShortcut shortcut = new KeyboardShortcut(firstKeyStroke, secondKeyStroke);
+    final String replaceOption = element.getAttributeValue(REPLACE_SHORTCUT_ATTR_NAME);
     if (Boolean.valueOf(removeOption)) {
       keymap.removeShortcut(actionId, shortcut);
-    } else {
+    }
+    if (Boolean.valueOf(replaceOption)) {
+      keymap.removeAllActionShortcuts(actionId);
+    }
+    if (!Boolean.valueOf(removeOption)) {
       keymap.addShortcut(actionId, shortcut);
     }
   }
index 71829d0b011a33e9d475ed250162f867c583902e..c6035677036e298002927b0ef1205d5d86e85314 100644 (file)
@@ -68,12 +68,19 @@ public interface KeyboardShortcut extends DomElement {
 
 
         /**
-         * Returns the value of the remove child.
+         * Returns the value of the should current shortcut be removed or not.
          * Attribute remove option
-         * @return the value of the remove child.
+         * @return the value of the should current shortcut be removed or not.
          */
         @NotNull
         GenericAttributeValue<String> getRemove();
 
+        /**
+         * Returns the value of the should all previous shortcuts be removed by that one or not.
+         * Attribute remove option
+         * @return the value of the should all previous shortcuts be removed by that one or not.
+         */
+        @NotNull
+        GenericAttributeValue<String> getReplaceAll();
 
 }