Example usage for org.eclipse.jface.action GroupMarker GroupMarker

List of usage examples for org.eclipse.jface.action GroupMarker GroupMarker

Introduction

In this page you can find the example usage for org.eclipse.jface.action GroupMarker GroupMarker.

Prototype

public GroupMarker(String groupName) 

Source Link

Document

Create a new group marker with the given name.

Usage

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private void fillEditMenu(IWorkbenchWindow window, IMenuManager editMenu) {
    if (editMenu.findUsingPath(Constants.EDIT_START) == null) {
        if (editMenu.getItems().length > 0) {
            editMenu.insertBefore(editMenu.getItems()[0].getId(), new GroupMarker(Constants.EDIT_START));
        } else {/*from  ww w.  ja  va  2s.c  o  m*/
            editMenu.add(new GroupMarker(Constants.EDIT_START));
        }
    }

    if (editMenu.findUsingPath(Constants.UNDO_EXT) == null) {
        editMenu.insertAfter(Constants.EDIT_START, new GroupMarker(Constants.UNDO_EXT));
    }

    if (editMenu.findUsingPath(Constants.CUT_EXT) == null) {
        editMenu.insertAfter(Constants.UNDO_EXT, new GroupMarker(Constants.CUT_EXT));
    }

    if (editMenu.findUsingPath(Constants.ADD_EXT) == null) {
        editMenu.insertAfter(Constants.CUT_EXT, new GroupMarker(Constants.ADD_EXT));
    }

    if (editMenu.findUsingPath(Constants.EDIT_END) == null) {
        editMenu.insertAfter(Constants.ADD_EXT, new GroupMarker(Constants.EDIT_END));
    }
    if (editMenu.findUsingPath(IWorkbenchActionConstants.MB_ADDITIONS) == null) {
        editMenu.insertAfter(Constants.EDIT_END, new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    }

    editMenu.appendToGroup(Constants.UNDO_EXT, ActionFactory.UNDO.create(window));
    editMenu.appendToGroup(Constants.UNDO_EXT, ActionFactory.REDO.create(window));
    editMenu.appendToGroup(Constants.CUT_EXT, ActionFactory.CUT.create(window));
    editMenu.appendToGroup(Constants.CUT_EXT, ActionFactory.COPY.create(window));
    editMenu.appendToGroup(Constants.CUT_EXT, ActionFactory.PASTE.create(window));
    editMenu.appendToGroup(Constants.ADD_EXT, ActionFactory.DELETE.create(window));
    // appendToGroup(Constants.ADD_EXT, ActionFactory.SELECT_ALL.create(window));

    editMenu.insertAfter(Constants.UNDO_EXT, new Separator());
    editMenu.insertAfter(Constants.CUT_EXT, new Separator());
    editMenu.insertAfter(Constants.EDIT_END, new Separator());
}

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private IMenuManager createLayerMenu() {
    MenuManager menu = new MenuManager(Messages.UDIGWorkbenchAdvisor_layerMenu, Constants.M_LAYER);
    menu.add(new GroupMarker(Constants.LAYER_ADD_EXT));
    menu.add(new Separator());
    menu.add(new GroupMarker(Constants.LAYER_EDIT_EXT));
    menu.add(new Separator());
    menu.add(new GroupMarker(Constants.LAYER_MAPGRAPHIC_EXT));
    menu.add(new GroupMarker(Constants.LAYER_MAPGRAPHIC_OTHER));

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

    return menu;/* w w  w  .ja  v  a  2  s . c  o  m*/
}

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private IMenuManager createNavigationMenu() {
    MenuManager menu = new MenuManager(Messages.UDIGWorkbenchAdvisor_navigationMenu, Constants.M_NAVIGATE);
    // menu.add(ActionFactory.BACKWARD_HISTORY.create(window));
    // menu.add(ActionFactory.FORWARD_HISTORY.create(window));
    menu.add(new GroupMarker(Constants.NAV_START));
    menu.add(new Separator());
    menu.add(new GroupMarker(Constants.NAV_ZOOM_EXT));

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

    menu.add(new Separator());
    menu.add(new GroupMarker(Constants.NAV_BOTTOM));

    return menu;// w ww.  j  a  va 2  s.  c om
}

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private IMenuManager createToolMenu() {
    MenuManager menu = new MenuManager(Messages.UDIGWorkbenchAdvisor_tools, Constants.M_TOOL);
    menu.add(new GroupMarker(Constants.TOOL_ACTION));
    menu.add(new Separator());
    menu.add(new GroupMarker(Constants.TOOL_MODAL));
    menu.add(new Separator());
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    return menu;/*from  w  w  w.  j  a v a  2 s. co m*/
}

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private void fillWindowMenu(IWorkbenchWindow window, IMenuManager windowMenu) {

    if (windowMenu.findUsingPath(ActionFactory.OPEN_NEW_WINDOW.getId()) == null) {
        IAction openNewWindow = ActionFactory.OPEN_NEW_WINDOW.create(window);
        openNewWindow.setText(Messages.UDIGWorkbenchAdvisor_newWindow_text);
        if (windowMenu.getItems().length > 0) {
            windowMenu.insertBefore(windowMenu.getItems()[0].getId(), openNewWindow);
        } else {//from   w w  w.ja  va  2 s .  c om
            windowMenu.add(openNewWindow);
        }
    }

    IMenuManager perspectiveMenu = windowMenu
            .findMenuUsingPath(ContributionItemFactory.PERSPECTIVES_SHORTLIST.getId());
    if (perspectiveMenu == null) {
        perspectiveMenu = new MenuManager(Messages.UDIGWorkbenchAdvisor_open_perspective,
                ContributionItemFactory.PERSPECTIVES_SHORTLIST.getId());
        windowMenu.insertAfter(ActionFactory.OPEN_NEW_WINDOW.getId(), perspectiveMenu);
        IContributionItem perspectiveList = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window);
        perspectiveMenu.add(perspectiveList);
    }

    IMenuManager viewMenu = windowMenu.findMenuUsingPath(ContributionItemFactory.VIEWS_SHORTLIST.getId());
    if (viewMenu == null) {
        viewMenu = new MenuManager(Messages.UDIGWorkbenchAdvisor_show_view,
                ContributionItemFactory.VIEWS_SHORTLIST.getId());
        windowMenu.insertAfter(ContributionItemFactory.PERSPECTIVES_SHORTLIST.getId(), viewMenu);
        IContributionItem viewList = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
        viewMenu.add(viewList);
    }

    if (windowMenu.findUsingPath(ContributionItemFactory.OPEN_WINDOWS.getId()) == null) {
        // append this one to the end and we'll work backward from it
        windowMenu.add(ContributionItemFactory.OPEN_WINDOWS.create(window));
    }

    if (windowMenu.findUsingPath(ActionFactory.PREFERENCES.getId()) == null) {
        IAction preferences = ActionFactory.PREFERENCES.create(window);
        preferences.setText(Messages.UDIGWorkbenchAdvisor_preferences_text);
        windowMenu.insertBefore(ContributionItemFactory.OPEN_WINDOWS.getId(), preferences);
    }

    if (windowMenu.findUsingPath(IWorkbenchActionConstants.MB_ADDITIONS) == null) {
        windowMenu.insertBefore(ActionFactory.PREFERENCES.getId(),
                new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    }

    if (windowMenu.findUsingPath(ActionFactory.CLOSE_ALL_PERSPECTIVES.getId()) == null) {
        IAction closeAllPerspectives = ActionFactory.CLOSE_ALL_PERSPECTIVES.create(window);
        closeAllPerspectives.setText(Messages.UDIGWorkbenchAdvisor_closeAllPerspectives_text);
        windowMenu.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, closeAllPerspectives);
    }

    if (windowMenu.findUsingPath(ActionFactory.CLOSE_PERSPECTIVE.getId()) == null) {
        IAction closePerspective = ActionFactory.CLOSE_PERSPECTIVE.create(window);
        closePerspective.setText(Messages.UDIGWorkbenchAdvisor_closePerspective_text);
        windowMenu.insertBefore(ActionFactory.CLOSE_ALL_PERSPECTIVES.getId(), closePerspective);
    }

    if (windowMenu.findUsingPath(ActionFactory.RESET_PERSPECTIVE.getId()) == null) {
        IAction resetPerspective = ActionFactory.RESET_PERSPECTIVE.create(window);
        resetPerspective.setText(Messages.UDIGWorkbenchAdvisor_resetPerspective_text);
        windowMenu.insertBefore(ActionFactory.CLOSE_PERSPECTIVE.getId(), resetPerspective);
    }

    // Add the separators
    windowMenu.insertAfter(ActionFactory.OPEN_NEW_WINDOW.getId(), new Separator());
    windowMenu.insertAfter(ContributionItemFactory.VIEWS_SHORTLIST.getId(), new Separator());
    windowMenu.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    windowMenu.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
}

From source file:net.refractions.udig.ui.UDIGMenuBuilder.java

License:Open Source License

private void fillHelpMenu(IWorkbenchWindow window, IMenuManager helpMenu) {

    if (helpMenu.findUsingPath(ActionFactory.INTRO.getId()) == null) {
        IAction welcome = ActionFactory.INTRO.create(window);
        welcome.setText(Messages.UDIGWorkbenchAdvisor_welcome_text);
        if (helpMenu.getItems().length > 0) {
            helpMenu.insertBefore(helpMenu.getItems()[0].getId(), welcome);
        } else {//from ww w .j  a  v  a2 s .c  o  m
            helpMenu.add(welcome);
        }
    }

    if (helpMenu.findUsingPath(Constants.HELP_START) == null) {
        helpMenu.insertAfter(ActionFactory.INTRO.getId(), new GroupMarker(Constants.HELP_START));
    }

    if (helpMenu.findUsingPath(ActionFactory.HELP_CONTENTS.getId()) == null) {
        IAction helpContents = ActionFactory.HELP_CONTENTS.create(window);
        helpContents.setText(Messages.UDIGWorkbenchAdvisor_helpContents_text);
        helpMenu.insertBefore(Constants.HELP_START, helpContents);
    }

    if (helpMenu.findUsingPath(Constants.HELP_END) == null) {
        helpMenu.insertAfter(Constants.HELP_START, new GroupMarker(Constants.HELP_END));
    }

    // Tips and tricks page would go after HELP_START

    if (helpMenu.findUsingPath(IWorkbenchActionConstants.MB_ADDITIONS) == null) {
        helpMenu.insertAfter(Constants.HELP_END, new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    }

    // Add the separators
    helpMenu.insertAfter(ActionFactory.INTRO.getId(), new Separator());
    helpMenu.insertBefore(Constants.HELP_START, new Separator());
    helpMenu.insertAfter(Constants.HELP_END, new Separator());
    // helpMenu.insertAfter(, new Separator());

    if (helpMenu.findUsingPath(ActionFactory.ABOUT.getId()) == null) {
        IAction about = ActionFactory.ABOUT.create(window);
        about.setText(Messages.UDIGWorkbenchAdvisor_aboutUDig_text);
        // About should always be at the bottom, so just append it to the menu
        helpMenu.add(about);
    }
}

From source file:net.sf.eclipsensis.dialogs.NSISTemplateEditorDialog.java

License:Open Source License

private void fillContextMenu(IMenuManager menu) {
    menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
            mGlobalActions.get(ITextEditorActionConstants.UNDO));

    menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
            mGlobalActions.get(ITextEditorActionConstants.CUT));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
            mGlobalActions.get(ITextEditorActionConstants.COPY));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
            mGlobalActions.get(ITextEditorActionConstants.PASTE));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
            mGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
    menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
            mGlobalActions.get(INSISEditorConstants.CONTENT_ASSIST_PROPOSAL));

    menu.add(new Separator("templates")); //$NON-NLS-1$
    menu.appendToGroup("templates", mGlobalActions.get("InsertTemplateVariableProposal")); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:net.sf.jmoney.JMoneyActionBarAdvisor.java

License:Open Source License

@Override
protected void fillMenuBar(IMenuManager menuBar) {
    menuBar.add(createFileMenu());//from  ww  w . j a  v a  2 s .  c  o  m
    menuBar.add(createEditMenu());
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(createNavigateMenu());
    menuBar.add(createWindowMenu());
    menuBar.add(createHelpMenu());
}

From source file:net.sf.jmoney.JMoneyActionBarAdvisor.java

License:Open Source License

/**
 * Creates and returns the File menu.//from   w  w w  .  j  a  v  a 2s .com
 */
private MenuManager createFileMenu() {
    MenuManager menu = new MenuManager(Messages.JMoneyActionBarAdvisor_MenuFileName,
            IWorkbenchActionConstants.M_FILE);

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

    menu.add(new Separator("sessionGroup")); //$NON-NLS-1$

    /*
     * This group is used only so that we can add the 'close session' command
     * at this position.  We should be able to just add the menu item here,
     * but I cannot get that to work, so we add the group here and then add
     * the 'close session' to this group declaratively in plugin.xml. 
     */
    menu.add(new Separator("closeSessionGroup")); //$NON-NLS-1$

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

    menu.add(new Separator());
    menu.add(importAction);
    menu.add(exportAction);

    menu.add(new Separator());
    menu.add(quitAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));

    return menu;
}

From source file:net.sf.jmoney.JMoneyActionBarAdvisor.java

License:Open Source License

/**
 * Creates and returns the Edit menu.//w  ww .  ja v  a2  s .  c o  m
 */
private MenuManager createEditMenu() {
    MenuManager menu = new MenuManager(Messages.JMoneyActionBarAdvisor_MenuEditName,
            IWorkbenchActionConstants.M_EDIT);

    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    menu.add(undoAction);
    menu.add(redoAction);

    menu.add(new Separator("transactions")); //$NON-NLS-1$
    menu.add(newTransactionItem);
    menu.add(deleteTransactionItem);
    menu.add(duplicateTransactionItem);
    menu.add(cutTransactionItem);
    menu.add(pasteCombineTransactionItem);

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

    return menu;
}