Search in sources :

Example 11 with ActionGroup

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

the class ProcessExplorerActionGroup method createImportActionGroup.

private ActionGroup createImportActionGroup() {
    importMenu = new MenuManager("Import", MdwPlugin.getImageDescriptor("icons/import.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            importMenu.removeAll();
            IStructuredSelection selection = getSelection();
            WorkflowElement element = (WorkflowElement) selection.getFirstElement();
            if (!importMenuApplies(selection))
                return;
            if (importProjectApplies())
                importMenu.add(importProjectAction);
            if (importPackageApplies(selection))
                importMenu.add(importPackageAction);
            if (importVcsApplies(selection))
                importMenu.add(importVcsAction);
            if (importProcessApplies(selection)) {
                if (element instanceof WorkflowProcess) {
                    importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.process.version");
                    importProcessAction.setText("New Process Version...");
                } else {
                    importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.process");
                    importProcessAction.setText(PROCESS_DOT);
                }
                importMenu.add(importProcessAction);
            }
            if (importWorkflowAssetApplies(selection)) {
                if (element instanceof WorkflowAsset) {
                    WorkflowAsset asset = (WorkflowAsset) element;
                    // menu item text and icon are dynamic
                    importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.asset.version");
                    importWorkflowAssetAction.setText("New " + asset.getTitle() + " Version...");
                    importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICONS + asset.getIcon()));
                } else {
                    importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.asset");
                    importWorkflowAssetAction.setText("Asset...");
                    importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICON_DOC_GIF));
                }
                importMenu.add(importWorkflowAssetAction);
            }
            if (importAttributesApplies(selection)) {
                List<IAction> importAttrsActions = getImportAttributeActions(selection);
                if (!importAttrsActions.isEmpty()) {
                    MenuManager attributesMenu = new MenuManager("Attributes", MdwPlugin.getImageDescriptor("icons/attribute.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import.attributes");
                    attributesMenu.removeAll();
                    for (IAction action : importAttrsActions) attributesMenu.add(action);
                    importMenu.add(attributesMenu);
                }
            }
            if (importTaskTemplateApplies(selection))
                importMenu.add(importTaskTemplateAction);
            importMenu.add(new Separator(OTHER));
            IWorkbenchAction otherAction = ActionFactory.IMPORT.create(getViewSite().getWorkbenchWindow());
            otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.other");
            otherAction.setText(OTHER_DOT);
            importMenu.add(otherAction);
        }
    };
}
Also used : IAction(org.eclipse.jface.action.IAction) 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) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) Separator(org.eclipse.jface.action.Separator)

Example 12 with ActionGroup

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

the class ProcessExplorerActionGroup method createWebActionGroup.

private ActionGroup createWebActionGroup() {
    webMenu = new MenuManager("Web", MdwPlugin.getImageDescriptor("icons/webtools.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.web");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            webMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (webLaunchApplies(selection) && selection.getFirstElement() instanceof WorkflowElement) {
                if (((WorkflowElement) selection.getFirstElement()).getProject().checkRequiredVersion(5, 5)) {
                    webMenu.add(mdwHubAction);
                } else {
                    webMenu.add(taskManagerAction);
                    webMenu.add(webToolsAction);
                }
            }
        }
    };
}
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) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 13 with ActionGroup

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

the class AutomatedTestActionGroup method createFormatActionGroup.

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

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

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