当前位置: 首页>>代码示例>>Java>>正文


Java IMenuManager类代码示例

本文整理汇总了Java中org.eclipse.jface.action.IMenuManager的典型用法代码示例。如果您正苦于以下问题:Java IMenuManager类的具体用法?Java IMenuManager怎么用?Java IMenuManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IMenuManager类属于org.eclipse.jface.action包,在下文中一共展示了IMenuManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTopLevelElementsEntryNoDuplicates

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
/**
 * Tests that the Top Level Elements
 */
@Test
public void testTopLevelElementsEntryNoDuplicates() {
	IActionBars actionBars = projectExplorer.getViewSite().getActionBars();
	IMenuManager menuManager = actionBars.getMenuManager();

	int topLevelElementsEntriesFound = 0;

	for (IContributionItem item : menuManager.getItems()) {
		if (item instanceof MenuManager) {
			String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText());
			if (escapedMenuText.equals("Top Level Elements")) {
				topLevelElementsEntriesFound++;
			}
		}
	}

	assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.",
			topLevelElementsEntriesFound, 1);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:SelectAllProjectExplorer_PluginUITest.java

示例2: fillContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillContextMenu(final IMenuManager menu) {
	// {@link N4JSProjectActionGroup} does enablement-logic
	// on its own, thus always invoke it here
	projectGroup.fillContextMenu(menu);

	// Only delegate to {@link N4JSWorkingSetActionProvider},
	// if the current selection contains working sets.
	if (selectionContainsWorkingSet) {
		workingSetActionProvider.fillContextMenu(menu);
	}

	if (assignWorkingSetsAction.isEnabled()) {
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, assignWorkingSetsAction);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:N4JSNavigatorActionProvider.java

示例3: fillContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillContextMenu(final IMenuManager menu) {
	super.fillContextMenu(menu);

	// If disabled, do not contribute
	if (!enableContribution) {
		return;
	}

	if (openAction.isEnabled() && enableOpenInContextMenu)
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, openAction);
	if (closeAction.isEnabled())
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeAction);
	if (closeUnrelatedAction.isEnabled()
			&& areOnlyProjectsSelected(closeUnrelatedAction.getStructuredSelection()))
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, closeUnrelatedAction);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:N4JSProjectActionGroup.java

示例4: fillPopupMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillPopupMenu(IMenuManager manager, SchemaViewer viewer) {
	// add element
	ContextualAction action = new AddElementAction("Add", IAction.AS_PUSH_BUTTON, Notifications.notifyRefreshReveal(getContext()));
	action.init(getContext(), true);
	manager.add(action);
	// remove element
	action = new RemoveElementAction("Remove", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF);
	action.init(getContext(), true);
	manager.add(action);		
	// copy
	action = new CopyElementAction("Copy", IAction.AS_PUSH_BUTTON, Notifications.NONE);
	action.init(getContext(), true);
	manager.add(action);
	// paste
	action = new PasteElementAction("Paste", IAction.AS_PUSH_BUTTON, Notifications.NOT_REF);
	action.init(getContext(), true);
	manager.add(action);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:20,代码来源:StudioPopupMenuConfigurationImpl.java

示例5: fillContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
private void fillContextMenu(IMenuManager manager) {

        if (_TableViewer.getSelection().isEmpty()) {
            return;
        }

        manager.add(_NewZnodeAction);
        manager.add(new Separator());
        manager.add(_OpenAction);
        manager.add(new Separator());
        manager.add(_TableEditAction);
        manager.add(_TableEditChildrenAction);
        manager.add(new Separator());

        if (_DeleteAction.isEnabled()) {
            manager.add(_DeleteAction);
        }

        manager.add(new Separator());
        manager.add(_RefreshAction);
    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:22,代码来源:ZnodeModelChildrenFormPage.java

示例6: buildContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
public void buildContextMenu(IMenuManager menu) {
	GEFActionConstants.addStandardActionGroups(menu);

	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
	menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID));

	IAction saveAction = getAction(ActionFactory.SAVE.getId());
	saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE));

	menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction);
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager());
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID));
	menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID));

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:DbToolGefEditorContextMenuProvider.java

示例7: editorContextMenuAboutToShow

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
protected void editorContextMenuAboutToShow(final IMenuManager menu) {
	super.editorContextMenuAboutToShow(menu);

	final IContributionItem[] items = menu.getItems();
	for (int i = 0; i < items.length; i++) {
		if (items[i] instanceof IMenuManager) {
			final IMenuManager subMenu = (IMenuManager) items[i];
			final IContributionItem testShowIn = subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId());
			if (null != testShowIn) {
				menu.remove(subMenu);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSEditor.java

示例8: addGlobalActions

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:17,代码来源:MonitoringActionBarContributor.java

示例9: fillContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillContextMenu(final IMenuManager menu) {
	if (inViewPart && canEnableOpenAction()) {
		if (openGroup.getOpenAction().isEnabled()) {
			openGroup.fillContextMenu(menu);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:N4JSOpenActions.java

示例10: fillActionBars

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillActionBars(final IActionBars actionBars) {
	if (hasContributedToViewMenu) {
		return;
	}
	final IMenuManager topLevelSubMenu = new MenuManager("Top Level Elements");
	addActions(topLevelSubMenu);
	final IMenuManager menuManager = actionBars.getMenuManager();
	menuManager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu);
	hasContributedToViewMenu = true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:SelectTopLevelElementActionGroup.java

示例11: fillContextMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
private void fillContextMenu(IMenuManager manager) {
	manager.add(actionRelaunch);
	manager.add(actionRelaunchFailed);
	manager.add(actionStop);
	manager.add(new Separator());
	manager.add(actionLock);
	manager.add(new Separator());
	// Other plug-ins can contribute their actions here
	manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:TestResultsView.java

示例12: fillLocalPullDown

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
private void fillLocalPullDown(IMenuManager manager) {
	manager.add(actionRelaunch);
	manager.add(actionRelaunchFailed);
	manager.add(actionStop);
	manager.add(new Separator());
	manager.add(actionLock);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:TestResultsView.java

示例13: createMenu

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
private void createMenu() {
	IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
	mgr.setRemoveAllWhenShown(true);
	addDynamicVisualisationSelection(mgr);
	mgr.addMenuListener(new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager m) {
			addDynamicVisualisationSelection(m);
		}
	});
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:PerformanceView.java

示例14: fillActionBars

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
@Override
public void fillActionBars(final int flags) {
	delegate.fillActionBars(flags);

	// To remove 'Build Working Set' contribution item from the main menu.
	final IMenuManager menuManager = configurer.getMenuManager();
	final MenuManager projectManager = getMenuManager(PROJECT_MENU_PREDICATE, menuManager);
	if (null != projectManager) {
		final MenuManager workingSetManager = getMenuManager(WORKING_SET_MENU_PREDICATE, projectManager);
		projectManager.remove(workingSetManager);
		projectManager.update(true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4JSApplicationActionBarAdvisor.java

示例15: createDataModelTableViewer

import org.eclipse.jface.action.IMenuManager; //导入依赖的package包/类
/**
 * Create a new {@link TableViewer} with {@link DataModel} elements.
 * 
 * @param site The {@link IWorkbenchPartSite} used to register the table's context menu.
 * @param table The {@link Table}.
 * @param dataModelClass The {@link DataModel} element {@link Class}.
 * @param dataModelElementType The {@link DataModel} {@link IElementType}.
 * @param input The {@link TableViewer} input.
 * @param inputElementType The input {@link IElementType}.
 * @return A new {@link TableViewer}.
 */
public static TableViewer createDataModelTableViewer(IWorkbenchPartSite site, Table table, Class<?> dataModelClass,
        final IElementType dataModelElementType, Object input, IElementType inputElementType) {

    TableViewer tableViewer = createTableViewer(table, dataModelClass, dataModelElementType, input,
            inputElementType, new DataModelElementBinding());

    List<BaseAction> tableActions = dataModelElementType.getActions();
    if (tableActions != null) {
        for (BaseAction action : tableActions) {
            action.setSelectionProvider(tableViewer);
        }

        MenuManager menuManager = new MenuManager("#PopupMenu");
        menuManager.setRemoveAllWhenShown(true);
        menuManager.addMenuListener(new IMenuListener() {

            public void menuAboutToShow(IMenuManager manager) {
                dataModelElementType.fillContextMenu(manager);
            }

        });

        Menu menu = menuManager.createContextMenu(table);
        table.setMenu(menu);
        site.registerContextMenu(menuManager, tableViewer);
    }

    return tableViewer;
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:41,代码来源:ViewerFactory.java


注:本文中的org.eclipse.jface.action.IMenuManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。