org.eclipse.ui.IWorkbenchActionConstants Java Examples

The following examples show how to use org.eclipse.ui.IWorkbenchActionConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 创建帮助菜单
 * @return 返回帮助菜单的 menu manager;
 */
private MenuManager createHelpMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
			IWorkbenchActionConstants.M_HELP);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
	menu.add(helpAction);
	// menu.add(helpSearchAction);
	// menu.add(dynamicHelpAction);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
	menu.add(new GroupMarker("help.keyAssist"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.updatePlugin"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.license"));
	// 关于菜单需要始终显示在最底端
	menu.add(new GroupMarker("group.about"));
	// ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
	// aboutItem.setVisible(!Util.isMac());
	// menu.add(aboutItem);
	return menu;
}
 
Example #2
Source File: GraphStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds the actions to the tableviewer context menu.
 *
 * @param actions
 *          a collection of IAction objets
 */
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
  MenuManager menuMgr = new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) {
        Object item = iter.next();
        if (item instanceof IContributionItem) {
          manager.add((IContributionItem) item);
        } else if (item instanceof IAction) {
          manager.add((IAction) item);
        }
      }
      manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
  });
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);

  getSite().registerContextMenu(menuMgr, viewer);
}
 
Example #3
Source File: MarkerStatsView.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds the actions to the tableviewer context menu.
 *
 * @param actions
 *          a collection of IAction objets
 */
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
  MenuManager menuMgr = new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) {
        Object item = iter.next();
        if (item instanceof IContributionItem) {
          manager.add((IContributionItem) item);
        } else if (item instanceof IAction) {
          manager.add((IAction) item);
        }
      }
      manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    }
  });
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);

  getSite().registerContextMenu(menuMgr, viewer);
}
 
Example #4
Source File: StylesNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	menu.add( new InsertAction( object,
			Messages.getString( "StylesNodeProvider.action.New" ) ) ); //$NON-NLS-1$
	super.createContextMenu( sourceViewer, object, menu );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			new Separator( ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			new ImportCSSStyleAction( object ) ); //$NON-NLS-1$
	
	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			new ReloadCssStyleAction( object ) );
	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,new UseCssStyleAction(object) );

}
 
Example #5
Source File: TabularMeasureGroupNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the given menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	// WizardUtil.createNewCubeMenu( menu );
	super.createContextMenu( sourceViewer, object, menu );

	if ( ( (MeasureGroupHandle) object ).canEdit( ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new EditCubeMeasureGroupAction( object,
						Messages.getString( "CubeMeasureGroupNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
	}

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}

}
 
Example #6
Source File: TabularCubeNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	if ( ( (CubeHandle) object ).canEdit( ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new EditCubeAction( object,
						Messages.getString( "CubeNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
	}

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example #7
Source File: DesignerActionBarAdvisor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
	 * Creates and returns the Help menu.
	 */
	private MenuManager createHelpMenu( )
	{
		MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_help,
				IWorkbenchActionConstants.M_HELP );

		// See if a welcome or introduction page is specified
		if ( introAction != null )
			menu.add( introAction );
//		else if ( quickStartAction != null )
//			menu.add( quickStartAction );
		menu.add( helpContentsAction );

//		if ( tipsAndTricksAction != null )
//			menu.add( tipsAndTricksAction );

		menu.add( new GroupMarker( "group.tutorials" ) ); //$NON-NLS-1$
		menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
		menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$
		menu.add( aboutAction );
		menu.add( new GroupMarker( "group.about.ext" ) ); //$NON-NLS-1$

		return menu;
	}
 
Example #8
Source File: AbstractTimeGraphView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Add contributions to the local tool bar manager. The contributions should be
 * appended to the {@link IWorkbenchActionConstants#MB_ADDITIONS} group.
 *
 * @param manager
 *            the tool bar manager
 */
protected void fillLocalToolBar(IToolBarManager manager) {
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getHideEmptyRowsAction());
    if (fFilterColumns != null && fFilterLabelProvider != null && fFilterColumns.length > 0) {
        manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowFilterDialogAction());
    }
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowLegendAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getResetScaleAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getToggleBookmarkAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousResourceAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextResourceAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomInAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomOutAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
}
 
Example #9
Source File: FlameChartView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 1.2
 */
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    if (manager == null) {
        return;
    }
    makeActions();
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getConfigureSymbolsAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getShowFilterDialogAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getResetScaleAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getPreviousEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getNextEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getToggleBookmarkAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getPreviousMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getNextMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomInAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomOutAction());
}
 
Example #10
Source File: CriticalPathView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    super.fillLocalToolBar(manager);
    if (manager == null) {
        return;
    }
    IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
    followArrowBwdAction.setText(Messages.CriticalPathView_followArrowBwdText);
    followArrowBwdAction.setToolTipText(Messages.CriticalPathView_followArrowBwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);

    IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
    followArrowFwdAction.setText(Messages.CriticalPathView_followArrowFwdText);
    followArrowFwdAction.setToolTipText(Messages.CriticalPathView_followArrowFwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);
}
 
Example #11
Source File: ScriptViewContextMenuProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void buildContextMenu( IMenuManager menu )
{
	menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
	TreeViewer treeViewer = (TreeViewer) getViewer( );

	IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection( );
	
	//temporary solution
	
	if ( selection.size( ) == 1 )
	{
		Object obj = selection.getFirstElement( );
		ScriptProviderFactory.createProvider( obj )
				.createContextMenu( treeViewer, obj, menu );
	}
	else
	{
		ScriptProviderFactory.getDefaultProvider( )
				.createContextMenu( treeViewer, selection, menu );
		
	}
}
 
Example #12
Source File: GamaActionBarAdvisor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates and returns the Edit menu.
 */
private MenuManager createEditMenu() {
	final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT);
	menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
	menu.add(undoAction);
	menu.add(redoAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
	menu.add(new Separator());
	menu.add(getCutItem());
	menu.add(getCopyItem());
	menu.add(getPasteItem());
	menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
	menu.add(new Separator());
	menu.add(getDeleteItem());
	menu.add(getSelectAllItem());
	menu.add(new Separator());
	menu.add(getFindItem());
	menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
	menu.add(new Separator());
	menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
	menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
	menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
	return menu;
}
 
Example #13
Source File: FindingsComposite.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void fillContextMenu(IMenuManager contextMenu, FindingsTemplate findingsTemplate){
	contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
	contextMenu.add(new Action("Entfernen") {
		
		@Override
		public ImageDescriptor getImageDescriptor(){
			return Images.IMG_DELETE.getImageDescriptor();
		}
		
		@Override
		public void run(){
			if (getModel().isPresent()) {
				
				EcoreUtil.delete(findingsTemplate);
				getViewer().refresh();
			}
		}
	});
}
 
Example #14
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 创建编辑菜单
 * @return 返回编辑菜单的 menu manager;
 */
private MenuManager createEditMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"),
			IWorkbenchActionConstants.M_EDIT); // &Edit
	menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
	menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
	menu.add(new Separator());
	menu.add(cutAction);
	menu.add(copyAction);
	menu.add(pasteAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
	menu.add(new Separator());
	menu.add(findAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
	menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
	menu.add(new Separator());
	menu.add(new GroupMarker("taskEdit"));
	return menu;
}
 
Example #15
Source File: RcpActionBarAdvisor.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void fillFileMenu(IMenuManager menuBar) {
	MenuManager menu = new MenuManager(
			M.File, IWorkbenchActionConstants.M_FILE);
	menu.add(saveAction);
	menu.add(saveAsAction);
	menu.add(saveAllAction);
	menu.add(new Separator());
	menu.add(closeAction);
	menu.add(closeAllAction);
	menu.add(new Separator());
	menu.add(preferencesAction);
	menu.add(new Separator());
	menu.add(new ImportAction());
	menu.add(new ExportAction());
	menu.add(new Separator());
	menu.add(exitAction);
	menuBar.add(menu);
}
 
Example #16
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 创建帮助菜单
 * @return 返回帮助菜单的 menu manager;
 */
private MenuManager createHelpMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
			IWorkbenchActionConstants.M_HELP);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
	menu.add(helpAction);
	// menu.add(helpSearchAction);
	// menu.add(dynamicHelpAction);
	// menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
	menu.add(new GroupMarker("help.keyAssist"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.updatePlugin"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.license"));
	// 关于菜单需要始终显示在最底端
	menu.add(new GroupMarker("group.about"));
	// ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
	// aboutItem.setVisible(!Util.isMac());
	// menu.add(aboutItem);
	return menu;
}
 
Example #17
Source File: TabularDimensionNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	if ( ( (DimensionHandle) object ).canEdit( ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new EditCubeDimensionAction( object,
						Messages.getString( "CubeDimensionNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
	}

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example #18
Source File: ParametersNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry for the given object and adds them to the menu
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	// Add new parameter action
	menu.add( new InsertAction( object,
			Messages.getString( "ParametersNodeProvider.menu.text.parameter" ), //$NON-NLS-1$
			ReportDesignConstants.SCALAR_PARAMETER_ELEMENT ) );

	// Add new parameter action
	menu.add( new InsertAction( object,
			Messages.getString( "ParametersNodeProvider.menu.text.cascadingParameter" ), //$NON-NLS-1$
			ReportDesignConstants.CASCADING_PARAMETER_GROUP_ELEMENT ) );

	// Add new parameter group action
	menu.add( new InsertAction( object,
			Messages.getString( "ParametersNodeProvider.menu.text.group" ), //$NON-NLS-1$
			ReportDesignConstants.PARAMETER_GROUP_ELEMENT ) );

	menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS
			+ "-parameters" ) ); //$NON-NLS-1$

	super.createContextMenu( sourceViewer, object, menu );
}
 
Example #19
Source File: PackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void setGlobalActionHandlers(IActionBars actionBars) {
	// Navigate Go Into and Go To actions.
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, fZoomInAction);
	actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), fBackAction);
	actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), fForwardAction);
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UP, fUpAction);
	actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_TO_RESOURCE, fGotoResourceAction);
	actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_TYPE, fGotoTypeAction);
	actionBars.setGlobalActionHandler(JdtActionConstants.GOTO_PACKAGE, fGotoPackageAction);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), fSelectAllAction);

	fRefactorActionGroup.retargetFileMenuActions(actionBars);

	IHandlerService handlerService= (IHandlerService) fPart.getViewSite().getService(IHandlerService.class);
	handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
	handlerService.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fCollapseAllAction));
}
 
Example #20
Source File: GamaActionBarAdvisor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates and returns the Help menu.
 */
private MenuManager createHelpMenu() {
	final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
	addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
	menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
	addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
	menu.add(helpContentsAction);
	addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
	menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
	menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
	addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
	addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
	addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
	menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
	addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
	// about should always be at the bottom
	menu.add(new Separator("group.about")); //$NON-NLS-1$

	final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
	aboutItem.setVisible(!Util.isMac());
	menu.add(aboutItem);
	menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
	menu.add(openPreferencesAction);
	return menu;
}
 
Example #21
Source File: LeveAttributelNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example #22
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 创建文件菜单
 * @return 返回文件菜单的 menu manager;
 */
private MenuManager createFileMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"),
			IWorkbenchActionConstants.M_FILE); // &File
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
	// 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端
	// menu.add(newAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
	menu.add(new Separator());
	menu.add(closeAction);
	menu.add(closeAllAction);
	menu.add(refreshAction);
	// menu.add(new Separator("net.heartsome.cat.ts.ui.menu.file.separator"));
	menu.add(new GroupMarker("xliff.switch"));
	menu.add(new GroupMarker("rtf.switch"));
	menu.add(new GroupMarker("xliff.split"));
	menu.add(new Separator());
	// 设置保存文件记录条数为 5 条
	WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5);
	// 添加文件访问列表
	ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$
		/* (non-javadoc) method declared on ContributionItemFactory */
		public IContributionItem create(IWorkbenchWindow window) {
			if (window == null) {
				throw new IllegalArgumentException();
			}
			return new ReopenEditorMenu(window, getId(), false);
		}
	};
	menu.add(REOPEN_EDITORS.create(window));

	menu.add(exitAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
	return menu;
}
 
Example #23
Source File: SarosView.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
protected void addToolBarItems(IToolBarManager toolBar) {
  toolBar.add(getAction(ChangeXMPPAccountAction.ACTION_ID));
  toolBar.add(getAction(NewContactAction.ACTION_ID));
  toolBar.add(getAction(OpenPreferencesAction.ACTION_ID));
  toolBar.add(new Separator());
  toolBar.add(getAction(FollowModeAction.ACTION_ID));
  toolBar.add(getAction(ConsistencyAction.ACTION_ID));
  toolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  toolBar.add(getAction(LeaveSessionAction.ACTION_ID));
}
 
Example #24
Source File: LogViewer.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(fileOpenAction);
    manager.add(preferencesAction);
    manager.add(fileClearAction);
    manager.add(new Separator());
    manager.add(refreshCurrentFileAction);
    manager.add(startTailOnCurrentFile);
    manager.add(stopTailOnCurrentFile);
    manager.add(fileCloseAction);
    manager.add(new Separator());
    manager.add(startTailOnAllFiles);
    manager.add(stopTailOnAllFiles);
    manager.add(closeAllFilesAction);
    manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example #25
Source File: AnnotationEditor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected void editorContextMenuAboutToShow(IMenuManager menu) {
  super.editorContextMenuAboutToShow(menu);

  // Add Annotate action
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(SmartAnnotateAction.ID));
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(QuickAnnotateAction.ID));
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getAction(IWorkbenchActionDefinitionIds.DELETE));
  
  TypeSystem typeSystem = getDocument().getCAS().getTypeSystem();

  // mode menu
  MenuManager modeMenuManager = new MenuManager("Mode");
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, modeMenuManager);

  ModeMenu modeMenu = new ModeMenu(typeSystem, this);
  modeMenu.addListener(new IModeMenuListener(){

  @Override
  public void modeChanged(Type newMode) {
    IAction actionToExecute = new ChangeModeAction(newMode, newMode.getShortName(),
            AnnotationEditor.this);

    actionToExecute.run();
  }});

  modeMenuManager.add(modeMenu);

  // annotation menu
  MenuManager showAnnotationMenu = new MenuManager("Show Annotations");
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, showAnnotationMenu);
  showAnnotationMenu.add(mShowAnnotationsMenu);
  
  // view menu
  MenuManager casViewMenuManager = new MenuManager("CAS Views");
  menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, casViewMenuManager);
  CasViewMenu casViewMenu = new CasViewMenu(this);
  casViewMenuManager.add(casViewMenu);
}
 
Example #26
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 创建帮助菜单
 * @return 返回帮助菜单的 menu manager;
 */
private MenuManager createHelpMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"),
			IWorkbenchActionConstants.M_HELP);
	menu.add(helpAction);
	menu.add(new GroupMarker("help.keyAssist"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.updatePlugin"));
	menu.add(new Separator());
	menu.add(new GroupMarker("help.license"));
	// 关于菜单需要始终显示在最底端
	menu.add(new GroupMarker("group.about"));
	return menu;
}
 
Example #27
Source File: CounterView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Add a tool bar button to display counters data cumulatively
    IActionBars bars = getViewSite().getActionBars();
    bars.getToolBarManager().appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getCumulativeAction());
}
 
Example #28
Source File: WizardUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Typically called from the Data View Node to create Data Source Edit menu
 * item
 * 
 */
public static void createEditDataSourceMenu( IMenuManager menu,
		Object selectedObject )
{
	EditDataSourceAction dataSourceAction = new EditDataSourceAction( selectedObject );
	dataSourceAction.setText( Messages.getString( "datasource.action.edit" ) );//$NON-NLS-1$
	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			dataSourceAction );
}
 
Example #29
Source File: ApplicationActionBarAdvisor.java    From jbt with Apache License 2.0 5 votes vote down vote up
protected void fillCoolBar(ICoolBarManager coolBar) {
	IToolBarManager firstCoolBar = new ToolBarManager(coolBar.getStyle());
	coolBar.add(firstCoolBar);
	firstCoolBar.add(this.newBTAction);
	firstCoolBar.add(this.saveBTAction);
	firstCoolBar.add(this.saveBTAsAction);
	firstCoolBar.add(this.exportAsCppAction);
	firstCoolBar.add(this.openBTAction);
	firstCoolBar.add(this.loadMMPMDomainAction);
	coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
 
Example #30
Source File: DecoratedScriptEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void editorContextMenuAboutToShow( IMenuManager menu )
{
	menu.add( new Separator( ITextEditorActionConstants.GROUP_UNDO ) );
	menu.add( new Separator( ITextEditorActionConstants.GROUP_COPY ) );
	menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );

	if ( isEditable( ) )
	{
		addAction( menu,
				ITextEditorActionConstants.GROUP_UNDO,
				ITextEditorActionConstants.UNDO );

		addAction( menu,
				ITextEditorActionConstants.GROUP_COPY,
				ITextEditorActionConstants.CUT );

		addAction( menu,
				ITextEditorActionConstants.GROUP_COPY,
				ITextEditorActionConstants.COPY );

		addAction( menu,
				ITextEditorActionConstants.GROUP_COPY,
				ITextEditorActionConstants.PASTE );
	}
	else
	{
		addAction( menu,
				ITextEditorActionConstants.GROUP_COPY,
				ITextEditorActionConstants.COPY );
	}
}