示例#1
0
  public static void adjustTopLevelGroups(BaseApplicationPlugin idePlugin) {
    addPlace(ProjectPaneActionGroups.NODE_ACTIONS, ActionPlace.PROJECT_PANE_SNODE);
    addPlace(ProjectPaneActionGroups.MODEL_ACTIONS, ActionPlace.PROJECT_PANE_SMODEL);
    addPlace(ProjectPaneActionGroups.PROJECT_PANE_MODULE_ACTIONS, ActionPlace.PROJECT_PANE_MODULE);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_LANGUAGE_ACTIONS, ActionPlace.PROJECT_PANE_LANGUAGE);
    addPlace(ProjectPaneActionGroups.PROJECT_PANE_DEVKIT_ACTIONS, ActionPlace.PROJECT_PANE_DEVKIT);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_PROJECT_ACTIONS, ActionPlace.PROJECT_PANE_PROJECT);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_SOLUTION_ACTIONS, ActionPlace.PROJECT_PANE_SOLUTION);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_GENERATOR_ACTIONS, ActionPlace.PROJECT_PANE_GENERATOR);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_TRANSIENT_MODULES_ACTIONS,
        ActionPlace.PROJECT_PANE_TRANSIENT_MODULES);
    addPlace(ProjectPaneActionGroups.PACKAGE_ACTIONS, ActionPlace.PROJECT_PANE_PACKAGE);
    addPlace(ProjectPaneActionGroups.NAMESPACE_ACTIONS, ActionPlace.PROJECT_PANE_NAMESPACE);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_RUNTIME_FOLDER_ACTIONS,
        ActionPlace.PROJECT_PANE_RUNTIME_FOLDER);
    addPlace(
        ProjectPaneActionGroups.PROJECT_PANE_ACCESSORIES_ACTIONS,
        ActionPlace.PROJECT_PANE_ACCESSORIES);
    addPlace(ProjectPaneActionGroups.PROJECT_NEW_ACTIONS, ActionPlace.PROJECT_PANE_PROJECT);
    addPlace(ProjectPaneActionGroups.SOLUTION_NEW_ACTIONS, ActionPlace.PROJECT_PANE_SOLUTION);
    addPlace(ProjectPaneActionGroups.LANGUAGE_NEW_ACTIONS, ActionPlace.PROJECT_PANE_LANGUAGE);
    addPlace(ProjectPaneActionGroups.GENERATOR_NEW_ACTIONS, ActionPlace.PROJECT_PANE_GENERATOR);

    addPlace(ProjectPaneActionGroups.PROJECT_PANE_FILE_ACTIONS, ActionPlace.PROJECT_PANE_FILE);
    addPlace(ProjectPaneActionGroups.PROJECT_PANE_FOLDER_ACTIONS, ActionPlace.PROJECT_PANE_FOLDER);

    addPlace(ModuleActions_ActionGroup.ID, ActionPlace.MODULE_DEPENDENCIES);

    DefaultActionGroup editorPopupGroup =
        ActionUtils.getDefaultGroup(EditorComponent.EDITOR_POPUP_MENU_ACTIONS);
    List<AnAction> actionList = Arrays.asList(editorPopupGroup.getChildren(null));
    BaseGroup.addPlaceToActionList(actionList, ActionPlace.EDITOR, null);

    DefaultActionGroup editorActionsGroup =
        ActionUtils.getDefaultGroup(MPSActions.EDITOR_ACTIONS_GROUP);
    actionList = Arrays.asList(editorActionsGroup.getChildren(null));
    BaseGroup.addPlaceToActionList(actionList, ActionPlace.EDITOR, null);

    List<BaseGroup> mainMenuGroups = new ArrayList<BaseGroup>();
    DefaultActionGroup mainMenuGroup = ActionUtils.getDefaultGroup(IdeActions.GROUP_MAIN_MENU);
    ActionManagerEx manager = ActionManagerEx.getInstanceEx();
    for (String id : manager.getActionIds("")) {
      AnAction action = manager.getAction(id);
      if (!(action instanceof BaseGroup)) continue;
      BaseGroup group = ((BaseGroup) action);
      if (ActionUtils.contains(mainMenuGroup, group)) {
        mainMenuGroups.add(group);
      }
    }

    for (BaseGroup group : mainMenuGroups) {
      group.addPlace(null, null);
    }
  }
示例#2
0
 private void unregisterActions() {
   // unregister Tool actions
   String[] oldIds = myActionManager.getActionIds(Tool.ACTION_ID_PREFIX);
   for (int i = 0; i < oldIds.length; i++) {
     String oldId = oldIds[i];
     myActionManager.unregisterAction(oldId);
   }
 }