private void collectActionIds(Collection<String> result, ActionGroup group) {
   final AnAction[] actions = group.getChildren(null);
   for (AnAction action : actions) {
     if (action instanceof ActionGroup) {
       collectActionIds(result, (ActionGroup) action);
     } else if (action != null) {
       result.add(getActionId(action));
     }
   }
 }
 public Object[] getElementsByName(
     final String id, final boolean checkBoxState, final String pattern) {
   final HashMap<AnAction, String> map = new HashMap<AnAction, String>();
   final ActionGroup mainMenu =
       (ActionGroup) myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU);
   collectActions(id, map, mainMenu, mainMenu.getTemplatePresentation().getText());
   if (checkBoxState) {
     final Set<String> ids = ((ActionManagerImpl) myActionManager).getActionIds();
     for (AnAction action : map.keySet()) { // do not add already included actions
       ids.remove(getActionId(action));
     }
     if (ids.contains(id)) {
       final AnAction anAction = myActionManager.getAction(id);
       if (!(anAction instanceof ActionGroup)) {
         map.put(anAction, null);
       }
     }
   }
   return map.entrySet().toArray(new Map.Entry[map.size()]);
 }
 private void collectActions(
     String id,
     Map<AnAction, String> result,
     ActionGroup group,
     final String containingGroupName) {
   final AnAction[] actions = group.getChildren(null);
   for (AnAction action : actions) {
     if (action != null) {
       if (action instanceof ActionGroup) {
         final ActionGroup actionGroup = (ActionGroup) action;
         final String groupName = actionGroup.getTemplatePresentation().getText();
         collectActions(
             id, result, actionGroup, groupName != null ? groupName : containingGroupName);
       } else if (getActionId(action) == id) {
         final String groupName = group.getTemplatePresentation().getText();
         result.put(
             action,
             groupName != null && groupName.length() > 0 ? groupName : containingGroupName);
       }
     }
   }
 }