protected void addAction(IMenuManager menu, String actionId) {
   IAction action = getAction(actionId);
   if (action != null) {
     if (action instanceof IUpdate) ((IUpdate) action).update();
     menu.add(action);
   }
 }
 protected void addAction(IMenuManager menu, String group, String actionId) {
   IAction action = getAction(actionId);
   if (action != null) {
     if (action instanceof IUpdate) ((IUpdate) action).update();
     IMenuManager subMenu = menu.findMenuUsingPath(group);
     if (subMenu != null) subMenu.add(action);
     else menu.appendToGroup(group, action);
   }
 }
Esempio n. 3
0
 private int addEditorAction(IMenuManager menu, String actionID) {
   if (fEditor == null) return 0;
   IAction action = fEditor.getAction(actionID);
   if (action == null) return 0;
   if (action instanceof IUpdate) ((IUpdate) action).update();
   if (action.isEnabled()) {
     menu.add(action);
     return 1;
   }
   return 0;
 }
  private void fillViewSubMenu(IMenuManager source) {
    int added = 0;
    int i = 0;
    for (Iterator iter = fActions.iterator(); iter.hasNext(); ) {
      Action action = (Action) iter.next();
      if (action instanceof IUpdate) ((IUpdate) action).update();

      if (i == 2) source.add(new Separator(GROUP_INCLUDEPATH));
      else if (i == 8) source.add(new Separator(GROUP_FILTER));
      else if (i == 10) source.add(new Separator(GROUP_CUSTOMIZE));
      added += addAction(source, action);
      i++;
    }

    if (added == 0) {
      source.add(fNoActionAvailable);
    }
  }