本文整理匯總了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;
}