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:eu.udig.catalog.ng.ui.CatalogNGView.java

License:Open Source License

/**
 * Menu item to add Copy to Clipboard capability
 * This allows for copying the layer name in the layer viewer to the clipboard
 * e.g: Copy the path of the filename//from   w  w w . j a  v a2  s  . c om
 * @param   parentWidget  Composite parent for display
 */
private void createContextMenu(Composite parentWidget) {
    final MenuManager contextMenu = new MenuManager();
    display = parentWidget.getDisplay();
    copyAction = new Action("Copy to Clipboard") { //$NON-NLS-1$
        public void run() {
            IStructuredSelection sel = (IStructuredSelection) treeViewerLayers.getSelection();
            sel.getFirstElement();
            String textData = (String) sel.getFirstElement();
            TextTransfer textTransfer = TextTransfer.getInstance();
            clipBoard = new Clipboard(display);
            clipBoard.setContents(new Object[] { textData }, new Transfer[] { textTransfer });
        }
    };
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager mgr) {
            contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
            contextMenu.add(new Separator());
            contextMenu.add(copyAction);

            // contextMenu.add(refreshAction);
            IWorkbenchWindow window = getSite().getWorkbenchWindow();
            IAction action = ActionFactory.IMPORT.create(window);

        }

    });

    // Create menu.
    Menu menu = contextMenu.createContextMenu(treeViewerLayers.getControl());
    treeViewerLayers.getControl().setMenu(menu);

    // Register menu for extension.
    getSite().registerContextMenu(contextMenu, treeViewerLayers);

}

From source file:ext.eclipse.rcp.app.intro.ApplicationActionBarAdvisor.java

License:Apache License

protected void fillMenuBar(IMenuManager menuBar) {
    menuBar.add(createFileMenu());/*from   w w w.  j  ava2 s.co m*/
    menuBar.add(createEditMenu());
    menuBar.add(createProjectMenu());
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menuBar.add(createWindowMenu());
    menuBar.add(createHelpMenu());
}

From source file:ext.org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.java

License:Open Source License

@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);//from w  w  w  .j  a  v a2  s .  c o  m

    //Breadcrumb
    IAction action = getAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB);
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);

    // Quick views
    action = getAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE);
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
    action = getAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY);
    menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);

    // Copy qualified name
    action = getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME);
    if (menu.find(ITextEditorActionConstants.COPY) != null)
        menu.insertAfter(ITextEditorActionConstants.COPY, action);
    else
        addAction(menu, ITextEditorActionConstants.GROUP_COPY, IJavaEditorActionConstants.COPY_QUALIFIED_NAME);

}

From source file:ext.org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.java

License:Open Source License

void fillToolBar(IToolBarManager toolBar) {
    if (fBackAction.isEnabled() || fUpAction.isEnabled() || fForwardAction.isEnabled()) {
        toolBar.add(fBackAction);// w  w  w  .  j  a v  a2  s  . co m
        toolBar.add(fForwardAction);
        toolBar.add(fUpAction);
        toolBar.add(new Separator(FRAME_ACTION_SEPARATOR_ID));
        fFrameActionsShown = true;
    }
    toolBar.add(new GroupMarker(FRAME_ACTION_GROUP_ID));
    toolBar.add(fCollapseAllAction);
    toolBar.add(fToggleLinkingAction);
    toolBar.update(true);
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.EditTemplateDialog.java

License:Open Source License

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

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

    menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
    menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}

From source file:fable.framework.ui.internal.MainMenuBar.java

License:Open Source License

/**
 * Fill fable menu bar with standard actions.
 * //w w  w.jav a 2 s  .com
 */
public void fillMenuBar(IMenuManager menuBar) {
    createMenuFile();
    menuBar.add(fileMenu);

    createMenuEdit();
    menuBar.add(editMenu);
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    createMenuWindows();
    menuBar.add(windowMenu);
    menuBar.add(new GroupMarker(IWorkbenchActionConstants.M_HELP));

    createMenuHelp();
    menuBar.add(helpMenu);

    // common Fable menu

}

From source file:fable.framework.ui.internal.MainMenuBar.java

License:Open Source License

public void fillCoolBar(ICoolBarManager cbManager) {
    cbManager.add(new GroupMarker("group.file")); //$NON-NLS-1$
    { // File Group
        IToolBarManager fileToolBar = new ToolBarManager(cbManager.getStyle());
        fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
        fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
        fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
        fileToolBar.add(getAction(ActionFactory.SAVE.getId()));
        fileToolBar.add(getAction(ActionFactory.SAVE_AS.getId()));

        fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

        // Add to the cool bar manager
        cbManager.add(new ToolBarContributionItem(fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE));
    }/*  w  ww .  j a  v a 2  s  .  c o  m*/

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

    cbManager.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
}

From source file:fable.framework.ui.internal.MainMenuBar.java

License:Open Source License

/**
 * This methods creates a menu File./*from w w  w .  j ava 2 s.c  o  m*/
 * <p>
 * <UL>
 * <LI>close action <code>(ActionFactory.CLOSE)</code>
 * <LI>Close all action <code>(ActionFactory.CLOSE_ALL)</code>
 * <LI>Close and exit <code>(ActionFactory.CLOSE_EXT)</code>
 * <LI>Save editor <code>(ActionFactory.SAVE)</code>
 * <LI>Save as opened editor <code>(ActionFactory.SAVE_AS)</code>
 * <LI>Save all opened editors <code>(ActionFactory.SAVE_ALL)</code>
 * <LI>Revert <code>(ActionFactory.REVERT)</code>
 * <LI>Open last editor <code>(ActionFactory.REOPEN_EDITORS)</code>
 * <LI>Exit application <code>(ActionFactory.QUIT)</code>
 * </UL>
 * </p>
 */
private void createMenuFile() {
    fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);

    MenuManager newMenu = new MenuManager("New", IWorkbenchActionConstants.M_PROJECT);

    fileMenu.add(newMenu);
    newMenu.add(newAction);
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));

    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    fileMenu.add(getAction(ActionFactory.CLOSE.getId()));
    fileMenu.add(getAction(ActionFactory.CLOSE_ALL.getId()));
    // menu.add(closeAllSavedAction);
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
    fileMenu.add(new Separator());
    fileMenu.add(getAction(ActionFactory.SAVE.getId()));
    fileMenu.add(getAction(ActionFactory.SAVE_AS.getId()));
    fileMenu.add(getAction(ActionFactory.SAVE_ALL.getId()));

    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
    fileMenu.add(new Separator());
    fileMenu.add(exportProject);
    fileMenu.add(importProject);

    fileMenu.add(getAction(ActionFactory.REVERT.getId()));
    fileMenu.add(ContributionItemFactory.REOPEN_EDITORS
            .create(getActionBarConfigurer().getWindowConfigurer().getWindow()));
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
    fileMenu.add(new Separator());
    fileMenu.add(getAction(ActionFactory.QUIT.getId()));
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
}

From source file:fable.framework.ui.internal.MainMenuBar.java

License:Open Source License

/**
 * This methods add menu Edit and its actions to MainMenuBar.
 * <p>/*  w w  w.j a va2 s.co m*/
 * <UL>
 * <LI>Undo action <code>(ActionFactory.UNDO)</code>
 * <LI>Redo action <code>(ActionFactory.REDO)</code>
 * <LI>Cut action<code>(ActionFactory.CUT)</code>
 * <LI>Copy action <code>(ActionFactory.COPY)</code>
 * <LI>Paste opened editor <code>(ActionFactory.PASTE)</code>
 * <LI><code>(ActionFactory.CUT_EXT)</code>
 * <LI>Select all action <code>(ActionFactory.SELECT_ALL)</code>
 * <LI><code>(ActionFactory.FIND_EXT)</code>
 * <LI><code>(ActionFactory.ADD_EXT)</code>
 * <LI><code>(ActionFactory.EDIT_END)</code>
 * </UL>
 * </p>
 */
private void createMenuEdit() {
    editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT); //$NON-NLS-1$
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));

    editMenu.add(getAction(ActionFactory.UNDO.getId()));
    editMenu.add(getAction(ActionFactory.REDO.getId()));
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));

    editMenu.add(getAction(ActionFactory.CUT.getId()));
    editMenu.add(getAction(ActionFactory.COPY.getId()));
    editMenu.add(getAction(ActionFactory.PASTE.getId()));
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));

    editMenu.add(getAction(ActionFactory.SELECT_ALL.getId()));
    editMenu.add(new Separator());

    editMenu.add(getAction(ActionFactory.FIND.getId()));
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));

    editMenu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));

    editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
    editMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

}

From source file:fable.framework.ui.internal.MainMenuBar.java

License:Open Source License

/**
 * This method creates menu Help.<br>
 * <UL>//from  w  ww.j a  va  2s . co m
 * <LI>Help action : Opens online help.
 * <LI>Update action : open update box to install new features or to update
 * installed features for the bundle.
 * <LI>About Action : opens plugin about box.
 * </UL>
 */
private void createMenuHelp() {
    helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
    helpMenu.add(helpAction);
    helpMenu.add(updateAction);
    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    helpMenu.add(new Separator());
    helpMenu.add(aboutAction);
}