Search in sources :

Example 56 with MenuManager

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

the class NavigatorView method hookContextMenu.

/**
 * Hook into a right-click menu
 */
private void hookContextMenu() {
    // $NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#NavigatorViewPopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            fillContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(getViewer().getControl());
    getViewer().getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, getViewer());
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 57 with MenuManager

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

the class RelationshipsMatrixDialog method hookContextMenu.

@SuppressWarnings("unused")
private void hookContextMenu(final GridTableViewer viewer) {
    // $NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#GridPopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            final CellSelection selection = ((CellSelection) viewer.getSelection());
            if (!selection.isEmpty()) {
                manager.add(new // $NON-NLS-1$
                Action(// $NON-NLS-1$
                "Restore to default") {

                    @Override
                    public void run() {
                        for (Object element : selection.toArray()) {
                            EClass eClassRow = (EClass) element;
                            for (Object o : selection.getIndices(element)) {
                                int columnIndex = (Integer) o;
                                EClass eClassColumn = getData().get(columnIndex);
                                restoreDefaultValue(eClassRow, eClassColumn);
                            }
                        }
                    }
                });
            }
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
}
Also used : Action(org.eclipse.jface.action.Action) EClass(org.eclipse.emf.ecore.EClass) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) CellSelection(org.eclipse.nebula.jface.gridviewer.internal.CellSelection) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IMenuListener(org.eclipse.jface.action.IMenuListener) Point(org.eclipse.swt.graphics.Point)

Example 58 with MenuManager

use of org.eclipse.jface.action.MenuManager in project xtext-eclipse by eclipse.

the class EmbeddedEditorActions method initialize.

protected void initialize() {
    final List<IHandlerActivation> handlerActivations = Lists.newArrayListWithExpectedSize(3);
    final IHandlerService handlerService = (IHandlerService) workbench.getAdapter(IHandlerService.class);
    final IContextService contextService = (IContextService) workbench.getAdapter(IContextService.class);
    Shell shell = viewer.getTextWidget().getShell();
    final ActiveShellExpression expression = new ActiveShellExpression(shell);
    final IContextActivation contextActivation = contextService.activateContext(EMBEDDED_TEXT_EDITOR_SCOPE, expression);
    shell.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            handlerService.deactivateHandlers(handlerActivations);
            contextService.deactivateContext(contextActivation);
        }
    });
    viewer.getTextWidget().addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            handlerService.deactivateHandlers(handlerActivations);
            handlerActivations.clear();
        }

        @Override
        public void focusGained(FocusEvent e) {
            for (final IAction action : allActions.values()) {
                handlerActivations.add(handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action), expression, true));
            }
        }
    });
    createActions();
    // create context menu
    MenuManager manager = new MenuManager(null, null);
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager mgr) {
            fillContextMenu(mgr);
        }
    });
    StyledText text = viewer.getTextWidget();
    Menu menu = manager.createContextMenu(text);
    text.setMenu(menu);
    List<ActionActivationCode> activationCodes = Lists.newArrayList();
    setActionActivationCode(activationCodes, ITextEditorActionConstants.SHIFT_RIGHT_TAB, '\t', -1, SWT.NONE);
    setActionActivationCode(activationCodes, ITextEditorActionConstants.SHIFT_LEFT, '\t', -1, SWT.SHIFT);
    viewer.getTextWidget().addVerifyKeyListener(new ActivationCodeTrigger(allActions, activationCodes));
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) StyledText(org.eclipse.swt.custom.StyledText) IAction(org.eclipse.jface.action.IAction) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) IMenuListener(org.eclipse.jface.action.IMenuListener) Shell(org.eclipse.swt.widgets.Shell) IHandlerService(org.eclipse.ui.handlers.IHandlerService) IContextActivation(org.eclipse.ui.contexts.IContextActivation) IHandlerActivation(org.eclipse.ui.handlers.IHandlerActivation) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IContextService(org.eclipse.ui.contexts.IContextService) ActiveShellExpression(org.eclipse.ui.ActiveShellExpression) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) FocusListener(org.eclipse.swt.events.FocusListener) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 59 with MenuManager

use of org.eclipse.jface.action.MenuManager in project cubrid-manager by CUBRID.

the class CubridMenuProvider method buildReplicationMenu.

/**
	 * Add replication related actions to menu manager
	 *
	 * @param parent the parent menu manager
	 */
private void buildReplicationMenu(IMenuManager parent) {
    IMenuManager manager = new MenuManager(Messages.menuReplication);
    parent.add(manager);
    addActionToManager(manager, getAction(ViewReplicationAction.ID));
    manager.add(new Separator());
    MenuManager masterMenu = new MenuManager(Messages.masterDbActionGroupName);
    manager.add(masterMenu);
    addActionToManager(masterMenu, getAction(StartReplicationServerAction.ID));
    addActionToManager(masterMenu, getAction(StopReplicationServerAction.ID));
    manager.add(new Separator());
    if (StartReplicationAgentAction.isSupportedNode(parent)) {
        addActionToManager(manager, getAction(StartReplicationAgentAction.ID));
    }
    if (StopReplicationAgentAction.isSupportedNode(parent)) {
        addActionToManager(manager, getAction(StopReplicationAgentAction.ID));
    }
    manager.add(new Separator());
    MenuManager slaveMenu = new MenuManager(Messages.slaveDbActionGroupName);
    manager.add(slaveMenu);
    if (StartSlaveDbAction.isSupportedNode(parent)) {
        addActionToManager(slaveMenu, getAction(StartSlaveDbAction.ID));
    }
    if (StopSlaveDbAction.isSupportedNode(parent)) {
        addActionToManager(slaveMenu, getAction(StopSlaveDbAction.ID));
    }
    manager.add(new Separator());
    addActionToManager(manager, getAction(ConfigureReplicationParamAction.ID));
    addActionToManager(manager, getAction(ChangeSlaveDbAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(MonitorReplicationPerfAction.ID));
    addActionToManager(manager, getAction(ViewReplicationErrorLogAction.ID));
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 60 with MenuManager

use of org.eclipse.jface.action.MenuManager in project cubrid-manager by CUBRID.

the class CubridMenuProvider method buildMenu.

/**
	 * Build the context menu and menubar menu according to the selected cubrid
	 * node
	 *
	 * @param manager the parent menu manager
	 * @param node the ICubridNode object
	 */
public void buildMenu(IMenuManager manager, ICubridNode node) {
    // fill Action Menu according to node type
    if (node == null) {
        LOGGER.error("ICubridNode is a null.");
        return;
    }
    String type = node.getType();
    if (CubridNodeType.SERVER.equals(type)) {
        addActionToManager(manager, getAction(HostDashboardAction.ID));
        addActionToManager(manager, getAction(ViewServerVersionAction.ID));
        //			#1 Disable the HA/Shard wizard
        //			if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
        //				manager.add(new Separator());
        //				addActionToManager(manager, getAction(EasyHAAction.ID));
        //			}
        //			#1 Disable the HA/Shard wizard
        //			if (node.getServer() != null
        //					&& node.getServer().getServerInfo() != null
        //					&& CompatibleUtil.isSupportShard(node.getServer().getServerInfo())) {
        //				manager.add(new Separator());
        //				addActionToManager(manager, getAction(AddShardAction.ID));
        //			}
        manager.add(new Separator());
        addActionToManager(manager, getAction(PropertyAction.ID));
        addActionToManager(manager, getAction(UnifyHostConfigAction.ID));
        IMenuManager configMenu = new MenuManager(Messages.confActionGroupName);
        manager.add(configMenu);
        addActionToManager(configMenu, getAction(EditCubridConfigAction.ID));
        addActionToManager(configMenu, getAction(ImportCubridConfigAction.ID));
        addActionToManager(configMenu, getAction(ExportCubridConfigAction.ID));
        configMenu.add(new Separator());
        addActionToManager(configMenu, getAction(EditBrokerConfigAction.ID));
        addActionToManager(configMenu, getAction(ImportBrokerConfigAction.ID));
        addActionToManager(configMenu, getAction(ExportBrokerConfigAction.ID));
        configMenu.add(new Separator());
        addActionToManager(configMenu, getAction(EditCmConfigAction.ID));
        addActionToManager(configMenu, getAction(ImportCmConfigAction.ID));
        addActionToManager(configMenu, getAction(ExportCmConfigAction.ID));
        if (CompatibleUtil.isSupportNewHAConfFile(node.getServer().getServerInfo())) {
            configMenu.add(new Separator());
            addActionToManager(configMenu, getAction(EditHAConfigAction.ID));
            addActionToManager(configMenu, getAction(ImportHAConfigAction.ID));
            addActionToManager(configMenu, getAction(ExportHAConfigAction.ID));
        }
        manager.add(new Separator());
    } else if (CubridNodeType.DATABASE_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(CreateDatabaseAction.ID));
        manager.add(new Separator());
        //			addActionToManager(manager, getAction(OpenSchemaEditorAction.ID));
        //			manager.add(new Separator());
        addActionToManager(manager, getAction(PropertyAction.ID));
        manager.add(new Separator());
    } else if (CubridNodeType.DATABASE.equals(type)) {
        buildDatabaseMenu(manager, node);
    } else if (CubridNodeType.USER_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddUserAction.ID));
    } else if (CubridNodeType.USER.equals(type)) {
        addActionToManager(manager, getAction(EditUserAction.ID));
        addActionToManager(manager, getAction(DeleteUserAction.ID));
    } else if (CubridNodeType.BACKUP_PLAN_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddBackupPlanAction.ID));
        addActionToManager(manager, getAction(BackupErrLogAction.ID));
    } else if (CubridNodeType.BACKUP_PLAN.equals(type)) {
        addActionToManager(manager, getAction(EditBackupPlanAction.ID));
        addActionToManager(manager, getAction(DeleteBackupPlanAction.ID));
    } else if (CubridNodeType.QUERY_PLAN_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddQueryPlanAction.ID));
        addActionToManager(manager, getAction(QueryLogAction.ID));
    } else if (CubridNodeType.QUERY_PLAN.equals(type)) {
        addActionToManager(manager, getAction(EditQueryPlanAction.ID));
        addActionToManager(manager, getAction(DeleteQueryPlanAction.ID));
    } else if (CubridNodeType.DBSPACE_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddVolumeAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(SetAutoAddVolumeAction.ID));
        addActionToManager(manager, getAction(AutoAddVolumeLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(DatabaseStatusViewAction.ID));
    } else if (CubridNodeType.GENERIC_VOLUME_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddVolumeAction.ID));
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.DATA_VOLUME_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddVolumeAction.ID));
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.INDEX_VOLUME_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddVolumeAction.ID));
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.TEMP_VOLUME_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(AddVolumeAction.ID));
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.ACTIVE_LOG_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.ARCHIVE_LOG_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(SpaceFolderViewAction.ID));
    } else if (CubridNodeType.GENERIC_VOLUME.equals(type)) {
        addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
    } else if (CubridNodeType.DATA_VOLUME.equals(type)) {
        addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
    } else if (CubridNodeType.INDEX_VOLUME.equals(type)) {
        addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
    } else if (CubridNodeType.TEMP_VOLUME.equals(type)) {
        addActionToManager(manager, getAction(SpaceInfoViewAction.ID));
    } else if (CubridNodeType.BROKER_FOLDER.equals(type)) {
        if (StartBrokerEnvAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StartBrokerEnvAction.ID));
        }
        if (StopBrokerEnvAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StopBrokerEnvAction.ID));
        }
        manager.add(new Separator());
        addActionToManager(manager, getAction(ShowBrokerEnvStatusAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(EditBrokerConfigAction.ID));
        addActionToManager(manager, getAction(PropertyAction.ID));
        manager.add(new Separator());
    } else if (CubridNodeType.BROKER.equals(type)) {
        if (StartBrokerAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StartBrokerAction.ID));
        }
        if (StopBrokerAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StopBrokerAction.ID));
        }
        if (RestartBrokerAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(RestartBrokerAction.ID));
        }
        manager.add(new Separator());
        addActionToManager(manager, getAction(ShowBrokerStatusAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(PropertyAction.ID));
        manager.add(new Separator());
    } else if (CubridNodeType.SHARD_FOLDER.equals(type)) {
        if (StartShardEnvAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StartShardEnvAction.ID));
        }
        if (StopShardEnvAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StopShardEnvAction.ID));
        }
        manager.add(new Separator());
        addActionToManager(manager, getAction(ShowShardStatusAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(PropertyAction.ID));
        manager.add(new Separator());
    } else if (CubridNodeType.SHARD.equals(type)) {
        if (StartShardAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StartShardAction.ID));
        }
        if (StopShardAction.isSupportedNode(node)) {
            addActionToManager(manager, getAction(StopShardAction.ID));
        }
        manager.add(new Separator());
        addActionToManager(manager, getAction(PropertyAction.ID));
    } else if (CubridNodeType.MONITOR_FOLDER.equals(type)) {
        //status monitor action
        if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
            addActionToManager(manager, getAction(AddMonitorInstanceAction.ID));
            manager.add(new Separator());
            addActionToManager(manager, getAction(ShowBrokerMonitorHistoryAction.ID));
            addActionToManager(manager, getAction(ShowDatabaseMonitorHistoryAction.ID));
        } else {
            addActionToManager(manager, getAction(AddStatusMonitorTemplateAction.ID));
        }
        //system monitor action
        if (CompatibleUtil.isSupportSystemMonitor(node.getServer().getServerInfo())) {
            manager.add(new Separator());
            addActionToManager(manager, getAction(ShowHostSystemMonitorHistoryAction.ID));
            addActionToManager(manager, getAction(ShowDbSystemMonitorHistoryAction.ID));
        }
        //monitor statistic action
        if (CompatibleUtil.isSupportMonitorStatistic(node.getServer().getServerInfo())) {
            manager.add(new Separator());
            addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
            addActionToManager(manager, getAction(CheckMonitorIntervalAction.ID));
        }
    /*} else if (CubridNodeType.STATUS_MONITOR_FOLDER.equals(type)) {
			if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
				addActionToManager(manager, getAction(AddMonitorInstanceAction.ID));
				manager.add(new Separator());
				addActionToManager(manager, getAction(ShowBrokerMonitorHistoryAction.ID));
				addActionToManager(manager, getAction(ShowDatabaseMonitorHistoryAction.ID));
			} else {
				addActionToManager(manager, getAction(AddStatusMonitorTemplateAction.ID));
			}
		} else if (CubridNodeType.MONITOR_STATISTIC_FOLDER.equals(type)) {
			addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
			addActionToManager(manager, getAction(CheckMonitorIntervalAction.ID));*/
    } else if (CubridNodeType.MONITOR_STATISTIC_PAGE.equals(type)) {
        addActionToManager(manager, getAction(OpenMonitorStatisticPageAction.ID));
        addActionToManager(manager, getAction(DeleteMonitorStatisticPageAction.ID));
        if (node.getParent() == null) {
            manager.add(new Separator());
            addActionToManager(manager, getAction(AddMonitorDashboardAction.ID));
            addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
        }
    } else if (CubridNodeType.STATUS_MONITOR_TEMPLATE.equals(type)) {
        addActionToManager(manager, getAction(ShowStatusMonitorAction.ID));
        if (CompatibleUtil.isSupportBrokerOrDBStatusMonitor(node.getServer().getServerInfo())) {
            if (!Messages.msgDbStatusMonitorName.equals(node.getLabel()) && !Messages.msgBrokerStatusMonitorName.equals(node.getLabel())) {
                addActionToManager(manager, getAction(EditMonitorInstanceAction.ID));
                addActionToManager(manager, getAction(DelMonitorInstanceAction.ID));
            }
        } else {
            manager.add(new Separator());
            addActionToManager(manager, getAction(EditStatusMonitorTemplateAction.ID));
            addActionToManager(manager, getAction(DeleteStatusMonitorTemplateAction.ID));
        }
    /*} else if (CubridNodeType.SYSTEM_MONITOR_FOLDER.equals(type)) {
			if (CompatibleUtil.isSupportSystemMonitor(node.getServer().getServerInfo())) {
				addActionToManager(manager, getAction(ShowHostSystemMonitorHistoryAction.ID));
				addActionToManager(manager, getAction(ShowDbSystemMonitorHistoryAction.ID));
			}*/
    } else if (CubridNodeType.SYSTEM_MONITOR_TEMPLATE.equals(type)) {
        addActionToManager(manager, getAction(ShowSystemMonitorAction.ID));
    } else if (CubridNodeType.LOGS_BROKER_ACCESS_LOG_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(RemoveAllAccessLogAction.ID));
    } else if (CubridNodeType.LOGS_BROKER_ACCESS_LOG.equals(type)) {
        addActionToManager(manager, getAction(LogViewAction.ID));
        addActionToManager(manager, getAction(RemoveLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(LogPropertyAction.ID));
    } else if (CubridNodeType.LOGS_BROKER_ERROR_LOG_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(RemoveAllErrorLogAction.ID));
    } else if (CubridNodeType.LOGS_BROKER_ERROR_LOG.equals(type)) {
        addActionToManager(manager, getAction(LogViewAction.ID));
        addActionToManager(manager, getAction(RemoveLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(LogPropertyAction.ID));
    } else if (CubridNodeType.LOGS_BROKER_ADMIN_LOG.equals(type)) {
        addActionToManager(manager, getAction(LogViewAction.ID));
        addActionToManager(manager, getAction(ResetAdminLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(LogPropertyAction.ID));
    } else if (CubridNodeType.BROKER_SQL_LOG_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(RemoveAllScriptLogAction.ID));
        addActionToManager(manager, getAction(AnalyzeSqlLogAction.ID));
    } else if (CubridNodeType.BROKER_SQL_LOG.equals(type)) {
        addActionToManager(manager, getAction(LogViewAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(AnalyzeSqlLogAction.ID));
        addActionToManager(manager, getAction(ExecuteSqlLogAction.ID));
        addActionToManager(manager, getAction(RemoveLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(LogPropertyAction.ID));
    } else if (CubridNodeType.LOGS_SERVER_DATABASE_LOG.equals(type)) {
        addActionToManager(manager, getAction(LogViewAction.ID));
        addActionToManager(manager, getAction(RemoveLogAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(LogPropertyAction.ID));
    } else if (CubridNodeType.LOGS_SERVER_DATABASE_FOLDER.equals(type)) {
        addActionToManager(manager, getAction(RemoveAllDbLogAction.ID));
    } else if (CubridNodeType.LOGS_MANAGER_ACCESS_LOG.equals(type) || CubridNodeType.LOGS_MANAGER_ERROR_LOG.equals(type)) {
        addActionToManager(manager, getAction(ManagerLogViewAction.ID));
        addActionToManager(manager, getAction(RemoveAllManagerLogAction.ID));
    } else if (CubridNodeType.MONITOR_DASHBOARD.equals(type)) {
        addActionToManager(manager, getAction(OpenMonitorDashboardAction.ID));
        addActionToManager(manager, getAction(EditMonitorDashboardAction.ID));
        addActionToManager(manager, getAction(DeleteMonitorDashboardAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(AddMonitorDashboardAction.ID));
        addActionToManager(manager, getAction(AddMonitorStatisticPageAction.ID));
        manager.add(new Separator());
    } else if (NodeType.GROUP.equals(type)) {
        addActionToManager(manager, getAction(ConnectHostAction.ID));
        manager.add(new Separator());
        addActionToManager(manager, getAction(AddHostAction.ID));
        manager.add(new Separator());
        super.buildMenu(manager, node);
    } else {
        super.buildMenu(manager, node);
    }
    // This menu hide if it hasn't any hidden menu node.
    if (node.isContainer() && ShowHiddenElementsAction.isSupportedNode(node)) {
        manager.add(new Separator());
        ActionManager.addActionToManager(manager, ActionManager.getInstance().getAction(ShowHiddenElementsAction.ID));
    }
    manager.update(true);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) 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