/** {@inheritDoc} */
  public Menu getMenu(final Control parent) {
    if (manager == null) {
      manager = new MenuManager();
    }
    Menu menu = manager.getMenu();
    if (menu != null) {
      menu.dispose();
      menu = null;
    }
    manager.removeAll();
    menu = manager.createContextMenu(parent);
    IAction removeAction =
        new Action(
            "Remove Section Set",
            Activator.imageDescriptorFromPlugin(Activator.ID, "/icons/delete.gif")) {

          /** {@inheritDoc} */
          @Override
          public void run() {
            // remove this section descriptor set state from its parent
            sectionSetDescriptorStates.remove(getSectionSetDescriptorState());
            metamodelViewer.refresh();
          }
        };
    manager.add(removeAction);
    manager.add(new Separator(ADD_GROUP));

    return menu;
  }
  protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
    MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);

    menuBar.add(fileMenu);
    // Add a group marker indicating where action set menus will appear.
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(helpMenu);
    helpMenu.add(helpContentsAction);

    // File Menu
    /* fileMenu.add(prefAction);
    fileMenu.add(new Separator());
    fileMenu.add(exitAction); */

    // Ajout sous la forme de ActionContributionItem pour pouvoir rendre les actions ensuite
    // invisibles, car elle sont dŽjˆ prŽsentes dans le menu Pomme du mac.
    ActionContributionItem preferencesActionItem = new ActionContributionItem(prefAction);
    fileMenu.add(preferencesActionItem);
    ActionContributionItem exitActionItem = new ActionContributionItem(exitAction);
    fileMenu.add(exitActionItem);

    if (Util.isMac()) {
      preferencesActionItem.setVisible(false);
      exitActionItem.setVisible(false);
    }
  }
 private void createMenu() {
   MenuManager manager = new MenuManager();
   manager.add(new OpenEditorAction());
   manager.add(TreeClipboard.onCopy(tree));
   Menu menu = manager.createContextMenu(tree.getControl());
   tree.getControl().setMenu(menu);
 }
  /**
   * DOC klliu Comment method "buildControls".
   *
   * @param group
   */
  private void buildControls(Group group) {
    table = new Table(group, SWT.FULL_SELECTION);
    GridData data = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(data);
    viewer = buildAndLayoutTable(table);

    attachContentProvider(viewer);
    attachLabelProvider(viewer);
    attachCellEditors(viewer, table);

    MenuManager popupMenu = new MenuManager();
    IAction newRowAction = new NewRowAction();
    popupMenu.add(newRowAction);
    IAction delRowAction = new DelRowAction();
    popupMenu.add(delRowAction);
    Menu menu = popupMenu.createContextMenu(table);
    table.setMenu(menu);
    table.addListener(
        SWT.Modify,
        new Listener() {

          public void handleEvent(Event event) {
            checkFieldsValue();
          }
        });
    viewer.setInput(content);
    // viewer.addSelectionChangedListener(new listener)
    createDefinitionParametersButton(group, viewer);
  }
 protected MenuManager createMenuManager() {
   MenuManager main_menu = new MenuManager(null);
   MenuManager action_menu = new MenuManager("Menu");
   main_menu.add(action_menu);
   action_menu.add(status_action);
   return main_menu;
 }
    @Override
    protected void addActions(MenuManager menuManager) {
      IAction action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_11,
              IDiagramModelConnection.ARROW_NONE,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.LINE_SOLID));
      action.setChecked(
          (fConnection.getType() & IDiagramModelConnection.ARROW_FILL_TARGET) == 0
              & (fConnection.getType() & IDiagramModelConnection.ARROW_HOLLOW_TARGET) == 0
              & (fConnection.getType() & IDiagramModelConnection.ARROW_LINE_TARGET) == 0);
      menuManager.add(action);

      action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_12,
              IDiagramModelConnection.ARROW_FILL_TARGET,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.ARROW_TARGET_FILL));
      menuManager.add(action);

      action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_13,
              IDiagramModelConnection.ARROW_HOLLOW_TARGET,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.ARROW_TARGET_HOLLOW));
      menuManager.add(action);

      action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_14,
              IDiagramModelConnection.ARROW_LINE_TARGET,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.ARROW_TARGET_LINE));
      menuManager.add(action);
    }
  /*
   * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
   */
  @Override
  public void contributeToMenu(IMenuManager menu) {

    super.contributeToMenu(menu);

    IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
    if (editMenu != null) {

      MenuManager structureSelection =
          new MenuManager(
              JavaEditorMessages.ExpandSelectionMenu_label, "expandSelection"); // $NON-NLS-1$
      editMenu.insertAfter(ITextEditorActionConstants.SELECT_ALL, structureSelection);
      structureSelection.add(fStructureSelectEnclosingAction);
      structureSelection.add(fStructureSelectNextAction);
      structureSelection.add(fStructureSelectPreviousAction);
      structureSelection.add(fStructureSelectHistoryAction);

      editMenu.appendToGroup(
          ITextEditorActionConstants.GROUP_INFORMATION, fRetargetShowInformationAction);
    }

    IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
    if (navigateMenu != null) {
      navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
      navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fOpenHierarchy);
    }

    IMenuManager gotoMenu = menu.findMenuUsingPath("navigate/goTo"); // $NON-NLS-1$
    if (gotoMenu != null) {
      gotoMenu.add(new Separator("additions2")); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); // $NON-NLS-1$
    }
  }
    @Override
    protected void addActions(MenuManager menuManager) {
      IAction action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_2,
              IDiagramModelConnection.LINE_SOLID,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.LINE_SOLID));
      menuManager.add(action);
      action.setChecked(
          (fConnection.getType() & IDiagramModelConnection.LINE_DASHED) == 0
              & (fConnection.getType() & IDiagramModelConnection.LINE_DOTTED) == 0);

      action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_3,
              IDiagramModelConnection.LINE_DASHED,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.LINE_DASHED));
      menuManager.add(action);

      action =
          createAction(
              Messages.DiagramConnectionLineStyleSection_4,
              IDiagramModelConnection.LINE_DOTTED,
              IZentaImages.ImageFactory.getImageDescriptor(IZentaImages.LINE_DOTTED));
      menuManager.add(action);
    }
Esempio n. 9
0
 public MenuManager fillSortMenu() {
   MenuManager subMenu = new MenuManager("Sort by ...");
   subMenu.add(
       new Action("ID") {
         @Override
         public void run() {
           ModelProvider.INSTANCE.sortBy(SortBy.ID);
           refresh();
         }
       });
   subMenu.add(
       new Action("Name") {
         @Override
         public void run() {
           ModelProvider.INSTANCE.sortBy(SortBy.NAME);
           refresh();
         }
       });
   subMenu.add(
       new Action("Status") {
         @Override
         public void run() {
           ModelProvider.INSTANCE.sortBy(SortBy.STATUS);
           refresh();
         }
       });
   return subMenu;
 }
Esempio n. 10
0
 /**
  * Create the menu manager.
  *
  * @return the menu manager
  */
 @Override
 protected MenuManager createMenuManager() {
   MenuManager menuManager = new MenuManager("menu");
   menuManager.add(MenuAction.aboutAction);
   menuManager.add(MenuAction.exitAction);
   return menuManager;
 }
Esempio n. 11
0
  private static void hookMenu(final Graph g) {
    MenuManager menuMgr = new MenuManager("#PopupMenu");

    Action parentAction =
        new Action() {
          public void run() {
            List selection = g.getSelection();
            if (!selection.isEmpty()) {
              GraphNode selected = (GraphNode) selection.get(0);
              parentNode = selected;
              tryToAddConnection(g);
            }
          }
        };
    parentAction.setText("use as parent");
    menuMgr.add(parentAction);

    Action childAction =
        new Action() {
          public void run() {
            List selection = g.getSelection();
            if (!selection.isEmpty()) {
              GraphNode selected = (GraphNode) selection.get(0);
              childNode = selected;
              tryToAddConnection(g);
            }
          }
        };
    childAction.setText("use as child");
    menuMgr.add(childAction);

    Action expandAction =
        new Action() {
          public void run() {
            List selection = g.getSelection();
            if (!selection.isEmpty()) {
              GraphNode selected = (GraphNode) selection.get(0);
              g.setExpanded((GraphNode) selected, true);
            }
          }
        };
    expandAction.setText("expand");
    menuMgr.add(expandAction);

    Action collapseAction =
        new Action() {
          public void run() {
            List selection = g.getSelection();
            if (!selection.isEmpty()) {
              GraphItem selected = (GraphItem) selection.get(0);
              g.setExpanded((GraphNode) selected, false);
            }
          }
        };
    collapseAction.setText("collapse");
    menuMgr.add(collapseAction);

    g.setMenu(menuMgr.createContextMenu(g));
  }
 protected MenuManager populateMenuManager() {
   MenuManager menuBar = this.getMenuBarManager();
   MenuManager fileMenu = new MenuManager("&File");
   MenuManager helpMenu = new MenuManager("&Help");
   menuBar.add(fileMenu);
   menuBar.add(helpMenu);
   fileMenu.add(exitAction);
   return menuBar;
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager)
  */
 @Override
 protected void fillMenuBar(IMenuManager menuBar) {
   MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
   ActionContributionItem preferencesItem = new ActionContributionItem(preferenceAction);
   preferencesItem.setVisible(!SWT.getPlatform().equals("carbon"));
   fileMenu.add(preferencesItem);
   menuBar.add(fileMenu);
   fileMenu.add(exitAction);
 }
  protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);

    menuBar.add(fileMenu);

    // File
    fileMenu.add(newWindowAction);
    fileMenu.add(new Separator());
    fileMenu.add(exitAction);
  }
  @Override
  public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    MenuManager sourceMenu = new MenuManager("Source");
    menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, sourceMenu);
    sourceMenu.add(this.commentAction);
    sourceMenu.add(this.uncommentAction);
    sourceMenu.add(this.toggleCommentsAction);
  }
  protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);

    // Help menu options
    helpMenu.add(showHelpAction);
    helpMenu.add(searchHelpAction);
    helpMenu.add(dynamicHelpAction);
    helpMenu.add(new Separator());

    menuBar.add(helpMenu);
  }
  /**
   * Creates the context menu that is associated with the tree.
   *
   * <p><strong>The {@link #createActions} method must have been invoked prior to this
   * method</strong>
   */
  private void createContextMenu() {
    // Create menu manager.
    MenuManager menuManager = new MenuManager();
    menuManager.add(newPolicyAction);
    menuManager.add(new Separator());
    menuManager.add(deletePolicyAction);

    // Create the menu and add it to the tree.
    final Tree tree = categoriesComposite.getTreeViewer().getTree();
    Menu menu = menuManager.createContextMenu(tree);
    tree.setMenu(menu);
  }
Esempio n. 18
0
  private void winMenu(MenuManager menuManager) {
    MenuManager fileMenu =
        new MenuManager(XdccBeeMessages.getString("Application_MENU_FILE")); // $NON-NLS-1$
    MenuManager helpMenu =
        new MenuManager(XdccBeeMessages.getString("Application_MENU_HELP")); // $NON-NLS-1$
    menuManager.add(fileMenu);
    menuManager.add(helpMenu);
    fileMenu.add(new ActionPreferences(getShell()));
    fileMenu.add(new ActionQuit(true));

    helpMenu.add(new ActionAbout(getShell()));
  }
 /** Adds the perspective actions to the specified menu. */
 private void addPerspectiveActions(MenuManager menu) {
   {
     MenuManager showViewMenuMgr =
         new MenuManager(Messages.ShowViewMenuName, "showView"); // $NON-NLS-1$
     IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(getWindow());
     showViewMenuMgr.add(showViewMenu);
     menu.add(showViewMenuMgr);
   }
   menu.add(new Separator());
   menu.add(editActionSetAction);
   menu.add(getResetPerspectiveItem());
 }
Esempio n. 20
0
  /**
   * Creates an editor instance.
   *
   * @param config the UI configuration
   * @param variable the variable to edit
   * @param parent the parent composite
   */
  private ConstraintsEditor(UIConfiguration config, IDecisionVariable variable, Composite parent) {
    super(config, variable, parent, SWT.NULL);
    this.config = config;
    setLayout(new FillLayout());
    tableViewer = setTableViewer(createTableViewer(this, true));

    IDatatype type = DerivedDatatype.resolveToBasis(variable.getDeclaration().getType());
    if (1 == type.getGenericTypeCount()) {
      IDatatype contained = type.getGenericType(0);
      if (ConstraintType.TYPE.isAssignableFrom(contained)) {
        Value val = variable.getValue();
        if (val instanceof ContainerValue) {
          variableValue = (ContainerValue) val;
          fillTable(toConstraints((ContainerValue) val), tableViewer);
        }
      }
    }

    tableViewer.addDoubleClickListener(
        new IDoubleClickListener() {

          @Override
          public void doubleClick(DoubleClickEvent event) {
            // IStructuredSelection does not work well until content provider is used
            if (tableViewer == event.getSource()) {
              editSelectedConstraint();
            }
          }
        });

    manager = new MenuManager();
    tableViewer.getControl().setMenu(manager.createContextMenu(tableViewer.getControl()));
    manager.add(
        new Action("Add constraint", null) {

          @Override
          public void run() {
            addConstraint();
          }
        });
    manager.add(
        new Action("Remove constraint", null) {
          @Override
          public void run() {
            removeSelectedConstraint();
          }
        });
  }
Esempio n. 21
0
 private void fillOpenWithMenu(IMenuManager menu, Object object) {
   if (object instanceof IAdaptable) {
     MenuManager submenu = new MenuManager("Open With", OPEN_WITH_ID);
     submenu.add(new OpenWithMenu(view.getSite().getPage(), (IAdaptable) object));
     menu.add(submenu);
   }
 }
Esempio n. 22
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ptp.ui.actions.GotoDropDownAction#createDropDownMenu(org.eclipse.jface.action.MenuManager)
   */
  @Override
  protected void createDropDownMenu(MenuManager dropDownMenuMgr) {
    String curID = view.getCurrentSetID();
    if (curID == null || curID.length() == 0) {
      return;
    }

    addAction(
        dropDownMenuMgr, IElementHandler.SET_ROOT_ID, IElementHandler.SET_ROOT_ID, curID, null);
    IElementHandler setManager = view.getCurrentElementHandler();
    if (setManager == null) {
      return;
    }

    IElementSet[] sets = setManager.getSets();
    if (sets.length > 1) {
      dropDownMenuMgr.add(new Separator());
    }
    for (IElementSet set : sets) {
      if (set instanceof IElementSet) {
        if (set.getID().equals(IElementHandler.SET_ROOT_ID)) {
          continue;
        }

        addAction(dropDownMenuMgr, set.getID(), set.getID(), curID, null);
      }
    }
  }
  public static void addActionsLibraryToMenu(IMenuManager manager) {
    if (!actionsLoaded) {
      initActions();
    }

    addMenuForAspect(
        manager, MODELING_ASPECT_LABELS.MODEL_PROJECT_MANAGEMENT, ASPECT_MODEL_PROJECT_MANAGEMENT);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.DEFINE_MODELS, ASPECT_DEFINE_MODELS);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.MANAGE_CONNECTIONS, ASPECT_MANAGE_CONNECTIONS);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.MODEL_DATA_SOURCES, ASPECT_MODEL_DATA_SOURCES);
    // addMenuForAspect(manager, MODELING_ASPECT_LABELS.CONSUME_REST_WS, ASPECT_CONSUME_REST_WS);
    //		addMenuForAspect(manager, MODELING_ASPECT_LABELS.CONSUME_SOAP_WS, ASPECT_CONSUME_SOAP_WS);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.MANAGE_VDBS, ASPECT_MANAGE_VDBS);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.TEIID_SERVER, ASPECT_TEIID_SERVER);
    addMenuForAspect(manager, MODELING_ASPECT_LABELS.TEST, ASPECT_TEST);

    if (!cheatSheetActions.isEmpty()) {
      manager.add(new Separator());
      MenuManager subManager = new MenuManager("Cheat Sheets"); // $NON-NLS-1$
      for (IAction action : cheatSheetActions) {
        subManager.add(action);
      }
      manager.add(subManager);
    }
  }
  /** Creates and returns the Window menu. */
  private MenuManager createWindowMenu() {
    MenuManager menu = new MenuManager(Messages.WindowMenuName, IWorkbenchActionConstants.M_WINDOW);

    addPerspectiveActions(menu);
    Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
    sep.setVisible(!Util.isMac());
    menu.add(sep);

    // See the comment for quit in createFileMenu
    ActionContributionItem openPreferencesItem = new ActionContributionItem(openPreferencesAction);
    openPreferencesItem.setVisible(!Util.isMac());
    menu.add(openPreferencesItem);

    menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
    return menu;
  }
 private void addToManager(
     MenuManager parentManager, MMenuElement model, IContributionItem menuManager) {
   MElementContainer<MUIElement> parent = model.getParent();
   // technically this shouldn't happen
   if (parent == null) {
     parentManager.add(menuManager);
   } else {
     int index = parent.getChildren().indexOf(model);
     // shouldn't be -1, but better safe than sorry
     if (index > parentManager.getSize() || index == -1) {
       parentManager.add(menuManager);
     } else {
       parentManager.insert(index, menuManager);
     }
   }
 }
  void fillContextMenu(IMenuManager manager) {
    addFocusActionOrNot(manager);
    manager.add(fResetAction);
    manager.add(fRefreshAction);
    manager.add(new Separator());

    if (!getSite().getSelectionProvider().getSelection().isEmpty()) {
      MenuManager showInSubMenu = new MenuManager(getShowInMenuLabel());
      IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
      showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(workbenchWindow));
      manager.add(showInSubMenu);
    }
    addElementActionsOrNot(manager);
    manager.add(new Separator());

    manager.add(fCopyAction);
    manager.add(new Separator());

    fDrillDownAdapter.addNavigationActions(manager);
    manager.add(new Separator());
    // Other plug-ins can contribute there actions here
    manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    manager.add(new Separator());
    addCompareActionOrNot(manager);
    manager.add(fPropertiesAction);
  }
Esempio n. 27
0
 protected void fillMenu(final MenuManager menuManager) {
   final EditingDomain editingDomain = getEditingDomain();
   final EObject base = (EObject) getBaseObservable().getValue();
   if (base == null) {
     return;
   }
   final Collection<?> descriptors = editingDomain.getNewChildDescriptors(base, null);
   for (final Object descriptor : descriptors) {
     if (!(descriptor instanceof CommandParameter)) {
       continue;
     }
     final CommandParameter parameter = (CommandParameter) descriptor;
     if (parameter.getEStructuralFeature() != getEFeature()) {
       continue;
     }
     final IContributionItem item =
         new EditCommandContributionItem(parameter, editingDomain, getBaseObservable()) {
           @Override
           protected void executed(final Collection<?> result) {
             final Iterator<?> iter = result.iterator();
             if (iter.hasNext()) {
               final Object value = iter.next();
               if (fModelObservable.contains(value)) {
                 fSingleSelectionObservable.setValue(value);
               }
             }
           }
         };
     menuManager.add(item);
   }
 }
Esempio n. 28
0
  private void hookPopupMenus() {
    MenuManager menuMgr = new MenuManager("#PopupMenu1"); // $NON-NLS-1$
    Menu menu = menuMgr.createContextMenu(termsTableViewer.getTable());
    termsTableViewer.getControl().setMenu(menu);

    menuMgr.add(this.makeStarTermAction);
    menuMgr.add(this.addTermAction);
    menuMgr.add(this.deleteTermAction);

    menuMgr = new MenuManager("#PopupMenu2"); // $NON-NLS-1$
    menu = menuMgr.createContextMenu(termsOtherLgTableViewer.getTable());
    termsOtherLgTableViewer.getControl().setMenu(menu);

    menuMgr.add(this.addTranslatedTermAction);
    menuMgr.add(this.deleteTranslatedTermAction);
  }
Esempio n. 29
0
 public static void fillVmListMenu(IMenuManager manager, List<VMTreeObject> list) {
   List<VMTreeObjectVMinGroup> vmList = new ArrayList<VMTreeObjectVMinGroup>();
   boolean isDefault = true;
   boolean isNotDefault = true;
   for (VMTreeObject o : list) {
     if (o.getParent().getName().equals(Constants.VM_GROUP_DEFAULT_NAME)) {
       isNotDefault = false;
     } else {
       isDefault = false;
     }
     vmList.add((VMTreeObjectVMinGroup) o);
   }
   if (isDefault) {
     MenuManager addtogroupMenu = new MenuManager("Ìí¼Óµ½...");
     for (VMTreeObject group : vmList.get(0).getParent().getParent().getChildren()) {
       if (!group.getName().equals(Constants.VM_GROUP_DEFAULT_NAME)) {
         addtogroupMenu.add(new AddtoGroupAction(vmList, (VMTreeObjectGroup) group));
       }
     }
     manager.add(addtogroupMenu);
     return;
   }
   if (isNotDefault) {
     manager.add(new ResetGroupAction(vmList));
   }
 }
Esempio n. 30
0
  public static void fillVMMenu(IMenuManager manager, VMTreeObject selection) {

    VMTreeObjectVMinGroup vminGroup = (VMTreeObjectVMinGroup) selection;
    if (selection.getParent().getName().equals(Constants.VM_GROUP_DEFAULT_NAME)) {
      MenuManager addtogroupMenu = new MenuManager("Ìí¼Óµ½...");
      for (VMTreeObject group : vminGroup.getParent().getParent().getChildren()) {
        if (!group.getName().equals(Constants.VM_GROUP_DEFAULT_NAME)) {
          addtogroupMenu.add(new AddtoGroupAction(vminGroup, (VMTreeObjectGroup) group));
        }
      }
      manager.add(addtogroupMenu);
    } else {
      manager.add(new ResetGroupAction(vminGroup));
    }
    manager.add(new Separator());
    VMTreeObjectVM vm = vminGroup.getVmObject();
    VM.Record record = vm.getRecord();
    Types.VmPowerState state = record.powerState;
    if (state.equals(Types.VmPowerState.RUNNING)) {
      manager.add(new ShutDownAction(vm));
      manager.add(new RebootAction(vm));
    } else {
      manager.add(new StartAction(vm));
    }
  }