當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。