Java 类org.eclipse.ui.navigator.ICommonMenuConstants 实例源码

项目:LibertyEiffel-Eclipse-Plugin    文件:NewActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    IMenuManager subMenu = new MenuManager("New", NEW_MENU_NAME);
    if (!contribute) {
        return;
    }

    //Fill the menu from the commonWizard contributions
    newWizardActionGroup.setContext(getContext());
    newWizardActionGroup.fillContextMenu(subMenu);

    subMenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));

    //Add other ..
    subMenu.add(new Separator());
    subMenu.add(showDlgAction);

    //append the submenu after the GROUP_NEW group
    menu.insertAfter(ICommonMenuConstants.GROUP_NEW, subMenu);
}
项目:fluentmark    文件:MkOutlinePage.java   
protected void contextMenuAboutToShow(IMenuManager mgr) {
    if (mgr.isEmpty()) {
        mgr.add(new GroupMarker(ICommonMenuConstants.GROUP_GOTO));
        mgr.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
        mgr.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
        mgr.add(new Separator(ICommonMenuConstants.GROUP_PROPERTIES));

        mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_COPY));
        mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_CUT));
        mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_PASTE));
        mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_DELETE));
    }

    actionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
    actionGroups.fillContextMenu(mgr);
}
项目:jsbuild-eclipse    文件:OpenEditorActionGroup.java   
private void addOpenWithMenu(IMenuManager menu) {
    ISelection selection = getContext().getSelection();
    if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
        return;
    IStructuredSelection ss = (IStructuredSelection) selection;
    if (ss.size() != 1)
        return;

    Object o = ss.getFirstElement();
    if (!(o instanceof IAdaptable))
        return;

    IAdaptable element = (IAdaptable) o;
    Object resource = element.getAdapter(IResource.class);
    if (!(resource instanceof IFile))
        return;

    // Create a menu.
    IMenuManager submenu = new MenuManager(
            ActionMessages.OpenWithMenu_label);
    submenu.add(new OpenWithMenu(fSite.getPage(), (IFile) resource));

    // Add the submenu.
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, submenu);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaPlugin.java   
/**
 * Creates the Java plug-in's standard groups for view context menus.
 *
 * @param menu the menu manager to be populated
 */
public static void createStandardGroups(IMenuManager menu) {
    if (!menu.isEmpty())
        return;

    menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
    menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
    menu.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
    menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
    menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
    menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
    menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
    menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
    menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
    menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
项目:Eclipse-Postfix-Code-Completion    文件:CallHierarchyViewPart.java   
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) {
      JavaPlugin.createStandardGroups(menu);

menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
      menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));

      if (fFocusOnSelectionAction.canActionBeAdded()) {
          menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
      }
      if (fExpandWithConstructorsAction.canActionBeAdded()) {
        menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction);
      }

      if (fRemoveFromViewAction.canActionBeAdded()){
        menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction);
      }

      fActionGroups.setContext(new ActionContext(getSelection()));
      fActionGroups.fillContextMenu(menu);
      fActionGroups.setContext(null);

if (fCopyAction.canActionBeAdded()) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
  }
项目:translationstudio8    文件:PortingActionProvider.java   
private void addImportMenu(IMenuManager aMenu) {

        importWizardActionGroup.setContext(getContext());
        if (importWizardActionGroup.getWizardActionIds().length == 0) {
            aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
            return;
        }

        IMenuManager submenu = new MenuManager(
                WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label,
                COMMON_NAVIGATOR_IMPORT_MENU);
        importWizardActionGroup.fillContextMenu(submenu);

        submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
        submenu.add(new Separator());
        submenu.add(importAction);
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
    }
项目:translationstudio8    文件:PortingActionProvider.java   
private void addExportMenu(IMenuManager aMenu) {

        exportWizardActionGroup.setContext(getContext());
        if (exportWizardActionGroup.getWizardActionIds().length == 0) {
            aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction);
            return;
        }
        IMenuManager submenu = new MenuManager(
                WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label,
                COMMON_NAVIGATOR_EXPORT_MENU);
        exportWizardActionGroup.fillContextMenu(submenu);

        submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
        submenu.add(new Separator());
        submenu.add(exportAction);
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
    }
项目:translationstudio8    文件:EditActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    boolean anyResourceSelected = !selection.isEmpty()
            && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER
                    | IResource.FILE);

    copyAction.selectionChanged(selection);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction);
    pasteAction.selectionChanged(selection);
    // menu.insertAfter(copyAction.getId(), pasteAction);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);

    if (anyResourceSelected) {
        deleteAction.selectionChanged(selection);
        // menu.insertAfter(pasteAction.getId(), deleteAction);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaPlugin.java   
/**
 * Creates the Java plug-in's standard groups for view context menus.
 *
 * @param menu the menu manager to be populated
 */
public static void createStandardGroups(IMenuManager menu) {
    if (!menu.isEmpty())
        return;

    menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
    menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
    menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
    menu.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
    menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
    menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
    menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
    menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
    menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
    menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
    menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CallHierarchyViewPart.java   
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) {
      JavaPlugin.createStandardGroups(menu);

menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
      menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));

      if (fFocusOnSelectionAction.canActionBeAdded()) {
          menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
      }
      if (fExpandWithConstructorsAction.canActionBeAdded()) {
        menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction);
      }

      if (fRemoveFromViewAction.canActionBeAdded()){
        menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction);
      }

      fActionGroups.setContext(new ActionContext(getSelection()));
      fActionGroups.fillContextMenu(menu);
      fActionGroups.setContext(null);

if (fCopyAction.canActionBeAdded()) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
  }
项目:tmxeditor8    文件:PortingActionProvider.java   
private void addImportMenu(IMenuManager aMenu) {

        importWizardActionGroup.setContext(getContext());
        if (importWizardActionGroup.getWizardActionIds().length == 0) {
            aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
            return;
        }

        IMenuManager submenu = new MenuManager(
                WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label,
                COMMON_NAVIGATOR_IMPORT_MENU);
        importWizardActionGroup.fillContextMenu(submenu);

        submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
        submenu.add(new Separator());
        submenu.add(importAction);
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
    }
项目:tmxeditor8    文件:PortingActionProvider.java   
private void addExportMenu(IMenuManager aMenu) {

        exportWizardActionGroup.setContext(getContext());
        if (exportWizardActionGroup.getWizardActionIds().length == 0) {
            aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction);
            return;
        }
        IMenuManager submenu = new MenuManager(
                WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label,
                COMMON_NAVIGATOR_EXPORT_MENU);
        exportWizardActionGroup.fillContextMenu(submenu);

        submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
        submenu.add(new Separator());
        submenu.add(exportAction);
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
    }
项目:tmxeditor8    文件:EditActionGroup.java   
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    boolean anyResourceSelected = !selection.isEmpty()
            && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER
                    | IResource.FILE);

    copyAction.selectionChanged(selection);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction);
    pasteAction.selectionChanged(selection);
    // menu.insertAfter(copyAction.getId(), pasteAction);
    // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);

    if (anyResourceSelected) {
        deleteAction.selectionChanged(selection);
        // menu.insertAfter(pasteAction.getId(), deleteAction);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction);
    }
}
项目:Pydev    文件:PythonActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    if (openResourceAction.isEnabledForSelectionWithoutContainers()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openResourceAction);
    }
    if (openPythonAction.isEnabledForSelectionWithoutContainers()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openPythonAction);
    }
    if (openExternalAction.isEnabledForSelectionWithoutContainers()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openExternalAction);
    }
    if (copyResourceAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyResourceAction);
    }
    if (pasteAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);
    }
    if (deleteResourceAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteResourceAction);
    }
    if (moveResourceAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, moveResourceAction);
    }
}
项目:goclipse    文件:LangNavigatorActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    IProject project = getBundleProjectFromSelection();
    if(project == null)
        return;

    if(ResourcesPlugin.getWorkspace().isAutoBuilding()) {
        // This action is not otherwise shown if project is auto-building, so add it.

        IStructuredSelection structuredSel = getStructuredSelection();
        if(structuredSel != null) {
            buildAction.selectionChanged(structuredSel);
        }
        menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
    }
}
项目:LibertyEiffel-Eclipse-Plugin    文件:RefreshActionProvider.java   
@SuppressWarnings("rawtypes")
@Override
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
    boolean hasClosedProjects = false;
    Iterator resources = selection.iterator();

    while (resources.hasNext() && (!hasClosedProjects)) {
        Object next = resources.next();
        IProject project = null;

        if (next instanceof IProject) {
            project = (IProject) next;
        } else if (next instanceof IAdaptable) {
            project = (IProject) ((IAdaptable) next).getAdapter(IProject.class);
        }

        if (project == null) {
            continue;
        }

        if (!project.isOpen()) {
            hasClosedProjects = true;
        }
    }

    if (!hasClosedProjects) {
        refreshAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
    }
}
项目:fluentmark    文件:MkOutlinePage.java   
private void createToolBar() {
    IToolBarManager mgr = getSite().getActionBars().getToolBarManager();
    mgr.removeAll();

    mgr.add(new Separator(ICommonMenuConstants.GROUP_SHOW));
    mgr.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    mgr.add(new Separator(ICommonMenuConstants.GROUP_VIEWER_SETUP));

    mgr.appendToGroup(ICommonMenuConstants.GROUP_SHOW, actions.get(ACTION_TOGGLE));
    mgr.appendToGroup(ICommonMenuConstants.GROUP_VIEWER_SETUP, actions.get(ACTION_EXPAND));
    mgr.appendToGroup(ICommonMenuConstants.GROUP_VIEWER_SETUP, actions.get(ACTION_COLLAPSE));

    mgr.update(false);
}
项目:fluentmark    文件:OpenViewActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);
    // if (fShowShowInMenu) {
    // MenuManager showInSubMenu = new MenuManager(getShowInMenuLabel());
    // IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    // showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(workbenchWindow));
    // menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, showInSubMenu);
    // }

    IStructuredSelection selection = getStructuredSelection();
    if (fShowOpenPropertiesAction && selection != null && fOpenPropertiesDialog.isApplicableForSelection())
        menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog);
}
项目:datahierarchy    文件:JavaActionsGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);
    if (selection != null && !selection.isEmpty()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyQualifiedNameAction);
    }
}
项目:SecureBPMN    文件:RenameActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);
    ISelection selection = getContext().getSelection();
    if (selection.isEmpty())
        return;
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sel = (IStructuredSelection) selection;
        Object el = sel.getFirstElement();
        if (el instanceof EClass) {
            EClass eclass = (EClass) el;
            String platformString = eclass.eResource().getURI().toPlatformString(true);
            Path path = new Path(platformString);
            IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
            if (file == null)
                return;
            IProject project = file.getProject();
            try {
                if (!project.hasNature(ActivitiProjectNature.NATURE_ID))
                    return;
            } catch (CoreException e) {
                e.printStackTrace();
            }
            menu.appendToGroup(ICommonMenuConstants.GROUP_ADDITIONS, getAction(eclass));

        }
    }
}
项目:gama    文件:OpenActionProvider.java   
@Override
public void fillContextMenu(final IMenuManager aMenu) {
    if (!contribute || getContext().getSelection().isEmpty()) { return; }

    final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    openFileAction.selectionChanged(selection);
    if (openFileAction.isEnabled()) {
        aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction);
    }
    addOpenWithMenu(aMenu);
}
项目:gama    文件:OpenActionProvider.java   
private void addOpenWithMenu(final IMenuManager aMenu) {
    final IStructuredSelection ss = (IStructuredSelection) getContext().getSelection();
    if (ss == null || ss.size() != 1) { return; }
    final Object o = ss.getFirstElement();
    // first try IResource
    IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, IResource.class);
    // otherwise try ResourceMapping
    if (openable == null) {
        openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, ResourceMapping.class);
    } else if (((IResource) openable).getType() != IResource.FILE) {
        openable = null;
    }
    if (openable != null) {
        // Create a menu flyout.
        final IMenuManager submenu =
                new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label,
                        ICommonMenuConstants.GROUP_OPEN_WITH);
        submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
        submenu.add(new OpenWithMenu(viewSite.getPage(), openable));
        submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS));

        // Add the submenu.
        if (submenu.getItems().length > 2 && submenu.isEnabled()) {
            aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CCPActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);
    for (int i= 0; i < fActions.length; i++) {
        SelectionDispatchAction action= fActions[i];
        if (action == fCutAction && !fCutAction.isEnabled())
            continue;
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, action);
    }
}
项目:translationstudio8    文件:PropertiesActionProvider.java   
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);

    if (propertiesAction.isApplicableForSelection()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES,
                propertiesAction);
    }

}
项目:translationstudio8    文件:OpenActionProvider.java   
public void fillContextMenu(IMenuManager aMenu) {
        if (!contribute || getContext().getSelection().isEmpty()) {
            return;
        }

        IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

        openFileAction.selectionChanged(selection);
        if (openFileAction.isEnabled()) {
            aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction);
        }
//      addOpenWithMenu(aMenu);
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CCPActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);
    for (int i= 0; i < fActions.length; i++) {
        SelectionDispatchAction action= fActions[i];
        if (action == fCutAction && !fCutAction.isEnabled())
            continue;
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, action);
    }
}
项目:FindBug-for-Domino-Designer    文件:BugActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);

    menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb"));
    menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb.project"));
    menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb.filter"));
}
项目:tmxeditor8    文件:PropertiesActionProvider.java   
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);

    if (propertiesAction.isApplicableForSelection()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES,
                propertiesAction);
    }

}
项目:tmxeditor8    文件:OpenActionProvider.java   
public void fillContextMenu(IMenuManager aMenu) {
        if (!contribute || getContext().getSelection().isEmpty()) {
            return;
        }

        IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

        openFileAction.selectionChanged(selection);
        if (openFileAction.isEnabled()) {
            aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction);
        }
//      addOpenWithMenu(aMenu);
    }
项目:maru    文件:ScenarioActionsProvider.java   
@Override
public void fillContextMenu(IMenuManager menu)
{
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    IMenuManager submenu = new MenuManager("New", NEW_MENU_NAME);

    // fill the menu from the commonWizard contributions
    newWizardActionGroup.setContext(getContext());
    newWizardActionGroup.fillContextMenu(submenu);
    submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, submenu);

    if (selection.isEmpty()) {
        return;
    }

    if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT))
    {
        projectDeleteAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, projectDeleteAction);
    }
    else if (allScenarioElementsAreRemovable(selection))
    {
        elementDeleteAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, elementDeleteAction);
    }

    // add the 'Properties' entry to the popup menu
    propertyDialogAction.selectionChanged(selection);
    menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES, propertyDialogAction);
}
项目:goclipse    文件:LangEditorContextMenuContributor.java   
public void editorContextMenuAboutToShow(IMenuManager ctxMenu) {
    ctxMenu.prependToGroup(ICommonMenuConstants.GROUP_OPEN, new CommandContributionItem(
        createCommandContrib_OpenDefinitionContrib()));

    ctxMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new CommandContributionItem(
        createCommandContrib_QuickOutline()));

    prepareSourceMenu(ctxMenu);
}
项目:goclipse    文件:GoNavigatorActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    super.fillContextMenu(menu);

    if(navigatorOpenAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, navigatorOpenAction);
    }
}
项目:pgcodekeeper    文件:NavigatorOutlineActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    if (openAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openAction);
    }
}
项目:pgcodekeeper    文件:NavigatorRootActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    if (openAction.isEnabled()) {
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openAction);
    }
}
项目:fluentmark    文件:OpenViewActionGroup.java   
@SuppressWarnings("unused")
private void appendToGroup(IMenuManager menu, IAction action) {
    if (action.isEnabled()) menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, action);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
  /*
   * Actions on multiple selections
   */
  menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, new DFSAction(
      DFSActions.DELETE));

  menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
      DFSActions.REFRESH));

  menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
      DFSActions.DOWNLOAD));

  if (site == null)
    return;

  ISelection isel = site.getStructuredViewer().getSelection();
  if (!(isel instanceof IStructuredSelection))
    return;

  /*
   * Actions on single selections only
   */

  IStructuredSelection issel = (IStructuredSelection) isel;
  if (issel.size() != 1)
    return;
  Object element = issel.getFirstElement();

  if (element instanceof DFSFile) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.OPEN));

  } else if (element instanceof DFSFolder) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.MKDIR));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.UPLOAD_FILES));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.UPLOAD_DIR));

  } else if (element instanceof DFSLocation) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.RECONNECT));

  } else if (element instanceof DFSLocationsRoot) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.DISCONNECT));
  }

}
项目:hadoop-EAR    文件:ActionProvider.java   
@Override
public void fillContextMenu(IMenuManager menu) {
  /*
   * Actions on multiple selections
   */
  menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, new DFSAction(
      DFSActions.DELETE));

  menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
      DFSActions.REFRESH));

  menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
      DFSActions.DOWNLOAD));

  if (site == null)
    return;

  ISelection isel = site.getStructuredViewer().getSelection();
  if (!(isel instanceof IStructuredSelection))
    return;

  /*
   * Actions on single selections only
   */

  IStructuredSelection issel = (IStructuredSelection) isel;
  if (issel.size() != 1)
    return;
  Object element = issel.getFirstElement();

  if (element instanceof DFSFile) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.OPEN));

  } else if (element instanceof DFSFolder) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.MKDIR));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.UPLOAD_FILES));
    menu.appendToGroup(ICommonMenuConstants.GROUP_NEW, new DFSAction(
        DFSActions.UPLOAD_DIR));

  } else if (element instanceof DFSLocation) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.RECONNECT));

  } else if (element instanceof DFSLocationsRoot) {
    menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, new DFSAction(
        DFSActions.DISCONNECT));
  }

}
项目:jsbuild-eclipse    文件:OpenEditorActionGroup.java   
private void appendToGroup(IMenuManager menu, IAction action) {
    if (action.isEnabled())
        menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN, action);
}
项目:NEXCORE-UML-Modeler    文件:UMLResourceMgmtActionProvider.java   
/**
 * Adds the build, open project, close project and refresh resource actions
 * to the context menu.
 * <p>
 * The following conditions apply: build-only projects selected, auto build
 * disabled, at least one builder present open project-only projects
 * selected, at least one closed project close project-only projects
 * selected, at least one open project refresh-no closed project selected
 * </p>
 * <p>
 * Both the open project and close project action may be on the menu at the
 * same time.
 * </p>
 * <p>
 * No disabled action should be on the context menu.
 * </p>
 * 
 * @param menu
 *            context menu to add actions to
 */
public void fillContextMenu(IMenuManager menu) {
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
    boolean isProjectSelection = true;
    boolean hasOpenProjects = false;
    boolean hasClosedProjects = false;
    boolean hasBuilder = true; // false if any project is closed or does not
    // have builder
    Iterator resources = selection.iterator();

    while (resources.hasNext() && (!hasOpenProjects || !hasClosedProjects || hasBuilder || isProjectSelection)) {
        Object next = resources.next();
        IProject project = null;

        if (next instanceof IProject) {
            project = (IProject) next;
        } else if (next instanceof IAdaptable) {
            project = (IProject) ((IAdaptable) next).getAdapter(IProject.class);
        }

        if (project == null) {
            isProjectSelection = false;
            continue;
        }
        if (project.isOpen()) {
            hasOpenProjects = true;
            if (hasBuilder && !hasBuilder(project)) {
                hasBuilder = false;
            }
        } else {
            hasClosedProjects = true;
            hasBuilder = false;
        }
    }
    if (!selection.isEmpty() && isProjectSelection && !ResourcesPlugin.getWorkspace().isAutoBuilding()
        && hasBuilder) {
        // Allow manual incremental build only if auto build is off.
        buildAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction);
    }
    if (!hasClosedProjects) {
        refreshAction.selectionChanged(selection);
        menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, refreshAction);
    }
    if (isProjectSelection) {
        if (hasClosedProjects) {
            openProjectAction.selectionChanged(selection);
            menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, openProjectAction);
        }
        if (hasOpenProjects) {
            closeProjectAction.selectionChanged(selection);
            menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, closeProjectAction);
            closeUnrelatedProjectsAction.selectionChanged(selection);
            menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, closeUnrelatedProjectsAction);
        }
    }
}
项目:translationstudio8    文件:PortingActionProvider.java   
private void addSimplePortingMenus(IMenuManager aMenu) {
    aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
    aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction);
}