本文整理汇总了Java中org.eclipse.ui.navigator.ICommonMenuConstants类的典型用法代码示例。如果您正苦于以下问题:Java ICommonMenuConstants类的具体用法?Java ICommonMenuConstants怎么用?Java ICommonMenuConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICommonMenuConstants类属于org.eclipse.ui.navigator包,在下文中一共展示了ICommonMenuConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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);
}
示例2: contextMenuAboutToShow
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
示例3: addOpenWithMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
示例4: createStandardGroups
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
/**
* 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));
}
示例5: fillCallHierarchyViewerContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
}
示例6: addImportMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
示例7: addExportMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
示例8: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
}
示例9: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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);
}
}
示例10: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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);
}
}
示例11: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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);
}
}
示例12: createToolBar
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
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);
}
示例13: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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);
}
示例14: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@Override
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
if (selection != null && !selection.isEmpty()) {
menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyQualifiedNameAction);
}
}
示例15: fillContextMenu
import org.eclipse.ui.navigator.ICommonMenuConstants; //导入依赖的package包/类
@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));
}
}
}