Search in sources :

Example 6 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createServerActionGroup.

private ActionGroup createServerActionGroup() {
    serverMenu = new MenuManager("Server", MdwPlugin.getImageDescriptor("icons/server.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.server");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            serverMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (serverActionApplies(selection)) {
                WorkflowProject project = (WorkflowProject) selection.getFirstElement();
                if (project.isUserAuthorizedForSystemAdmin())
                    serverMenu.add(refreshCachesAction);
                if (!project.isRemote() || project.isUserAuthorizedForSystemAdmin()) {
                    stubServerAction.setChecked(project.getDesignerProxy().isStubServerRunning());
                    serverMenu.add(stubServerAction);
                    logWatcherAction.setChecked(DesignerProxy.isLogWatcherRunning());
                    serverMenu.add(logWatcherAction);
                }
                if (!MdwPlugin.isRcp()) {
                    if (!serverMenu.isEmpty())
                        serverMenu.add(new Separator("VM"));
                    serverMenu.add(visualVmAction);
                    serverMenu.add(jconsoleAction);
                }
            }
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 7 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createNewActionGroup.

private ActionGroup createNewActionGroup() {
    newMenu = new MenuManager("New", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            newMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (!newMenuApplies(selection))
                return;
            if (!MdwPlugin.isRcp())
                newMenu.add(newCloudProjectAction);
            if (createApplies(WorkflowProject.class, selection))
                newMenu.add(newRemoteProjectAction);
            newMenu.add(new Separator());
            if (createApplies(WorkflowPackage.class, selection))
                newMenu.add(newPackageAction);
            if (createApplies(WorkflowProcess.class, selection))
                newMenu.add(newProcessAction);
            newMenu.add(new Separator());
            if (createApplies(Activity.class, selection)) {
                MenuManager activityMenu = new MenuManager("Activity", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.activity");
                activityMenu.add(newGeneralActivityAction);
                activityMenu.add(newStartActivityAction);
                activityMenu.add(newAdapterActivityAction);
                activityMenu.add(newEvaluatorActivityAction);
                newMenu.add(activityMenu);
            }
            if (createApplies(ExternalEvent.class, selection)) {
                MenuManager eventHandlerMenu = new MenuManager("Event Handler", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.event.handler");
                eventHandlerMenu.add(newEventHandlerAction);
                eventHandlerMenu.add(newCamelProcessHandlerAction);
                eventHandlerMenu.add(newCamelNotifyHandlerAction);
                newMenu.add(eventHandlerMenu);
            }
            newMenu.add(new Separator());
            if (createApplies(WorkflowAsset.class, selection)) {
                newMenu.add(new Separator());
                newMenu.add(newCamelRouteAction);
                newMenu.add(newJarFileAction);
                newMenu.add(newJavaSourceAction);
                newMenu.add(newJsonAction);
                newMenu.add(newKotlinAction);
                newMenu.add(newPageAction);
                newMenu.add(newReportAction);
                newMenu.add(newRuleAction);
                newMenu.add(newScriptAction);
                newMenu.add(newSpringConfigAction);
                if (selection.getFirstElement() instanceof WorkflowElement && ((WorkflowElement) selection.getFirstElement()).getProject().isFilePersist())
                    newMenu.add(newTaskTemplateAction);
                newMenu.add(newTemplateAction);
                newMenu.add(newTestCaseAction);
                newMenu.add(newTextResourceAction);
                newMenu.add(newWebResourceAction);
                newMenu.add(newWordDocAction);
                newMenu.add(newXmlDocAction);
                newMenu.add(newYamlAction);
                newMenu.add(newKotlinAction);
                newMenu.add(new Separator());
            }
            newMenu.add(new Separator(OTHER));
            IWorkbenchAction otherAction = ActionFactory.NEW.create(getViewSite().getWorkbenchWindow());
            otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "new.other");
            otherAction.setText(OTHER_DOT);
            newMenu.add(otherAction);
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 8 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createFormatActionGroup.

private ActionGroup createFormatActionGroup() {
    formatMenu = new MenuManager("Format", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.format");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            formatMenu.removeAll();
            IStructuredSelection selection = getSelection();
            WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
            if (formatFunctionTestResultsApplies(selection))
                formatMenu.add(formatFunctionTestResultsAction);
            java.io.File resultsFile = project.getFunctionTestResultsFile();
            formatFunctionTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
            if (formatLoadTestResultsApplies(selection))
                formatMenu.add(formatLoadTestResultsAction);
            resultsFile = project.getLoadTestResultsFile();
            formatLoadTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 9 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project erlide_eclipse by erlang.

the class ErlangOutlinePage method createControl.

@Override
public void createControl(final Composite parent) {
    final Tree tree = new Tree(parent, SWT.MULTI);
    fOutlineViewer = new TreeViewer(tree);
    fOutlineViewer.setAutoExpandLevel(0);
    fOutlineViewer.setUseHashlookup(true);
    fOutlineViewer.setContentProvider(fEditor.createOutlineContentProvider());
    fOutlineViewer.setLabelProvider(fEditor.createOutlineLabelProvider());
    fOutlineViewer.addPostSelectionChangedListener(this);
    fOutlineViewer.setInput(fModule);
    final IPageSite site = getSite();
    fOpenAndLinkWithEditorHelper = new OpenAndLinkWithEditorHelper(fOutlineViewer, fEditor, site.getPage());
    final IContextService service = site.getService(IContextService.class);
    if (service != null) {
        service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
    }
    final MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(final IMenuManager m) {
            // recursive loop?
            // menuAboutToShow(m);
            contextMenuAboutToShow(m);
        }
    });
    final Menu menu = manager.createContextMenu(tree);
    tree.setMenu(menu);
    site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager, fOutlineViewer);
    fActionGroups = new CompositeActionGroup(new ActionGroup[] { new ErlangSearchActionGroup(this) });
    // register global actions
    final IActionBars actionBars = site.getActionBars();
    actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, fEditor.getAction(ITextEditorActionConstants.UNDO));
    actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, fEditor.getAction(ITextEditorActionConstants.REDO));
    fActionGroups.fillActionBars(actionBars);
    registerToolbarActions(actionBars);
    final IHandlerService handlerService = site.getService(IHandlerService.class);
    if (handlerService != null) {
        handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction));
    }
    fPartListener = new IPartListener() {

        @Override
        public void partOpened(final IWorkbenchPart part) {
            // JC borde filter-metoden ovan r�cka?
            addFilters();
        }

        @Override
        public void partDeactivated(final IWorkbenchPart part) {
        }

        @Override
        public void partClosed(final IWorkbenchPart part) {
        }

        @Override
        public void partBroughtToTop(final IWorkbenchPart part) {
        }

        @Override
        public void partActivated(final IWorkbenchPart part) {
            addFilters();
        }
    };
    getSite().getPage().addPartListener(fPartListener);
}
Also used : CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IPartListener(org.eclipse.ui.IPartListener) IPageSite(org.eclipse.ui.part.IPageSite) IMenuListener(org.eclipse.jface.action.IMenuListener) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionGroup(org.eclipse.ui.actions.ActionGroup) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Tree(org.eclipse.swt.widgets.Tree) IContextService(org.eclipse.ui.contexts.IContextService) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) ActionHandler(org.eclipse.jface.commands.ActionHandler) IActionBars(org.eclipse.ui.IActionBars)

Example 10 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createRunActionGroup.

private ActionGroup createRunActionGroup() {
    runMenu = new MenuManager("Run", MdwPlugin.getImageDescriptor(ICON_RUN_GIF), MdwMenuManager.MDW_MENU_PREFIX + "menu.run");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            runMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (runOnServerApplies(selection))
                runMenu.add(runOnServerAction);
            if (runTestsApplies(selection))
                runMenu.add(runTestsAction);
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

ActionGroup (org.eclipse.ui.actions.ActionGroup)13 IMenuManager (org.eclipse.jface.action.IMenuManager)11 MenuManager (org.eclipse.jface.action.MenuManager)11 MdwMenuManager (com.centurylink.mdw.plugin.actions.MdwMenuManager)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)8 Separator (org.eclipse.jface.action.Separator)5 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)4 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)4 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)3 CompositeActionGroup (org.erlide.ui.actions.CompositeActionGroup)3 ErlangSearchActionGroup (org.erlide.ui.actions.ErlangSearchActionGroup)3 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)2 IAction (org.eclipse.jface.action.IAction)2 IActionBars (org.eclipse.ui.IActionBars)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 MdwSettings (com.centurylink.mdw.plugin.preferences.model.MdwSettings)1 File (java.io.File)1 CompositeActionGroup (org.eclipse.jdt.internal.ui.actions.CompositeActionGroup)1 SelectionProviderMediator (org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator)1 Action (org.eclipse.jface.action.Action)1