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


Java IMenuService类代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:17,代码来源:ProjectExplorerMenuFactory.java

示例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) {
			}
		});
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例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) {
			}
		});
	}
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例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);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:24,代码来源:DefaultNavigatorActionProvider.java

示例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();
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:23,代码来源:ApplicationActionBarAdvisor.java

示例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());
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:9,代码来源:SchemaPopupMenuConfigurationImpl.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:9,代码来源:OpenDropDownMenuHandler.java

示例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;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:16,代码来源:CloudFoundryActionContributionFactory.java

示例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);
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:45,代码来源:VPMRefinementBrowser.java

示例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( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:38,代码来源:DesignerActionBarContributor.java

示例11: getMenuService

import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
@Override
public IMenuService getMenuService() {
	return (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:5,代码来源:AvroSchemaEditorServiceProvider.java

示例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);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:5,代码来源:SchemaRegistryView.java

示例13: populateToolBar

import org.eclipse.ui.menus.IMenuService; //导入依赖的package包/类
protected void populateToolBar(ToolBarManager manager, String toolBarId) {
	IMenuService service = serviceProvider.getMenuService();
       service.populateContributionManager(manager, toolBarId);
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:5,代码来源:SchemaToolBarConfigurationImpl.java

示例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));

}
 
开发者ID:debrief,项目名称:limpet,代码行数:50,代码来源:ApplicationActionBarAdvisor.java

示例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();
}
 
开发者ID:debrief,项目名称:limpet,代码行数:52,代码来源:ApplicationActionBarAdvisor.java


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