本文整理汇总了Java中org.eclipse.ui.menus.IMenuService类的典型用法代码示例。如果您正苦于以下问题:Java IMenuService类的具体用法?Java IMenuService怎么用?Java IMenuService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMenuService类属于org.eclipse.ui.menus包,在下文中一共展示了IMenuService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActions
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
protected List<IAction> getActions(IMenuService menuService) {
Object context = menuService.getCurrentState();
IProject project = getProjectFromContext(context);
List<IAction> actions = new ArrayList<IAction>();
if (project != null) {
StandaloneFacetHandler handler = new StandaloneFacetHandler(project);
if (handler.canAddFacet()) {
actions.add(new ConvertToStandaloneAction(project));
} else if (handler.hasFacet()) {
actions.add(new RemoveStandaloneAction(project));
}
}
return actions;
}
示例2: createContributionItems
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
if (menuService == null) {
CloudFoundryPlugin
.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
return;
}
List<IAction> debugActions = getActions(menuService);
for (IAction action : debugActions) {
additions.addContributionItem(new ActionContributionItem(action), new Expression() {
public EvaluationResult evaluate(IEvaluationContext context) {
return EvaluationResult.TRUE;
}
public void collectExpressionInfo(ExpressionInfo info) {
}
});
}
}
示例3: createContributionItems
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
if (menuService == null) {
DockerFoundryPlugin
.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
return;
}
List<IAction> debugActions = getActions(menuService);
for (IAction action : debugActions) {
additions.addContributionItem(new ActionContributionItem(action), new Expression() {
public EvaluationResult evaluate(IEvaluationContext context) {
return EvaluationResult.TRUE;
}
public void collectExpressionInfo(ExpressionInfo info) {
}
});
}
}
示例4: run
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
/**
* The default behavior is to show the same content as clicking the dropdown arrow. Subclass could override.
*
* @param parent
* the parent toolbar
*/
protected void run(ToolBar parent)
{
if (!isEnabled())
{
return;
}
Point toolbarLocation = parent.getLocation();
toolbarLocation = parent.getParent().toDisplay(toolbarLocation.x, toolbarLocation.y);
Point toolbarSize = parent.getSize();
MenuManager menuManager = new MenuManager(null, getMenuId());
IMenuService menuService = (IMenuService) partSite.getService(IMenuService.class);
menuService.populateContributionManager(menuManager, MenuUtil.menuUri(menuManager.getId()));
fillMenu(menuManager);
Menu menu = menuManager.createContextMenu(parent);
menu.setLocation(toolbarLocation.x, toolbarLocation.y + toolbarSize.y + 2);
menu.setVisible(true);
}
示例5: dispose
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
/**
* 创建自定义的插件菜单 2012-03-07
* @return ;
*/
/*
* private MenuManager createAutoPluginMenu() { MenuManager menu = new MenuManager("asdfasd",
* "net.heartsome.cat.ts.ui.menu.plugin"); // menu = MenuManag
*
* // menu.appendToGroup(groupName, item) menu.add(helpSearchAction); return menu; }
*/
@Override
public void dispose() {
if (isDisposed) {
return;
}
isDisposed = true;
IMenuService menuService = (IMenuService) window.getService(IMenuService.class);
menuService.releaseContributions(coolbarPopupMenuManager);
coolbarPopupMenuManager.dispose();
super.dispose();
}
示例6: fillPopupMenu
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public void fillPopupMenu(IMenuManager manager, SchemaViewer viewer) {
for (String section : ORDERED_SECTIONS) {
manager.add(new Separator(section));
}
IMenuService service = serviceProvider.getMenuService();
service.populateContributionManager((ContributionManager) manager, getPopupMenuId());
}
示例7: execute
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ToolItem toolItem = findToolItem(event);
String menuId = getMenuId(toolItem);
IMenuService menuService = ServiceUtils.getService(event, IMenuService.class);
openDropDownMenu(menuId, toolItem, menuService);
return null;
}
示例8: getActions
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
protected List<IAction> getActions(IMenuService menuService) {
// Return all context menu actions that are applicable to the given
// context
Object context = menuService.getCurrentState();
List<IAction> actions = new ArrayList<IAction>();
for (MenuActionHandler<?> actionHandler : ACTION_HANDLERS) {
List<IAction> handlerActions = actionHandler.getActions(context);
if (handlerActions != null && !handlerActions.isEmpty()) {
actions.addAll(handlerActions);
}
}
return actions;
}
示例9: createPartControl
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
/**
* This is a callback that will allow us to create the viewer and initialize it.
*
* @param parent
* The parent ui element to create this editor in.
*/
public void createPartControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createForm(parent);
form.setText("SPLevo Refinement Browser");
toolkit.decorateFormHeading(form);
form.getMenuManager().add(new ApplyRefinementsAction(this, "Apply Refinements"));
form.getMenuManager().add(new ApplySelectedRefinementsAction(this, "Apply Selected Refinements"));
form.getBody().setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashForm = new SashForm(form.getBody(), SWT.FILL);
sashForm.setSashWidth(1);
sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
toolkit.adapt(sashForm);
toolkit.paintBordersFor(sashForm);
createRefinementListView(sashForm);
createRefinementDetails(sashForm);
// The listener must be added after the two connected required widgets have been created
refinementListView.addSelectionChangedListener(new RefinementSelectionListener(detailsView));
refinementListView.addSelectionChangedListener(new RefinementInfoSelectionListener(detailsView));
IActionBars actionBars = getEditorSite().getActionBars();
refinementListView.addSelectionChangedListener(new RefinementActionBarListener(actionBars));
sashForm.setWeights(new int[] { 2, 8 });
ToolBarManager manager = (ToolBarManager) form.getToolBarManager();
manager.add(new ApplyRefinementsAction(this, "Apply Refinements"));
manager.add(new ApplySelectedRefinementsAction(this, "Apply Selected Refinements"));
manager.add(new ToggleVisualizationAction(this, getEnableVisualizationDefault()));
manager.add(new CancelAction(this, "Cancel and close"));
IMenuService menuService = (IMenuService) getSite().getService(IMenuService.class);
menuService.populateContributionManager(manager, "popup:formsToolBar");
manager.update(true);
initContextMenu();
initToolTips(refinementListView);
}
示例10: contributeToMenu
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
public void contributeToMenu( IMenuManager menubar )
{
super.contributeToMenu( menubar );
updateEditMenu( menubar );
// Insert Menu
MenuManager insertMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.insert" ), M_INSERT ); //$NON-NLS-1$
createInsertMenu( insertMenu );
insertMenu.addMenuListener( new IMenuListener( ) {
public void menuAboutToShow( IMenuManager manager )
{
manager.removeAll( );
insertElementActions = null;
createInsertMenu( manager );
}
} );
// insertMenu.add( getAction( ImportLibraryAction.ID ) );
menubar.insertAfter( IWorkbenchActionConstants.M_EDIT, insertMenu );
// Element Menu
MenuManager elementMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.element" ), M_ELEMENT ); //$NON-NLS-1$
contributeElementMenu( elementMenu );
menubar.insertAfter( M_INSERT, elementMenu );
// Data Menu
MenuManager dataMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.data" ), M_DATA ); //$NON-NLS-1$
// the data actions are now registered through eclipse menu extensions
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench( )
.getService( IMenuService.class );
menuService.populateContributionManager( dataMenu, "menu:birtData" ); //$NON-NLS-1$
menubar.insertAfter( M_ELEMENT, dataMenu );
menubar.update( );
}
示例11: getMenuService
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public IMenuService getMenuService() {
return (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
}
示例12: fillPopupMenu
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
protected void fillPopupMenu(IMenuManager manager) {
IMenuService service = (IMenuService) editor.getServiceProvider().getMenuService();
service.populateContributionManager((ContributionManager) manager, POPUP_MENU_ID);
}
示例13: populateToolBar
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
protected void populateToolBar(ToolBarManager manager, String toolBarId) {
IMenuService service = serviceProvider.getMenuService();
service.populateContributionManager(manager, toolBarId);
}
示例14: fillCoolBar
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
/**
* Fills the coolbar with the workbench actions.
*/
protected void fillCoolBar(ICoolBarManager coolBar)
{
IActionBarConfigurer2 actionBarConfigurer =
(IActionBarConfigurer2) getActionBarConfigurer();
// Set up the context Menu
coolbarPopupMenuManager = new MenuManager();
coolBar.setContextMenuManager(coolbarPopupMenuManager);
IMenuService menuService =
(IMenuService) window.getService(IMenuService.class);
menuService.populateContributionManager(coolbarPopupMenuManager,
"popup:windowCoolbarContextMenu"); //$NON-NLS-1$
// File Group
IToolBarManager fileToolBar = actionBarConfigurer.createToolBarManager();
fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
fileToolBar.add(saveAction);
fileToolBar.add(saveAllAction);
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
fileToolBar.add(getPrintItem());
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// Add to the cool bar manager
coolBar.add(actionBarConfigurer.createToolBarContributionItem(fileToolBar,
IWorkbenchActionConstants.TOOLBAR_FILE));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));
// Help group
IToolBarManager helpToolBar = actionBarConfigurer.createToolBarManager();
helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
// helpToolBar.add(searchComboItem);
// Add the group for applications to contribute
helpToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
// Add to the cool bar manager
coolBar.add(actionBarConfigurer.createToolBarContributionItem(helpToolBar,
IWorkbenchActionConstants.TOOLBAR_HELP));
}
示例15: dispose
import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
/**
* Disposes any resources and unhooks any listeners that are no longer needed. Called when the
* window is closed.
*/
public void dispose()
{
if (isDisposed)
{
return;
}
isDisposed = true;
IMenuService menuService =
(IMenuService) window.getService(IMenuService.class);
menuService.releaseContributions(coolbarPopupMenuManager);
coolbarPopupMenuManager.dispose();
getActionBarConfigurer().getStatusLineManager().remove(statusLineItem);
showInQuickMenu.dispose();
newQuickMenu.dispose();
// null out actions to make leak debugging easier
closeAction = null;
closeAllAction = null;
closeAllSavedAction = null;
closeOthersAction = null;
saveAction = null;
saveAllAction = null;
newWindowAction = null;
newEditorAction = null;
helpContentsAction = null;
helpSearchAction = null;
dynamicHelpAction = null;
aboutAction = null;
saveAsAction = null;
closePerspAction = null;
closeAllPerspsAction = null;
showViewMenuAction = null;
undoAction = null;
redoAction = null;
quitAction = null;
openWorkspaceAction = null;
projectPropertyDialogAction = null;
newWizardAction = null;
quickStartAction = null;
tipsAndTricksAction = null;
showInQuickMenu = null;
newQuickMenu = null;
statusLineItem = null;
introAction = null;
super.dispose();
}