Search in sources :

Example 46 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class ArchiActionBarAdvisor method createHelpMenu.

/**
 * Create the Help menu
 * @return
 */
private MenuManager createHelpMenu() {
    IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
    MenuManager menu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_16, IWorkbenchActionConstants.M_HELP);
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
    menu.add(ActionFactory.INTRO.create(window));
    menu.add(new Separator());
    menu.add(ActionFactory.HELP_CONTENTS.create(window));
    menu.add(ActionFactory.HELP_SEARCH.create(window));
    menu.add(ActionFactory.DYNAMIC_HELP.create(window));
    menu.add(new Separator());
    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    menu.add(fDonateAction);
    menu.add(fActionCheckForNewVersion);
    menu.add(fInstallPlugin);
    menu.add(new Separator());
    menu.add(fActionResetApplication);
    menu.add(new Separator());
    menu.add(fActionShowRelationsMatrix);
    /*
         * On a Mac, there is an "About" menu item under the application menu bar.
         */
    if (!PlatformUtils.isMac()) {
        ActionContributionItem item = new ActionContributionItem(fActionAbout);
        menu.add(new Separator());
        menu.add(item);
    }
    return menu;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) 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 47 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class AbstractDiagramEditorActionBarContributor method createViewMenu.

/**
 * Create the "View" Menu
 */
protected IMenuManager createViewMenu(IMenuManager menuManager) {
    IMenuManager viewMenu = new MenuManager(Messages.AbstractDiagramEditorActionBarContributor_4);
    viewMenu.add(getAction(GEFActionConstants.ZOOM_IN));
    viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT));
    viewMenu.add(getAction(ZoomNormalAction.ID));
    viewMenu.add(new Separator());
    viewMenu.add(getAction(SnapToGrid.PROPERTY_GRID_ENABLED));
    viewMenu.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY));
    viewMenu.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY));
    // viewMenu.add(getAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY));
    viewMenu.add(new Separator());
    // $NON-NLS-1$
    IMenuManager orderMenu = new MenuManager(Messages.AbstractDiagramEditorActionBarContributor_5, "menu_order");
    viewMenu.add(orderMenu);
    orderMenu.add(getAction(BringToFrontAction.ID));
    orderMenu.add(getAction(BringForwardAction.ID));
    orderMenu.add(getAction(SendToBackAction.ID));
    orderMenu.add(getAction(SendBackwardAction.ID));
    viewMenu.add(new GroupMarker(GROUP_POSITION));
    // $NON-NLS-1$
    IMenuManager alignmentMenu = new MenuManager(Messages.AbstractDiagramEditorActionBarContributor_6, "menu_position");
    viewMenu.add(alignmentMenu);
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_LEFT));
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_CENTER));
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_RIGHT));
    alignmentMenu.add(new Separator());
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_TOP));
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_MIDDLE));
    alignmentMenu.add(getAction(GEFActionConstants.ALIGN_BOTTOM));
    alignmentMenu.add(new Separator());
    alignmentMenu.add(getAction(GEFActionConstants.MATCH_WIDTH));
    alignmentMenu.add(getAction(GEFActionConstants.MATCH_HEIGHT));
    alignmentMenu.add(new Separator());
    alignmentMenu.add(getAction(DefaultEditPartSizeAction.ID));
    viewMenu.add(new Separator(GROUP_CONNECTIONS));
    // $NON-NLS-1$
    IMenuManager connectionMenu = new MenuManager(Messages.AbstractDiagramEditorActionBarContributor_7, "menu_connection_router");
    viewMenu.add(connectionMenu);
    connectionMenu.add(getAction(ConnectionRouterAction.BendPointConnectionRouterAction.ID));
    // Doesn't work with Connection to Connection
    // connectionMenu.add(getAction(ConnectionRouterAction.ShortestPathConnectionRouterAction.ID));
    connectionMenu.add(getAction(ConnectionRouterAction.ManhattanConnectionRouterAction.ID));
    viewMenu.add(new Separator());
    if (!PlatformUtils.isMac()) {
        viewMenu.add(getAction(FullScreenAction.ID));
        viewMenu.add(new Separator());
    }
    menuManager.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu);
    return viewMenu;
}
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)

Example 48 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class ArchimateDiagramEditor method registerContextMenu.

/**
 * Set up and register the context menu
 */
@Override
protected void registerContextMenu(GraphicalViewer viewer) {
    MenuManager provider = new ArchimateDiagramEditorContextMenuProvider(viewer, getActionRegistry());
    viewer.setContextMenu(provider);
    getSite().registerContextMenu(ArchimateDiagramEditorContextMenuProvider.ID, provider, viewer);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager)

Example 49 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class ArchimateDiagramEditorActionBarContributor method contributeToEditMenu.

@Override
protected IMenuManager contributeToEditMenu(IMenuManager menuManager) {
    IMenuManager editMenu = super.contributeToEditMenu(menuManager);
    // Text Positions
    IMenuManager textPositionMenu = new MenuManager(Messages.ArchimateDiagramEditorActionBarContributor_1);
    for (String id : TextPositionAction.ACTION_IDS) {
        textPositionMenu.add(getAction(id));
    }
    editMenu.appendToGroup(GROUP_EDIT_MENU, textPositionMenu);
    editMenu.insertAfter(ArchiActionFactory.DELETE.getId(), new GroupMarker(editDeleteMenuGroup));
    editMenu.appendToGroup(editDeleteMenuGroup, getAction(DeleteFromModelAction.ID));
    return editMenu;
}
Also used : IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 50 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class ArchimateDiagramEditorContextMenuProvider method buildContextMenu.

/**
 * @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
 */
@Override
public void buildContextMenu(IMenuManager menu) {
    super.buildContextMenu(menu);
    // Delete from Model
    menu.appendToGroup(GROUP_EDIT, actionRegistry.getAction(DeleteFromModelAction.ID));
    // Select Element in Tree
    menu.appendToGroup(GROUP_RENAME, new Separator());
    menu.appendToGroup(GROUP_RENAME, actionRegistry.getAction(SelectElementInTreeAction.ID));
    // Generate View For Element
    menu.appendToGroup(GROUP_RENAME, actionRegistry.getAction(ArchiActionFactory.GENERATE_VIEW.getId()));
    // Viewpoints
    menu.appendToGroup(GROUP_CONNECTIONS, new Separator(GROUP_VIEWPOINTS));
    IMenuManager viewPointMenu = new MenuManager(Messages.ArchimateDiagramEditorContextMenuProvider_0);
    menu.appendToGroup(GROUP_VIEWPOINTS, viewPointMenu);
    for (IViewpoint viewPoint : ViewpointManager.INSTANCE.getAllViewpoints()) {
        viewPointMenu.add(actionRegistry.getAction(viewPoint.toString()));
    }
}
Also used : IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IViewpoint(com.archimatetool.model.viewpoints.IViewpoint) Separator(org.eclipse.jface.action.Separator)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)657 IMenuManager (org.eclipse.jface.action.IMenuManager)498 Menu (org.eclipse.swt.widgets.Menu)303 IMenuListener (org.eclipse.jface.action.IMenuListener)246 Separator (org.eclipse.jface.action.Separator)220 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)65 Point (org.eclipse.swt.graphics.Point)63 Action (org.eclipse.jface.action.Action)55 Composite (org.eclipse.swt.widgets.Composite)49 IAction (org.eclipse.jface.action.IAction)48 SelectionEvent (org.eclipse.swt.events.SelectionEvent)44 GridData (org.eclipse.swt.layout.GridData)44 GroupMarker (org.eclipse.jface.action.GroupMarker)43 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)43 Transfer (org.eclipse.swt.dnd.Transfer)35 GridLayout (org.eclipse.swt.layout.GridLayout)32 List (java.util.List)30 EditingDomainViewerDropAdapter (org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)30 LocalTransfer (org.eclipse.emf.edit.ui.dnd.LocalTransfer)30 ViewerDragAdapter (org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter)30