Java Code Examples for org.eclipse.ui.IWorkbenchActionConstants#M_FILE

The following examples show how to use org.eclipse.ui.IWorkbenchActionConstants#M_FILE . 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 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 2
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 3
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 4
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 5
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
protected void fillMenuBar(IMenuManager menuBar) {
	MenuManager fileMenu = new MenuManager("&File",
			IWorkbenchActionConstants.M_FILE);
	menuBar.add(fileMenu);
	fileMenu.add(exitAction);
	
	MenuManager editMenu = new MenuManager("&Edit",
			IWorkbenchActionConstants.M_EDIT);
	menuBar.add(editMenu);
	editMenu.add(preferenceAction);
}
 
Example 6
Source File: ApplicationActionBarAdvisor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void fillMenuBar(IMenuManager menuBar) {
	MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
	menuBar.add(fileMenu);
	fileMenu.add(exitAction);

	MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
	menuBar.add(editMenu);
	editMenu.add(preferenceAction);
}
 
Example 7
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 8
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
protected void fillMenuBar(IMenuManager menuBar) {
	MenuManager fileMenu = new MenuManager("&File",
			IWorkbenchActionConstants.M_FILE);
	menuBar.add(fileMenu);
	fileMenu.add(exitAction);
	
	MenuManager editMenu = new MenuManager("&Edit",
			IWorkbenchActionConstants.M_EDIT);
	menuBar.add(editMenu);
	editMenu.add(preferenceAction);
}
 
Example 9
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) {
	MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
	menuBar.add(fileMenu);
	fileMenu.add(exitAction);

	MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
	menuBar.add(editMenu);
	editMenu.add(preferenceAction);
}
 
Example 10
Source File: DesignerActionBarAdvisor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and returns the File menu.
 */
private MenuManager createFileMenu( )
{
	MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_file,
			IWorkbenchActionConstants.M_FILE );
	
	MenuManager newMenu = new MenuManager(DesignerWorkbenchMessages.Workbench_new, ActionFactory.NEW.getId());
	newMenu.add(newReportAction);
	newMenu.add(newLibraryAction);
	newMenu.add(newReportTemplateAction);
	for (int i=0; i<newActions.length; i++)
	{
		newMenu.add(newActions[i]);
	}
	menu.add(newMenu);
	
	menu.add(openFileAction);
	menu.add( new Separator( ) );

	menu.add( closeAction );
	menu.add( closeAllAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.CLOSE_EXT ) );
	menu.add( new Separator( ) );
	menu.add( saveAction );
	menu.add( saveAsAction );
	menu.add( saveAllAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.SAVE_EXT ) );

	menu.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );

	menu.add( ContributionItemFactory.REOPEN_EDITORS.create( getWindow( ) ) );
	menu.add( new GroupMarker( IWorkbenchActionConstants.MRU ) );
	menu.add( new Separator( ) );
	menu.add( quitAction );
	menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) );
	return menu;
}
 
Example 11
Source File: ApplicationActionBarAdvisor.java    From neoscada with Eclipse Public License 1.0 4 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 );

    // Main

    menuBar.add ( fileMenu );
    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 ( getAction ( ActionFactory.INTRO.getId () ) );
    helpMenu.add ( this.showHelpAction ); // NEW
    helpMenu.add ( this.searchHelpAction ); // NEW
    helpMenu.add ( this.dynamicHelpAction ); // NEW
    helpMenu.add ( new GroupMarker ( IWorkbenchActionConstants.MB_ADDITIONS ) );
    helpMenu.add ( new Separator () );
    helpMenu.add ( this.aboutAction );
}
 
Example 12
Source File: GamaActionBarAdvisor.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns the File menu.
 */
private MenuManager createFileMenu() {
	final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
	{
		// create the New submenu, using the same id for it as the New action
		final String newText = IDEWorkbenchMessages.Workbench_new;
		final String newId = ActionFactory.NEW.getId();
		final MenuManager newMenu = new MenuManager(newText, newId);
		newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
		newMenu.setImageDescriptor(icons.desc("navigator/navigator.new2"));
		newMenu.add(new Separator(newId));
		this.newWizardMenu = new BaseNewWizardMenu(getWindow(), null) {

			@Override
			protected void addItems(final List list) {
				addShortcuts(list);
			}
		};
		newMenu.add(this.newWizardMenu);
		newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
		menu.add(newMenu);
	}

	menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
	menu.add(new Separator());

	menu.add(closeAction);
	menu.add(closeAllAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
	menu.add(new Separator());
	menu.add(saveAction);
	menu.add(saveAsAction);
	menu.add(saveAllAction);
	// menu.add(getRevertItem());
	menu.add(new Separator());
	menu.add(getMoveItem());
	menu.add(getRenameItem());
	menu.add(getRefreshItem());

	menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
	menu.add(new Separator());
	menu.add(getPrintItem());
	menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
	menu.add(new Separator());
	menu.add(openWorkspaceAction);
	menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
	menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
	menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

	menu.add(new Separator());
	menu.add(getPropertiesItem());

	menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
	menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
	menu.add(new Separator());

	// If we're on OS X we shouldn't show this command in the File menu. It
	// should be invisible to the user. However, we should not remove it -
	// the carbon UI code will do a search through our menu structure
	// looking for it when Cmd-Q is invoked (or Quit is chosen from the
	// application menu.
	final ActionContributionItem quitItem = new ActionContributionItem(quitAction);
	quitItem.setVisible(!Util.isMac());
	menu.add(quitItem);
	menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
	return menu;
}
 
Example 13
Source File: ApplicationActionBarAdvisor.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
protected void fillMenuBar(IMenuManager menuBar){
	
	fileMenu =
		new MenuManager(Messages.ApplicationActionBarAdvisor_3,
			IWorkbenchActionConstants.M_FILE);
	fileMenu.addMenuListener(reflectRightsListener);
	editMenu =
		new MenuManager(Messages.ApplicationActionBarAdvisor_4,
			IWorkbenchActionConstants.M_EDIT);
	editMenu.addMenuListener(reflectRightsListener);
	windowMenu =
		new MenuManager(Messages.ApplicationActionBarAdvisor_5,
			IWorkbenchActionConstants.M_WINDOW);
	helpMenu =
		new MenuManager(Messages.ApplicationActionBarAdvisor_6,
			IWorkbenchActionConstants.M_HELP);
	helpMenu.addMenuListener(reflectRightsListener);
	menuBar.add(fileMenu);
	menuBar.add(editMenu);
	menuBar.add(windowMenu);
	menuBar.add(helpMenu);
	
	fileMenu.add(GlobalActions.loginAction);
	fileMenu.add(GlobalActions.changeMandantAction);
	fileMenu.add(GlobalActions.connectWizardAction);
	fileMenu.add(GlobalActions.prefsAction);
	fileMenu.add(new Separator());
	fileMenu.add(GlobalActions.importAction);
	fileMenu.add(new GroupMarker(IMPORTER_GROUP));
	fileMenu.add(new Separator());
	// fileMenu.add(GlobalActions.updateAction);
	fileMenu.add(new GroupMarker(ADDITIONS));
	fileMenu.add(new Separator());
	fileMenu.add(GlobalActions.exitAction);
	
	editMenu.add(GlobalActions.copyAction);
	editMenu.add(GlobalActions.cutAction);
	editMenu.add(GlobalActions.pasteAction);

	
	GlobalActions.perspectiveMenu =
		new MenuManager(Messages.ApplicationActionBarAdvisor_7, "openPerspective"); //$NON-NLS-1$
	perspectiveMenu.add(resetPerspectiveAction);
	windowMenu.add(perspectiveMenu);
	
	GlobalActions.viewMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_9);
	GlobalActions.viewList = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
	GlobalActions.viewMenu.add(GlobalActions.viewList);
	windowMenu.add(GlobalActions.viewMenu);
	windowMenu.addMenuListener(new IMenuListener() {
		
		@Override
		public void menuAboutToShow(IMenuManager manager){
			IContributionItem[] items = manager.getItems();
			for (IContributionItem iContributionItem : items) {
				if( "viewsShortlist".equals(iContributionItem.getId())) {
					iContributionItem.setVisible(CoreHub.acl.request(AC_SHOWVIEW));
				}
			}
		}
	});
	
	/* helpMenu.add(testAction); */
	helpMenu.add(GlobalActions.helpAction);
	helpMenu.add(new Separator("additions"));
	helpMenu.add(new Separator());
	helpMenu.add(GlobalActions.aboutAction);
}