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:org.dafoe.application.ApplicationActionBarAdvisor.java

License:Open Source License

protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.2"), //$NON-NLS-1$
            IWorkbenchActionConstants.M_FILE);

    /*//w  w w .  j  a  v a2 s  .  c om
     * MenuManager traceabilityMenu = new MenuManager(
     * Messages.getString("ApplicationActionBarAdvisor.3"),
     * Messages.getString("ApplicationActionBarAdvisor.4")); //$NON-NLS-1$
     * //$NON-NLS-2$
     */

    MenuManager editMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.1"), //$NON-NLS-1$
            IWorkbenchActionConstants.M_EDIT);

    MenuManager windowMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.5"), //$NON-NLS-1$
            IWorkbenchActionConstants.M_WINDOW);

    /*
     * MenuManager statisticMenu = new MenuManager(
     * Messages.getString("ApplicationActionBarAdvisor.6"),
     * Messages.getString("ApplicationActionBarAdvisor.7")); //$NON-NLS-1$
     * //$NON-NLS-2$
     */

    MenuManager helpMenu = new MenuManager(Messages.getString("ApplicationActionBarAdvisor.8"), //$NON-NLS-1$
            IWorkbenchActionConstants.M_HELP);

    IViewCategory[] cate = PlatformUI.getWorkbench().getViewRegistry().getCategories();

    IPerspectiveDescriptor[] perpDesc = PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();

    //MenuManager showViewMenuMgr = new MenuManager(IDEWorkbenchMessages.Workbench_showView, "showView"); //$NON-NLS-1$

    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(windowMenu);

    menuBar.add(helpMenu);

    GroupMarker gmfichier = new GroupMarker("additions"); //$NON-NLS-1$
    fileMenu.add(gmfichier);
    fileMenu.add(new Separator());
    fileMenu.add(exitAction);
    fileMenu.add(new Separator());

    editMenu.add(genericAction);
    // VT:
    editMenu.add(new Separator());
    editMenu.add(preferenceAction);
    // fin VT:

    for (int i = 0; i < cate.length; i++) {

        MenuManager cateMan = new MenuManager(cate[i].getLabel(), "cate"); //$NON-NLS-1$

        IViewDescriptor[] ivd = cate[i].getViews();

        for (int j = 0; j < ivd.length; j++) {
            System.out.println("ivd label = " + ivd[j].getLabel());
            Action act = CreerAction(ivd[j], "des_" + j); //$NON-NLS-1$
            cateMan.add(act);
        }

        windowMenu.add(cateMan);

    }

    MenuManager perspMan = new MenuManager("Perspective", "persp");

    Action act = new Action() {
        public void run() {
            switchPerspective("welcome");
        }
    };
    act.setText("Welcome");
    perspMan.add(act);

    act = new Action() {
        public void run() {
            switchPerspective("corpus");
        }
    };
    act.setText("Corpus");
    perspMan.add(act);

    act = new Action() {
        public void run() {
            switchPerspective("terminologic");
        }
    };
    act.setText("Terminology");
    perspMan.add(act);

    act = new Action() {
        public void run() {
            switchPerspective("terminoontologic");
        }
    };
    act.setText("Termino-Ontology");
    perspMan.add(act);

    act = new Action() {
        public void run() {
            switchPerspective("ontologic");
        }
    };
    act.setText("Ontology");
    perspMan.add(act);

    windowMenu.add(perspMan);

    windowMenu.add(new Separator());
    GroupMarker gmwindow = new GroupMarker("additions"); //$NON-NLS-1$
    windowMenu.add(gmwindow);
    windowMenu.add(new Separator());
    windowMenu.add(CreerFermeViewContext());

    // windowMenu.add(fenetreAction);

    helpMenu.add(aboutAction);
}

From source file:org.dita_op.editor.internal.ui.editors.map.MasterSection.java

License:Open Source License

public void menuAboutToShow(IMenuManager manager) {
    final Element elt = modelProvider.getSelection();
    Descriptor desc = Descriptor.getDescriptor(elt);

    MenuManager newChild = new MenuManager(Messages.getString("MasterSection.menu.new_child"), "new_child"); //$NON-NLS-1$ //$NON-NLS-2$
    newChild.add(new GroupMarker("addition")); //$NON-NLS-1$
    manager.add(newChild);// w  w w . j  a  v  a 2 s . c o  m

    MenuManager newSibing = new MenuManager(Messages.getString("MasterSection.menu.new_sibling"), //$NON-NLS-1$
            "new_sibling"); //$NON-NLS-1$
    newSibing.add(new GroupMarker("addition")); //$NON-NLS-1$
    manager.add(newSibing);

    if (DOMUtils.getReference(elt) != null) {
        manager.add(new Action(Messages.getString("MasterSection.menu.open")) { //$NON-NLS-1$

            @Override
            public void run() {
                DOMUtils.open(baseLocation, elt);
            }

        });
    }

    manager.add(new Separator("edit")); //$NON-NLS-1$
    boolean ismap = Descriptor.getDescriptor(elt).isMap();

    if (!ismap) {
        manager.add(new Action(Messages.getString("MasterSection.menu.cut"), //$NON-NLS-1$
                Activator.getImageDescriptor(ImageConstants.ICON_CUT)) {

            @Override
            public void run() {
                Node copy = elt.cloneNode(true);

                clipboard.setContents(new Object[] { copy }, new Transfer[] { NodeTransfer.getInstance() });

                modelProvider.remove(elt);
            }

        });

        manager.add(new Action(Messages.getString("MasterSection.menu.copy"), //$NON-NLS-1$
                Activator.getImageDescriptor(ImageConstants.ICON_COPY)) {

            @Override
            public void run() {
                Node copy = elt.cloneNode(true);

                clipboard.setContents(new Object[] { copy }, new Transfer[] { NodeTransfer.getInstance() });
            }

        });
    }

    Action pasteAction = new Action(Messages.getString("MasterSection.menu.paste"), //$NON-NLS-1$
            Activator.getImageDescriptor(ImageConstants.ICON_PASTE)) {

        @Override
        public void run() {
            Node n = (Node) clipboard.getContents(NodeTransfer.getInstance());

            if (n != null) {
                modelProvider.addChildNode(elt, n);
            }
        }

    };

    Node pasted = (Node) clipboard.getContents(NodeTransfer.getInstance());
    pasteAction.setEnabled(pasted != null && desc.accept(pasted));
    manager.add(pasteAction);

    if (!ismap) {
        manager.add(new Separator());
        manager.add(new Action(Messages.getString("MasterSection.menu.delete"), //$NON-NLS-1$
                Activator.getImageDescriptor(ImageConstants.ICON_REMOVE)) {

            @Override
            public void run() {
                modelProvider.remove(elt);
            }

        });
    }

    manager.add(new Separator("additions")); //$NON-NLS-1$

    if (baseLocation != null) {
        final int stubsCount = countStubs(elt);
        Action generateAction = new Action(Messages.getString("MasterSection.menu.generateStubs")) { //$NON-NLS-1$

            @Override
            public void run() {
                Job job = new GenerateStubsJob(MasterSection.this, stubsCount, elt);
                job.schedule();
            }
        };

        generateAction.setEnabled(stubsCount > 0);
        manager.add(generateAction);
    }

    desc.contributeMenuItems(manager, modelProvider);
}

From source file:org.drools.eclipse.debug.AuditView.java

License:Apache License

protected void fillContextMenu(IMenuManager menu) {
    Event selected = getSelectedEvent();
    if (selected != null) {
        Event causeEvent = selected.getCauseEvent();
        if (causeEvent != null) {
            menu.add(getAction("ShowEventCause"));
        }/* w w  w .ja v  a 2  s  .  c o m*/
    }
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}

From source file:org.drools.eclipse.debug.DroolsDebugEventHandlerView.java

License:Apache License

protected void fillContextMenu(IMenuManager menu) {
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}

From source file:org.dslforge.texteditor.BasicTextEditor.java

License:Open Source License

protected void editorContextMenuAboutToShow(IMenuManager menuManager) {
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_UNDO));
    menuManager.add(new GroupMarker(IBasicTextEditorActionConstants.GROUP_SAVE));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_COPY));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_PRINT));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_EDIT));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_FIND));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_ADD));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.GROUP_REST));
    menuManager.add(new Separator(IBasicTextEditorActionConstants.MB_ADDITIONS));
    if (isEditable()) {
        addAction(menuManager, IBasicTextEditorActionConstants.GROUP_EDIT, ActionFactory.COPY.getId());
        addAction(menuManager, IBasicTextEditorActionConstants.GROUP_EDIT, ActionFactory.CUT.getId());
        addAction(menuManager, IBasicTextEditorActionConstants.GROUP_EDIT, ActionFactory.PASTE.getId());
        menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        addAction(menuManager, IBasicTextEditorActionConstants.GROUP_UNDO, ActionFactory.UNDO.getId());
        addAction(menuManager, IBasicTextEditorActionConstants.GROUP_UNDO, ActionFactory.REDO.getId());
    }//from w ww . j  a  va2 s .com
}

From source file:org.dslforge.texteditor.demo.BasicWorkbenchActionBarAdvisor.java

License:Open Source License

protected void fillMenuBar(IMenuManager menuBar) {
    IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
    menuBar.add(createFileMenu(window));
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(createEditMenu(window));
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(createHelpMenu(window));
}

From source file:org.dslforge.texteditor.demo.BasicWorkbenchActionBarAdvisor.java

License:Open Source License

/**
 * Creates the 'File' menu//w  w  w . j  av a2 s .  c o  m
 * 
 * @param window
 * @return
 */
protected IMenuManager createFileMenu(IWorkbenchWindow window) {
    IMenuManager menu = new MenuManager("File", IWorkbenchActionConstants.M_FILE);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    IMenuManager newMenu = new MenuManager("New", "new");
    newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(newMenu);
    menu.add(new Separator());
    menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new Separator());
    addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window));
    addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window));
    menu.add(new Separator());
    addToMenuAndRegister(menu, ActionFactory.SAVE.create(window));
    addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window));
    addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window));
    menu.add(new Separator());
    addToMenuAndRegister(menu, ActionFactory.QUIT.create(window));
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    return menu;
}

From source file:org.dslforge.texteditor.demo.BasicWorkbenchActionBarAdvisor.java

License:Open Source License

/**
 * Creates the 'Edit' menu.//from   w  w w.  j a va 2  s  . co m
 * 
 * @param window
 * @return
 */
protected IMenuManager createEditMenu(IWorkbenchWindow window) {
    IMenuManager menu = new MenuManager("Edit", IWorkbenchActionConstants.M_EDIT);

    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
    addToMenuAndRegister(menu, ActionFactory.UNDO.create(window));
    addToMenuAndRegister(menu, ActionFactory.REDO.create(window));
    menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    menu.add(new Separator());

    addToMenuAndRegister(menu, ActionFactory.CUT.create(window));
    IWorkbenchAction copyAction = ActionFactory.COPY.create(window);

    addToMenuAndRegister(menu, copyAction);
    addToMenuAndRegister(menu, ActionFactory.PASTE.create(window));
    menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
    menu.add(new Separator());

    addToMenuAndRegister(menu, ActionFactory.DELETE.create(window));
    addToMenuAndRegister(menu, ActionFactory.SELECT_ALL.create(window));
    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;
}

From source file:org.ebayopensource.turmeric.eclipse.errorlibrary.properties.providers.PropertiesErrorRegistryViewProvider.java

License:Open Source License

/**
 * {@inheritDoc}/*from  w w  w.j  a va 2 s  .c  o m*/
 * 
 * <p>Should migrate to commands/handlers/menus extension.</p>
 */
@Override
public void createContextMenu(MenuManager menuMgr, final TreeViewer errorViewer) throws Exception {
    if (deleteAction == null)
        deleteAction = new DeleteErrorNodeAction(errorViewer);
    if (refreshAction == null)
        refreshAction = new RefreshErrorNodeAction(errorViewer);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager mgr) {
            mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
            if (errorViewer.getSelection() instanceof IStructuredSelection) {
                Object obj = ((IStructuredSelection) errorViewer.getSelection()).getFirstElement();
                if (obj instanceof ISOAErrUIComp) {
                    if ((obj instanceof ISOAErrLibrary) == false) {
                        mgr.add(deleteAction);
                        deleteAction.setSelectedErrorNode((ISOAErrUIComp) obj);
                    }
                    mgr.add(refreshAction);
                    refreshAction.setSelectedErrorNode((ISOAErrUIComp) obj);
                }
            }

        }
    });
}

From source file:org.ebayopensource.vjet.eclipse.internal.ui.editor.VjoOutlinePage.java

License:Open Source License

@Override
protected void contextMenuAboutToShow(IMenuManager menu) {

    // DLTKUIPlugin.createStandardGroups(menu);
    if (menu.isEmpty()) {
        // 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));
    }// ww  w  .  j  a  v a 2s. co m

    IStructuredSelection selection = (IStructuredSelection) getSelection();
    fActionGroups.setContext(new ActionContext(selection));
    fActionGroups.fillContextMenu(menu);
}