@Override
  public void registerAdditionalActions(
      @NotNull DefaultActionGroup leftToolbar,
      @NotNull DefaultActionGroup topToolbar,
      @NotNull DefaultActionGroup settings) {
    Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
    leftToolbar.add(Separator.getInstance(), beforeRunner);
    leftToolbar.add(
        ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
    leftToolbar.add(Separator.getInstance(), beforeRunner);

    Constraints beforeSort = new Constraints(Anchor.BEFORE, "XDebugger.ToggleSortValues");
    settings.addAction(new WatchLastMethodReturnValueAction(), beforeSort);
    settings.addAction(new AutoVarsSwitchAction(), beforeSort);
  }
 @Override
 protected ActionGroup getActionGroup(boolean inToolbar) {
   DefaultActionGroup actionGroup = new DefaultActionGroup();
   actionGroup.add(new RefreshAction());
   actionGroup.add(Separator.getInstance());
   actionGroup.add(new ActionInstallPlugin(this, installed));
   if (inToolbar) {
     actionGroup.add(new SortByStatusAction("Sort Installed First"));
     actionGroup.add(new MyFilterRepositoryAction());
     actionGroup.add(new MyFilterCategoryAction());
   }
   return actionGroup;
 }
  @NotNull
  protected ArrayList<AnAction> createActions(final boolean fromPopup) {
    final ArrayList<AnAction> result = new ArrayList<AnAction>();
    AbstractAddGroup addAction = createAddAction();
    if (addAction != null) {
      result.add(addAction);
    }
    result.add(new MyRemoveAction());

    final List<? extends AnAction> copyActions = createCopyActions(fromPopup);
    result.addAll(copyActions);
    result.add(Separator.getInstance());

    result.add(new MyFindUsagesAction(myTree));

    return result;
  }
 @Nullable
 public AnAction getComponentAction() {
   if (myComponent instanceof Separator) {
     return Separator.getInstance();
   }
   if (myComponent instanceof String) {
     return ActionManager.getInstance().getAction((String) myComponent);
   }
   if (myComponent instanceof Group) {
     final String id = ((Group) myComponent).getId();
     if (id == null || id.length() == 0) {
       return ((Group) myComponent).constructActionGroup(true);
     }
     return ActionManager.getInstance().getAction(id);
   }
   return null;
 }
 @Override
 public void readExternal(Element element) throws InvalidDataException {
   myGroupPath = new ArrayList<String>();
   for (Object o : element.getChildren(PATH)) {
     myGroupPath.add(((Element) o).getAttributeValue(VALUE));
   }
   final String attributeValue = element.getAttributeValue(VALUE);
   if (element.getAttributeValue(IS_ACTION) != null) {
     myComponent = attributeValue;
   } else if (element.getAttributeValue(SEPARATOR) != null) {
     myComponent = Separator.getInstance();
   } else if (element.getAttributeValue(IS_GROUP) != null) {
     final AnAction action = ActionManager.getInstance().getAction(attributeValue);
     myComponent =
         action instanceof ActionGroup
             ? ActionsTreeUtil.createGroup((ActionGroup) action, true, null)
             : new Group(attributeValue, attributeValue, null);
   }
   myActionType = Integer.parseInt(element.getAttributeValue(ACTION_TYPE));
   myAbsolutePosition = Integer.parseInt(element.getAttributeValue(POSITION));
   DefaultJDOMExternalizer.readExternal(this, element);
 }
  /**
   * @param addClearListItem - used for detecting whether the "Clear List" action should be added to
   *     the end of the returned list of actions
   * @return
   */
  public AnAction[] getRecentProjectsActions(boolean addClearListItem) {
    validateRecentProjects();

    final Set<String> openedPaths = ContainerUtil.newHashSet();
    for (Project openProject : ProjectManager.getInstance().getOpenProjects()) {
      ContainerUtil.addIfNotNull(openedPaths, getProjectPath(openProject));
    }

    final LinkedHashSet<String> paths;
    synchronized (myStateLock) {
      paths = ContainerUtil.newLinkedHashSet(myState.recentPaths);
    }
    paths.remove(null);
    paths.removeAll(openedPaths);

    ArrayList<AnAction> actions = new ArrayList<AnAction>();
    Set<String> duplicates = getDuplicateProjectNames(openedPaths, paths);
    for (final String path : paths) {
      final String projectName = getProjectName(path);
      String displayName;
      synchronized (myStateLock) {
        displayName = myState.names.get(path);
      }
      if (StringUtil.isEmptyOrSpaces(displayName)) {
        displayName = duplicates.contains(path) ? path : projectName;
      }

      // It's better don't to remove non-existent projects. Sometimes projects stored
      // on USB-sticks or flash-cards, and it will be nice to have them in the list
      // when USB device or SD-card is mounted
      if (new File(path).exists()) {
        actions.add(new ReopenProjectAction(path, projectName, displayName));
      }
    }

    if (actions.isEmpty()) {
      return AnAction.EMPTY_ARRAY;
    }

    ArrayList<AnAction> list = new ArrayList<AnAction>();
    for (AnAction action : actions) {
      list.add(action);
    }
    if (addClearListItem) {
      AnAction clearListAction =
          new AnAction(IdeBundle.message("action.clear.list")) {
            public void actionPerformed(AnActionEvent e) {
              final int rc =
                  Messages.showOkCancelDialog(
                      e.getData(PlatformDataKeys.PROJECT),
                      "Would you like to clear the list of recent projects?",
                      "Clear Recent Projects List",
                      Messages.getQuestionIcon());

              if (rc == 0) {
                synchronized (myStateLock) {
                  myState.recentPaths.clear();
                }
                WelcomeFrame.clearRecents();
              }
            }
          };

      list.add(Separator.getInstance());
      list.add(clearListAction);
    }

    return list.toArray(new AnAction[list.size()]);
  }