本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
});
}
示例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);
}
}
示例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;
}