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

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

Introduction

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

Prototype

public MenuManager(String text, String id) 

Source Link

Document

Creates a menu manager with the given text and id.

Usage

From source file:ac.soton.fmusim.components.presentation.ComponentsActionBarContributor.java

License:Open Source License

/**
 * This adds to the menu bar a menu and some separators for editor additions,
 * as well as the sub-menus for object creation items.
 * <!-- begin-user-doc -->/*from  ww w . j av a  2s.  c om*/
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    IMenuManager submenuManager = new MenuManager(
            ComponentsEditorPlugin.INSTANCE.getString("_UI_ComponentsEditor_menu"),
            "ac.soton.fmusim.componentsMenuID");
    menuManager.insertAfter("additions", submenuManager);
    submenuManager.add(new Separator("settings"));
    submenuManager.add(new Separator("actions"));
    submenuManager.add(new Separator("additions"));
    submenuManager.add(new Separator("additions-end"));

    // Prepare for CreateChild item addition or removal.
    //
    createChildMenuManager = new MenuManager(
            ComponentsEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
    submenuManager.insertBefore("additions", createChildMenuManager);

    // Prepare for CreateSibling item addition or removal.
    //
    createSiblingMenuManager = new MenuManager(
            ComponentsEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
    submenuManager.insertBefore("additions", createSiblingMenuManager);

    // Force an update because Eclipse hides empty menus now.
    //
    submenuManager.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager menuManager) {
            menuManager.updateAll(true);
        }
    });

    addGlobalActions(submenuManager);
}

From source file:at.bitandart.zoubek.mervin.model.modelreview.presentation.ModelReviewActionBarContributor.java

License:Open Source License

/**
 * This adds to the menu bar a menu and some separators for editor
 * additions, as well as the sub-menus for object creation items. <!--
 * begin-user-doc --> <!-- end-user-doc -->
 * /*from  w ww . jav  a 2  s .  c  o m*/
 * @generated
 */
@Override
public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    IMenuManager submenuManager = new MenuManager(
            MervinModelReviewEditorPlugin.INSTANCE.getString("_UI_ModelReviewEditor_menu"),
            "at.bitandart.zoubek.mervin.model.modelreviewMenuID");
    menuManager.insertAfter("additions", submenuManager);
    submenuManager.add(new Separator("settings"));
    submenuManager.add(new Separator("actions"));
    submenuManager.add(new Separator("additions"));
    submenuManager.add(new Separator("additions-end"));

    // Prepare for CreateChild item addition or removal.
    //
    createChildMenuManager = new MenuManager(
            MervinModelReviewEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
    submenuManager.insertBefore("additions", createChildMenuManager);

    // Prepare for CreateSibling item addition or removal.
    //
    createSiblingMenuManager = new MenuManager(
            MervinModelReviewEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
    submenuManager.insertBefore("additions", createSiblingMenuManager);

    // Force an update because Eclipse hides empty menus now.
    //
    submenuManager.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager menuManager) {
            menuManager.updateAll(true);
        }
    });

    addGlobalActions(submenuManager);
}

From source file:at.spardat.xma.guidesign.presentation.action.GuidesignActionBarContributor.java

License:Open Source License

/**
 * This adds to the menu bar a menu and some separators for editor additions,
 * as well as the sub-menus for object creation items.
 * <!-- begin-user-doc -->/*from  w  w  w . j a va2 s .co  m*/
 * <!-- end-user-doc -->
 * @modified
 */
public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    IMenuManager submenuManager = new MenuManager(
            GUIDesignerPlugin.INSTANCE.getString("_UI_GuidesignEditor_menu"), "at.spardat.xma.guidesignMenuID");
    menuManager.insertAfter("additions", submenuManager);
    submenuManager.add(new Separator("settings"));
    submenuManager.add(new Separator("actions"));
    submenuManager.add(new Separator("additions"));
    submenuManager.add(new Separator("additions-end"));

    // Prepare for CreateChild item addition or removal.
    //
    createChildMenuManager = new MenuManager(GUIDesignerPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
    submenuManager.insertBefore("additions", createChildMenuManager);

    // Prepare for CreateSibling item addition or removal.
    //
    createSiblingMenuManager = new MenuManager(
            GUIDesignerPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
    submenuManager.insertBefore("additions", createSiblingMenuManager);

    //Prepare for CreateGenerate item addition or removal.
    editMenuManager = new MenuManager(GUIDesignerPlugin.INSTANCE.getString("_UI_Edit_menu_item"));
    submenuManager.insertBefore("additions", editMenuManager);
}

From source file:at.spardat.xma.guidesign.presentation.UIPreviewer.java

License:Open Source License

protected void createContextMenu() {
    contextMenu = new MenuManager("#PopUp", "at.spardat.xma.guidesign.presentation.UIPreViewer.Popup");
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(editor);
    editor.getSite().registerContextMenu(contextMenu, this);
}

From source file:automaticexperiment.presentation.AutomaticexperimentActionBarContributor.java

License:Open Source License

/**
 * This adds to the menu bar a menu and some separators for editor additions,
 * as well as the sub-menus for object creation items.
 * <!-- begin-user-doc -->/* w  ww .j av a  2  s  .c  o  m*/
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    IMenuManager submenuManager = new MenuManager(
            AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditor_menu"),
            "automaticexperimentMenuID");
    menuManager.insertAfter("additions", submenuManager);
    submenuManager.add(new Separator("settings"));
    submenuManager.add(new Separator("actions"));
    submenuManager.add(new Separator("additions"));
    submenuManager.add(new Separator("additions-end"));

    // Prepare for CreateChild item addition or removal.
    //
    createChildMenuManager = new MenuManager(
            AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
    submenuManager.insertBefore("additions", createChildMenuManager);

    // Prepare for CreateSibling item addition or removal.
    //
    createSiblingMenuManager = new MenuManager(
            AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
    submenuManager.insertBefore("additions", createSiblingMenuManager);

    // Force an update because Eclipse hides empty menus now.
    //
    submenuManager.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager menuManager) {
            menuManager.updateAll(true);
        }
    });

    addGlobalActions(submenuManager);
}

From source file:bilab.BilabActionBarAdvisor.java

License:Open Source License

private void addPerspectiveActions(final MenuManager menu) {
    final String openText = "OpenPerspective";
    final MenuManager changePerspMenuMgr = new MenuManager(openText, "openPerspective"); //$NON-NLS-1$
    final IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST
            .create(getWindow());/*from www  . j  a v  a2 s .  c  o m*/
    changePerspMenuMgr.add(changePerspMenuItem);
    menu.add(changePerspMenuMgr);

    final MenuManager showViewMenuMgr = new MenuManager("Show View", "showView");
    final IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(getWindow());
    showViewMenuMgr.add(showViewMenu);
    menu.add(showViewMenuMgr);

    menu.add(new Separator());
    menu.add(editActionSetAction);
    menu.add(savePerspectiveAction);
    menu.add(resetPerspectiveAction);
    menu.add(closePerspAction);
    menu.add(closeAllPerspsAction);
}

From source file:bilab.BilabActionBarAdvisor.java

License:Open Source License

private MenuManager createEditMenu() {
    final MenuManager menu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));

    menu.add(undoAction);/*from  ww w.  ja v a2 s.c  om*/
    menu.add(redoAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    menu.add(new Separator());

    menu.add(cutAction);
    menu.add(copyAction);
    menu.add(pasteAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
    menu.add(new Separator());

    menu.add(deleteAction);
    menu.add(selectAllAction);
    menu.add(new Separator());

    menu.add(findAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
    menu.add(new Separator());

    menu.add(addBookmarkAction);
    menu.add(addTaskAction);
    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:bilab.BilabActionBarAdvisor.java

License:Open Source License

private MenuManager createFileMenu() {
    final MenuManager menu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);

    // setup the pop-out sub-menu for New --> Project/Other
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    {/* ww w. j a  va 2  s  .  c o m*/
        // create the new sub-menu
        final String newText = "New";
        final String newId = ActionFactory.NEW.getId();
        final MenuManager newMenu = new MenuManager(newText, newId);

        // some stuff was here in the old model

        newMenu.add(new Separator(newId));
        this.newWizardMenu = new NewWizardMenu(getWindow());
        newMenu.add(this.newWizardMenu);
        newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        menu.add(newMenu);
    }

    // open file menu
    menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    menu.add(new Separator());

    // Close | Close All
    menu.add(closeAction);
    menu.add(closeAllAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
    menu.add(new Separator());

    // Save | Save As | Save All | Revert
    menu.add(saveAction);
    menu.add(saveAsAction);
    menu.add(saveAllAction);
    menu.add(revertAction);
    menu.add(new Separator());

    // Move | Rename | Refresh
    menu.add(moveAction);
    menu.add(renameAction);
    menu.add(refreshAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
    menu.add(new Separator());

    // Print
    menu.add(printAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
    menu.add(new Separator());

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

    // Import | Export
    menu.add(importResourcesAction);
    menu.add(exportResourcesAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new Separator());

    // Properties | Most Recently Used...
    menu.add(propertiesAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
    menu.add(new Separator());

    // Quit
    menu.add(quitAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));

    return menu;
}

From source file:bilab.BilabActionBarAdvisor.java

License:Open Source License

private MenuManager createHelpMenu() {
    final MenuManager menu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
    addSeparatorOrGroupMarker(menu, "group.intro");

    // See if a welcome or intro page is specified
    if (introAction != null) {
        menu.add(introAction);/* www.  j a va2s .  c  o  m*/
    } else if (quickStartAction != null) {
        menu.add(quickStartAction);
    }
    menu.add(new GroupMarker("group.intro.ext"));
    addSeparatorOrGroupMarker(menu, "group.main");
    menu.add(helpContentsAction);

    // See if a tips and tricks page is specified
    if (tipsAndTricksAction != null) {
        menu.add(tipsAndTricksAction);
    }

    // HELP_START should really be the first item, but it was after
    // quickStartAction and tipsAndTricksAction in 2.1.
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
    menu.add(new GroupMarker("group.main.ext"));
    addSeparatorOrGroupMarker(menu, "group.tutorials");
    addSeparatorOrGroupMarker(menu, "group.tools");
    addSeparatorOrGroupMarker(menu, "group.updates");
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);

    // about should always be at the bottom
    menu.add(new Separator("group.about"));
    menu.add(aboutAction);
    menu.add(new GroupMarker("group.about.ext"));

    return menu;
}

From source file:bilab.BilabActionBarAdvisor.java

License:Open Source License

private MenuManager createWindowMenu() {
    final MenuManager menu = new MenuManager("Window", IWorkbenchActionConstants.M_WINDOW);

    final IWorkbenchAction action = ActionFactory.OPEN_NEW_WINDOW.create(getWindow());
    action.setText("New Window");
    menu.add(action);/*from www  .j av a  2 s.  c  om*/
    menu.add(new Separator());

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

    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "end"));
    menu.add(openPreferencesAction);

    menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
    return menu;
}