Search in sources :

Example 11 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project knime-core by knime.

the class KNIMEApplicationActionBarAdvisor method fillMenuBar.

/**
 * Fills the menu bar with the main menus for the windows. Some anchors were
 * added below the last action of each division for convenience.
 * These anchors are named after the action above them, e.g.:
 * "file/ImportPreferences" is located below "Import Preferences..."
 * but above the separator.
 *
 * {@inheritDoc}
 */
@Override
protected void fillMenuBar(final IMenuManager menuBar) {
    menuBar.remove(IWorkbenchActionConstants.MB_ADDITIONS);
    final MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
    MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    MenuManager viewMenu = new MenuManager("&View", IWorkbenchActionConstants.M_VIEW);
    MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
    // 1. File menu
    menuBar.add(fileMenu);
    // 2. Edit menu
    menuBar.add(editMenu);
    // 3. View menu
    menuBar.add(viewMenu);
    // Add a group marker indicating where action set menus will appear.
    GroupMarker marker = new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS);
    marker.setVisible(false);
    menuBar.add(marker);
    // last: Help menu
    menuBar.add(helpMenu);
    // File menu
    fileMenu.add(m_newAction);
    fileMenu.add(m_saveAction);
    fileMenu.add(m_saveAsAction);
    fileMenu.add(m_saveAllAction);
    fileMenu.add(m_closeAllAction);
    fileMenu.add(m_print);
    fileMenu.add(m_importWorkflowAction);
    fileMenu.add(m_exportWorkflowAction);
    fileMenu.add(new GroupMarker("ExportWorkflow"));
    fileMenu.add(new Separator());
    fileMenu.add(m_changeWorkspaceAction);
    fileMenu.add(new GroupMarker("SwitchWorkspace"));
    fileMenu.add(new Separator());
    fileMenu.add(m_preferencesAction);
    fileMenu.add(m_exportPrefAction);
    fileMenu.add(m_importPrefAction);
    fileMenu.add(new GroupMarker("ImportPreferences"));
    fileMenu.add(new Separator());
    fileMenu.add(m_installFeaturesAction);
    fileMenu.add(m_updateKnimeAction);
    fileMenu.add(new GroupMarker("UpdateKNIME"));
    fileMenu.add(new Separator());
    fileMenu.add(m_exitAction);
    // Edit menu
    editMenu.add(m_undoAction);
    editMenu.add(m_redoAction);
    fileMenu.add(new GroupMarker("Redo"));
    editMenu.add(new Separator());
    editMenu.add(m_cutAction);
    editMenu.add(m_copyAction);
    editMenu.add(m_pasteAction);
    fileMenu.add(new GroupMarker("Paste"));
    editMenu.add(new Separator());
    editMenu.add(m_deleteAction);
    editMenu.add(m_selectAllAction);
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
    // View menu
    addMultiViewsToMenu(viewMenu);
    viewMenu.add(m_showViewShortlistContributionItem);
    viewMenu.add(m_resetPerspective);
    // Help menu
    // helpMenu.add(m_introAction);
    helpMenu.add(m_helpAction);
    helpMenu.add(m_helpSearchAction);
    helpMenu.add(m_introAction);
    // menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    helpMenu.add(m_aboutAction);
    final String[] unwanted = new String[] { "org.eclipse.birt.report.designer.ui.LibraryPublisAction", "org.eclipse.birt.report.designer.ui.TemplatepublisAction" };
    fileMenu.addMenuListener(new IMenuListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void menuAboutToShow(final IMenuManager mgr) {
            for (String id : unwanted) {
                fileMenu.remove(id);
            }
        }
    });
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 12 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project dbeaver by dbeaver.

the class ERDEditorContextMenuProvider method buildContextMenu.

/**
 * @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
 */
@Override
public void buildContextMenu(IMenuManager menu) {
    if (editor.isLoaded()) {
        GEFActionConstants.addStandardActionGroups(menu);
        ISelection selection = editor.getGraphicalViewer().getSelection();
        if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
            editor.fillPartContextMenu(menu, (IStructuredSelection) selection);
        }
        menu.add(new GroupMarker(CoreCommands.GROUP_NAVIGATOR_ADDITIONS));
        menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        menu.add(new GroupMarker(IActionConstants.MB_ADDITIONS_END));
        menu.add(new GroupMarker(CoreCommands.GROUP_TOOLS));
        menu.add(new Separator());
        editor.fillAttributeVisibilityMenu(menu);
        menu.add(new DiagramLayoutAction(editor));
    }
}
Also used : DiagramLayoutAction(org.jkiss.dbeaver.ext.erd.action.DiagramLayoutAction) ISelection(org.eclipse.jface.viewers.ISelection) GroupMarker(org.eclipse.jface.action.GroupMarker) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 13 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project yamcs-studio by yamcs.

the class ApplicationActionBarAdvisor method fillMenuBar.

@Override
protected void fillMenuBar(IMenuManager menuBar) {
    beforeFillMenuBar();
    MenuManager fileMenu = new MenuManager("File", IWorkbenchActionConstants.M_FILE);
    MenuManager windowMenu = new MenuManager("Window", IWorkbenchActionConstants.M_WINDOW);
    MenuManager helpMenu = new MenuManager("Help", IWorkbenchActionConstants.M_HELP);
    menuBar.add(fileMenu);
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(windowMenu);
    menuBar.add(helpMenu);
    // File
    fileMenu.add(new Separator());
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    fileMenu.add(new Separator());
    // fileMenu.add(exitAction);
    // Window
    windowMenu.add(bringAllToFrontAction);
    // Help
    helpMenu.add(onlineHelpAction);
    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    helpMenu.add(new Separator());
    helpMenu.add(raiseIssueAction);
    helpMenu.add(new Separator());
    helpMenu.add(aboutAction);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 14 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project core by jcryptool.

the class ApplicationActionBarAdvisor method createEditMenu.

private IMenuManager createEditMenu() {
    MenuManager menu = new MenuManager(Messages.applicationActionBarAdvisor_Menu_Edit, IWorkbenchActionConstants.M_EDIT);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    // undo, redo
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_UNDO));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_REDO));
    menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    menu.add(new Separator());
    // cut, copy, paste
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_CUT));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_COPY));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_PASTE));
    menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
    menu.add(new Separator());
    // delete, select all
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_DELETE));
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_SELECT_ALL));
    menu.add(new Separator());
    // find
    menu.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE));
    menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
    menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
    // provide a uniform location for the "show in" or "open with" actions
    // $NON-NLS-1$
    MenuManager showin = new MenuManager(Messages.ApplicationActionBarAdvisor_1, "showin");
    // $NON-NLS-1$
    showin.add(new GroupMarker("start"));
    menu.add(showin);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    return menu;
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IServiceLocator(org.eclipse.ui.services.IServiceLocator) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 15 with GroupMarker

use of org.eclipse.jface.action.GroupMarker in project core by jcryptool.

the class ApplicationActionBarAdvisor method fillCoolBar.

@Override
protected void fillCoolBar(ICoolBarManager coolBar) {
    // ToolBar File & Additions
    IToolBarManager fileToolBar = new ToolBarManager(coolBar.getStyle());
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_SAVE));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_SAVE_ALL));
    fileToolBar.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.FILE_PRINT));
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    fileToolBar.add(new Separator());
    fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    // $NON-NLS-1$
    coolBar.add(new ToolBarContributionItem(fileToolBar, CorePlugin.PLUGIN_ID + ".toolbar"));
    // ToolBar Help
    IToolBarManager helpToolBar = new ToolBarManager(coolBar.getStyle());
    // $NON-NLS-1$
    coolBar.add(new ToolBarContributionItem(helpToolBar, CorePlugin.PLUGIN_ID + ".helpToolBar"));
    // CoolBar Context Menu
    // $NON-NLS-1$
    MenuManager coolBarContextMenuManager = new MenuManager(null, CorePlugin.PLUGIN_ID + ".contextMenu");
    coolBar.setContextMenuManager(coolBarContextMenuManager);
    coolBarContextMenuManager.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.WINDOW_LOCK_TOOLBAR));
    coolBarContextMenuManager.add(createContributionItem(serviceLocator, null, IWorkbenchCommandConstants.WINDOW_CUSTOMIZE_PERSPECTIVE));
    coolBarContextMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
Also used : ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IServiceLocator(org.eclipse.ui.services.IServiceLocator) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

GroupMarker (org.eclipse.jface.action.GroupMarker)117 Separator (org.eclipse.jface.action.Separator)93 IMenuManager (org.eclipse.jface.action.IMenuManager)44 MenuManager (org.eclipse.jface.action.MenuManager)42 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)17 IToolBarManager (org.eclipse.jface.action.IToolBarManager)12 IAction (org.eclipse.jface.action.IAction)10 IMenuListener (org.eclipse.jface.action.IMenuListener)10 Menu (org.eclipse.swt.widgets.Menu)8 Action (org.eclipse.jface.action.Action)7 ISelection (org.eclipse.jface.viewers.ISelection)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)4 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)4 ToolBarManager (org.eclipse.jface.action.ToolBarManager)4 Iterator (java.util.Iterator)2 AddPVAction (org.csstudio.trends.databrowser3.ui.AddPVAction)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 Point (org.eclipse.swt.graphics.Point)2 Shell (org.eclipse.swt.widgets.Shell)2