org.eclipse.jface.action.GroupMarker Java Examples

The following examples show how to use org.eclipse.jface.action.GroupMarker. 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: 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 #2
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 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(undoAction);
	// menu.add(redoAction);
	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(deleteAction);
	menu.add(renameAction);
	menu.add(new Separator());
	menu.add(findAction);
	menu.add(selectAllAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
	// menu.add(new Separator());
	// menu.add(preferenceAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
	return menu;
}
 
Example #3
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 #4
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 6 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(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
	menu.add(new Separator());
	menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
	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);
	menu.add(new GroupMarker(IWorkbenchActionConstants.HISTORY_GROUP));
	menu.add(exitAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
	return menu;
}
 
Example #5
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 #6
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 #7
Source File: JavaPlugin.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the Java plug-in's standard groups for view context menus.
 *
 * @param menu the menu manager to be populated
 */
public static void createStandardGroups(IMenuManager menu) {
	if (!menu.isEmpty())
		return;

	menu.add(new Separator(IContextMenuConstants.GROUP_NEW));
	menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO));
	menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
	menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW));
	menu.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
	menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE));
	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH));
	menu.add(new Separator(IContextMenuConstants.GROUP_BUILD));
	menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
	menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP));
	menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES));
}
 
Example #8
Source File: CustomFiltersActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Fills the given view menu with the entries managed by the
 * group.
 *
 * @param viewMenu the menu to fill
 */
public void fillViewMenu(IMenuManager viewMenu) {
	/*
	 * Don't change the separator group name.
	 * Using this name ensures that other filters
	 * get contributed to the same group.
	 */
	viewMenu.add(new Separator("filters")); //$NON-NLS-1$
	viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME));
	viewMenu.add(new ShowFilterDialogAction());

	fMenuManager= viewMenu;
	fMenuListener= new IMenuListener() {
		public void menuAboutToShow(IMenuManager manager) {
			removePreviousLRUFilterActions(manager);
			addLRUFilterActions(manager);
		}
	};
	fMenuManager.addMenuListener(fMenuListener);
}
 
Example #9
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 创建工具菜单
 * @return 返回工具菜单的 menu manager;
 */
private MenuManager createToolMenu() {
	MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.tool"),
			"net.heartsome.cat.ts.ui.menu.tool") {
		@Override
		public boolean isVisible() {
			IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
			if (workbenchWindow == null)
				return false;
			IWorkbenchPage activePage = workbenchWindow.getActivePage();
			if (activePage == null)
				return false;
			if (activePage.getPerspective().getId().contains("net.heartsome.cat.ts.perspective"))
				return true;
			return false;
		}
	}; // &Tool
	menu.add(new GroupMarker("pluginConfigure"));
	menu.add(new GroupMarker("preference.groupMarker"));
	// menu.add(preferenceAction);
	return menu;
}
 
Example #10
Source File: ERVirtualDiagramPopupMenuManager.java    From erflute with Apache License 2.0 6 votes vote down vote up
protected MenuManager prepareExportMenu(ISharedImages sharedImages) {
    final MenuManager exportMenu =
            new MenuManager(DisplayMessages.getMessage("action.title.export"), sharedImages.getImageDescriptor("IMG_ETOOL_EXPORT_WIZ"),
                    "Export");

    exportMenu.add(getAction(ExportToDDLAction.ID));
    exportMenu.add(getAction(ExportToImageAction.ID));

    // #deleted
    //exportMenu.add(this.getAction(ExportToExcelAction.ID));
    //exportMenu.add(this.getAction(ExportToHtmlAction.ID));
    //exportMenu.add(this.getAction(ExportToDictionaryAction.ID));
    //exportMenu.add(this.getAction(ExportToTranslationDictionaryAction.ID));
    //exportMenu.add(this.getAction(ExportToTestDataAction.ID));
    //exportMenu.add(this.getAction(ExportToJavaAction.ID));

    exportMenu.add(new GroupMarker("export"));

    return exportMenu;
}
 
Example #11
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(undoAction);
	// menu.add(redoAction);
	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));
	return 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 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 #13
Source File: ChartExamplesView.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void createPartControl( Composite parent )
{
	ChartUIUtil.bindHelp( parent,
			ChartHelpContextIds.VIEW_CHART_EXAMPLE );
	
	instance = new ChartExamples( parent );

	final IActionBars actionBars = getViewSite( ).getActionBars( );
	IToolBarManager toolbarManager = actionBars.getToolBarManager( );
	Tools tools[] = ChartExamples.tools;
	String group = tools[0].group;
	toolbarManager.add( new GroupMarker( group ) );
	for ( int i = 0; i < tools.length; i++ )
	{
		Tools tool = tools[i];
		if ( !tool.group.equals( group ) )
		{
			toolbarManager.add( new Separator( ) );
			toolbarManager.add( new GroupMarker( tool.group ) );
		}
		group = tool.group;
		toolbarManager.appendToGroup( group, initActions( tool, parent ) );
	}
	actionBars.updateActionBars( );
}
 
Example #14
Source File: EditTemplateDialog.java    From typescript.java with MIT License 6 votes vote down vote up
private void fillContextMenu(IMenuManager menu) {
	menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO));

	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.CUT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.COPY));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));

	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
 
Example #15
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 #16
Source File: ViewMenus.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void fillContextMenu(IMenuManager manager, List<IContributionItem> contributionItems){
	manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
	for (IContributionItem contributionItem : contributionItems) {
		if (contributionItem == null) {
			manager.add(new Separator());
			continue;
		} else if (contributionItem instanceof ActionContributionItem) {
			ActionContributionItem ac = (ActionContributionItem) contributionItem;
			if (ac.getAction() instanceof RestrictedAction) {
				((RestrictedAction) ac.getAction()).reflectRight();
			}
		}
		contributionItem.update();
		manager.add(contributionItem);
	}
}
 
Example #17
Source File: PopupDialog.java    From SWET with MIT License 6 votes vote down vote up
/**
 * Fill the dialog's menu. Subclasses may extend or override.
 * 
 * @param dialogMenu
 *            The dialog's menu.
 */
protected void fillDialogMenu(IMenuManager dialogMenu) {
	dialogMenu.add(new GroupMarker("SystemMenuStart")); //$NON-NLS-1$
	// RAP [bm]: Tracker
	// dialogMenu.add(new MoveAction());
	// dialogMenu.add(new ResizeAction());
	if (showPersistActions) {
		if (isUsing34API) {
			dialogMenu.add(new PersistLocationAction());
			dialogMenu.add(new PersistSizeAction());
		} else {
			dialogMenu.add(new PersistBoundsAction());
		}
	}
	dialogMenu.add(new Separator("SystemMenuEnd")); //$NON-NLS-1$
}
 
Example #18
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 #19
Source File: TypeScriptEditor.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public void editorContextMenuAboutToShow(IMenuManager menu) {

	super.editorContextMenuAboutToShow(menu);
	menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));

	ActionContext context = new ActionContext(getSelectionProvider().getSelection());
	fContextMenuGroup.setContext(context);
	fContextMenuGroup.fillContextMenu(menu);
	fContextMenuGroup.setContext(null);

	// Quick views
	IAction action = getAction(ITypeScriptEditorActionDefinitionIds.SHOW_OUTLINE);
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
	action = getAction(ITypeScriptEditorActionDefinitionIds.OPEN_IMPLEMENTATION);
	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);

}
 
Example #20
Source File: BaseDataProviderTimeGraphView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createTimeEventContextMenu() {
    MenuManager eventMenuManager = new MenuManager();
    eventMenuManager.setRemoveAllWhenShown(true);
    TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
    final Menu timeEventMenu = eventMenuManager.createContextMenu(timeGraphControl);

    timeGraphControl.addTimeEventMenuListener(event -> {
        Menu menu = timeEventMenu;
        if (event.data instanceof TimeEvent) {
            timeGraphControl.setMenu(menu);
            return;
        }
        timeGraphControl.setMenu(null);
        event.doit = false;
    });

    eventMenuManager.addMenuListener(manager -> {
        fillTimeEventContextMenu(eventMenuManager);
        eventMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    });
    getSite().registerContextMenu(eventMenuManager, getTimeGraphViewer().getSelectionProvider());
}
 
Example #21
Source File: AbstractTimeGraphView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createContextMenu() {
    fEntryMenuManager.setRemoveAllWhenShown(true);
    TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
    final Menu entryMenu = fEntryMenuManager.createContextMenu(timeGraphControl);
    timeGraphControl.addTimeGraphEntryMenuListener(event -> {
        Point p = timeGraphControl.toControl(event.x, event.y);
        /*
         * The TimeGraphControl will call the TimeGraphEntryMenuListener before the
         * TimeEventMenuListener. If the event is triggered on the name space then show
         * the menu else clear the menu.
         */
        if (p.x < getTimeGraphViewer().getNameSpace()) {
            timeGraphControl.setMenu(entryMenu);
        } else {
            timeGraphControl.setMenu(null);
            event.doit = false;
        }
    });
    fEntryMenuManager.addMenuListener(manager -> {
        fillTimeGraphEntryContextMenu(fEntryMenuManager);
        fEntryMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    });
    getSite().registerContextMenu(fEntryMenuManager, fTimeGraphViewer.getSelectionProvider());
}
 
Example #22
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 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(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
	menu.add(new Separator());
	menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
	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: DesignerActionBarAdvisor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Fills the menu bar with the workbench actions.
 */
protected void fillMenuBar( IMenuManager menuBar )
{
	menuBar.add( createFileMenu( ) );
	menuBar.add( createEditMenu( ) );
	menuBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
	menuBar.add( createWindowMenu( ) );
	menuBar.add( createHelpMenu( ) );
}
 
Example #24
Source File: DesignerActionBarAdvisor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and returns the Edit menu.
 */
private MenuManager createEditMenu( )
{
	MenuManager menu = new MenuManager( DesignerWorkbenchMessages.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( cutAction );
	menu.add( copyAction );
	menu.add( pasteAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.CUT_EXT ) );
	menu.add( new Separator( ) );

	menu.add( deleteAction );
	menu.add( selectAllAction );
	menu.add( new Separator( ) );

	menu.add( findAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.FIND_EXT ) );
	menu.add( new Separator( ) );

	menu.add( new GroupMarker( IWorkbenchActionConstants.EDIT_END ) );
	menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
	return menu;
}
 
Example #25
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void fillMenuBar(IMenuManager menuBar) {
	menuBar.add(createFileMenu());
	menuBar.add(createEditMenu());
	menuBar.add(new GroupMarker("view"));
	menuBar.add(new GroupMarker("translation"));
	menuBar.add(new GroupMarker("project"));
	menuBar.add(new GroupMarker("database"));
	menuBar.add(new GroupMarker("qa"));
	menuBar.add(createToolMenu());
	menuBar.add(new GroupMarker("advance"));
	menuBar.add(createHelpMenu());
}
 
Example #26
Source File: StandardEditorSystemMenu.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the standard view menu
 * 
 * @param site the site to associate the view with
 */
public StandardEditorSystemMenu(IStackPresentationSite site) {
    restore = new SystemMenuRestore(site);
    move = new SystemMenuMove(site, getMoveMenuText(), false);
    minimize = new SystemMenuMinimize(site);
    maximize = new SystemMenuMaximize(site);
    close = new SystemMenuClose(site);
    closeOthers = new SystemMenuCloseOthers(site);
    closeAll = new SystemMenuCloseAll(site);
    
    { // Initialize system menu
        menuManager.add(new GroupMarker("misc")); //$NON-NLS-1$
        menuManager.add(new GroupMarker("restore")); //$NON-NLS-1$
        menuManager.add(new UpdatingActionContributionItem(restore));

        menuManager.add(move);
        menuManager.add(new GroupMarker("size")); //$NON-NLS-1$
        menuManager.add(new GroupMarker("state")); //$NON-NLS-1$
        menuManager.add(new UpdatingActionContributionItem(minimize));

        menuManager.add(new UpdatingActionContributionItem(maximize));
        menuManager.add(new Separator("close")); //$NON-NLS-1$
        menuManager.add(close);
        menuManager.add(closeOthers);
        menuManager.add(closeAll);

        site.addSystemActions(menuManager);
    } // End of system menu initialization

}
 
Example #27
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 #28
Source File: ApplicationActionBarAdvisor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void fillMenuBar ( final IMenuManager menuBar )
{
    final MenuManager fileMenu = new MenuManager ( "&File", IWorkbenchActionConstants.M_FILE );
    final MenuManager windowMenu = new MenuManager ( "&Window", IWorkbenchActionConstants.M_WINDOW );
    final MenuManager helpMenu = new MenuManager ( "&Help", IWorkbenchActionConstants.M_HELP );
    final MenuManager fileNewMenu = new MenuManager ( "&New", IWorkbenchActionConstants.NEW_EXT );
    final MenuManager windowNewMenu = new MenuManager ( "Show &View", IWorkbenchActionConstants.SHOW_EXT );

    menuBar.add ( fileMenu );
    // Add a group marker indicating where action set menus will appear.
    menuBar.add ( new GroupMarker ( IWorkbenchActionConstants.MB_ADDITIONS ) );
    menuBar.add ( windowMenu );
    menuBar.add ( helpMenu );

    // File
    fileMenu.add ( this.newWindowAction );
    fileMenu.add ( new Separator () );
    fileMenu.add ( fileNewMenu );
    fileMenu.add ( getAction ( ActionFactory.SAVE.getId () ) );
    fileMenu.add ( getAction ( ActionFactory.NEW_EDITOR.getId () ) );
    fileMenu.add ( new GroupMarker ( IWorkbenchActionConstants.OPEN_EXT ) );

    fileMenu.add ( new Separator () );
    fileMenu.add ( this.exitAction );

    fileNewMenu.add ( this.newWizards );

    // Window
    windowNewMenu.add ( this.showViews );
    windowMenu.add ( windowNewMenu );
    windowMenu.add ( getAction ( ActionFactory.PREFERENCES.getId () ) );

    // Help
    helpMenu.add ( this.aboutAction );
    helpMenu.add ( getAction ( ActionFactory.INTRO.getId () ) );
}
 
Example #29
Source File: ListDisplay.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
protected void fillContextMenu(IMenuManager manager, IAction... actions){
	manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
	for (IAction ac : actions) {
		if (ac == null) {
			manager.add(new Separator());
		} else {
			if (ac instanceof RestrictedAction) {
				((RestrictedAction) ac).reflectRight();
			}
			manager.add(ac);
		}
	}
}
 
Example #30
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void fillMenuBar(IMenuManager menuBar) {
	menuBar.add(createFileMenu());
	menuBar.add(createEditMenu());
	menuBar.add(new GroupMarker("view"));
	menuBar.add(new GroupMarker("translation"));
	menuBar.add(new GroupMarker("project"));
	menuBar.add(new GroupMarker("database"));
	menuBar.add(new GroupMarker("qa"));
	menuBar.add(new GroupMarker("advance"));
	menuBar.add(createHelpMenu());
}