keymap actions tree: exclude IDEA CORE actions added twice to other group, sort plugi...
authorAnna Kozlova <Anna.Kozlova@jetbrains.com>
Tue, 15 Sep 2009 16:16:35 +0000 (20:16 +0400)
committerAnna Kozlova <Anna.Kozlova@jetbrains.com>
Tue, 15 Sep 2009 16:16:35 +0000 (20:16 +0400)
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTree.java
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/ActionsTreeUtil.java
platform/platform-impl/src/com/intellij/openapi/keymap/impl/ui/Group.java

index 81e3ac2ed59112a4b3cb2c43e01504e9de85e853..e2a310716d4069ba626e27800d491b735998eea9 100644 (file)
@@ -75,6 +75,9 @@ public class ActionsTree {
             AnAction action = ActionManager.getInstance().getActionOrStub(actionId);
             if (action != null) {
               text = action.getTemplatePresentation().getText();
+              if (text == null || text.length() == 0) { //fill dynamic presentation gaps 
+                text = actionId;
+              }
               Icon actionIcon = action.getTemplatePresentation().getIcon();
               if (actionIcon != null) {
                 icon = actionIcon;
index b4e331284c170bdd2081ce45b6b973f06ca80e07..adf6b4fea162ee74b15ca833eaf494b87d380a41 100644 (file)
@@ -54,10 +54,15 @@ public class ActionsTreeUtil {
     final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
     ActionManagerEx managerEx = ActionManagerEx.getInstanceEx();
     final IdeaPluginDescriptor[] plugins = ApplicationManager.getApplication().getPlugins();
+    Arrays.sort(plugins, new Comparator<IdeaPluginDescriptor>() {
+      public int compare(IdeaPluginDescriptor o1, IdeaPluginDescriptor o2) {
+        return o1.getName().compareTo(o2.getName());
+      }
+    });
     for (IdeaPluginDescriptor plugin : plugins) {
       Group pluginGroup;
       if (plugin.getName().equals("IDEA CORE")) {
-        pluginGroup = otherGroup;
+        continue;
       }
       else {
         pluginGroup = new Group(plugin.getName(), null, null);
@@ -66,6 +71,11 @@ public class ActionsTreeUtil {
       if (pluginActions == null || pluginActions.length == 0) {
         continue;
       }
+      Arrays.sort(pluginActions, new Comparator<String>() {
+        public int compare(String o1, String o2) {
+          return getTextToCompare(o1).compareTo(getTextToCompare(o2));
+        }
+      });
       for (String pluginAction : pluginActions) {
         if (keymapManager.getBoundActions().contains(pluginAction)) continue;
         final AnAction anAction = managerEx.getActionOrStub(pluginAction);
@@ -279,15 +289,6 @@ public class ActionsTreeUtil {
       public int compare(String id1, String id2) {
         return getTextToCompare(id1).compareToIgnoreCase(getTextToCompare(id2));
       }
-
-      private String getTextToCompare(String id) {
-        AnAction action = actionManager.getActionOrStub(id);
-        if (action == null) {
-          return id;
-        }
-        String text = action.getTemplatePresentation().getText();
-        return text != null ? text : id;
-      }
     });
 
     Group group = new Group(KeyMapBundle.message("other.group.title"), OTHER_ICON, OTHER_ICON);
@@ -297,6 +298,15 @@ public class ActionsTreeUtil {
     return group;
   }
 
+  private static String getTextToCompare(String id) {
+    AnAction action = ActionManager.getInstance().getActionOrStub(id);
+    if (action == null) {
+      return id;
+    }
+    String text = action.getTemplatePresentation().getText();
+    return text != null ? text : id;
+  }
+
   private static void filterOtherActionsGroup(ArrayList<String> actions) {
     filterOutGroup(actions, IdeActions.GROUP_GENERATE);
     filterOutGroup(actions, IdeActions.GROUP_NEW);
index 20fc385af19a05a1819d8b3f66bb11ed5b83ba4c..94ffaa1e8a0842655d80efd6b7bc8f59b99928e3 100644 (file)
@@ -2,6 +2,7 @@ package com.intellij.openapi.keymap.impl.ui;
 
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.QuickList;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.keymap.KeymapGroup;
 
 import javax.swing.*;