Search in sources :

Example 11 with WorkflowElement

use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createDebugAction.

private IAction createDebugAction() {
    IAction action = new Action() {

        @Override
        public void run() {
            if (!debugApplies(getSelection()))
                return;
            view.setFocus();
            Object element = getSelection().getFirstElement();
            if (element instanceof AutomatedTestSuite || element instanceof AutomatedTestCase)
                actionHandler.debugTest(getSelection());
            else
                actionHandler.debug((WorkflowElement) element);
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/debug.gif");
    action.setImageDescriptor(imageDesc);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "debug");
    action.setText("Debug...");
    return action;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 12 with WorkflowElement

use of com.centurylink.mdw.plugin.designer.model.WorkflowElement 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 13 with WorkflowElement

use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method importTaskTemplateApplies.

public boolean importTaskTemplateApplies(IStructuredSelection selection) {
    if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
        return false;
    WorkflowElement element = (WorkflowElement) selection.getFirstElement();
    if (element.isArchived() || !element.getProject().isFilePersist())
        return false;
    if (!(element instanceof WorkflowPackage))
        return false;
    WorkflowPackage pkg = (WorkflowPackage) element;
    return !pkg.isDefaultPackage() && pkg.isUserAuthorized(UserRoleVO.ASSET_DESIGN);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 14 with WorkflowElement

use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method getImportAttributeActions.

private List<IAction> getImportAttributeActions(IStructuredSelection selection) {
    List<IAction> importAttributesActions = new ArrayList<>();
    if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
        // bam
        IAction action = new Action() {

            @Override
            public void run() {
                if (!importAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.importAttributes(WorkAttributeConstant.BAM_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.monitoring");
        action.setText("Monitoring...");
        importAttributesActions.add(action);
        // simulation
        action = new Action() {

            @Override
            public void run() {
                if (!importAttributesApplies(getSelection()))
                    return;
                view.setFocus();
                actionHandler.importAttributes(WorkAttributeConstant.SIMULATION_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
            }
        };
        action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.simulation");
        action.setText("Simulation...");
        importAttributesActions.add(action);
        // pagelet-driven attributes
        WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
        List<PageletTab> pageletTabs = project.getPageletTabs();
        if (pageletTabs != null) {
            for (PageletTab pageletTab : pageletTabs) {
                final String prefix = pageletTab.getOverrideAttributePrefix();
                action = new Action() {

                    @Override
                    public void run() {
                        if (!importAttributesApplies(getSelection()))
                            return;
                        view.setFocus();
                        actionHandler.importAttributes(prefix, (WorkflowElement) getSelection().getFirstElement());
                    }
                };
                action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.attributes." + prefix);
                action.setText(pageletTab.getLabel() + "...");
                importAttributesActions.add(action);
            }
        }
    }
    return importAttributesActions;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ArrayList(java.util.ArrayList) PageletTab(com.centurylink.mdw.plugin.designer.properties.PageletTab) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 15 with WorkflowElement

use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createFormatLoadTestResultsAction.

private IAction createFormatLoadTestResultsAction() {
    IAction action = new Action() {

        @Override
        public void run() {
            if (formatLoadTestResultsApplies(getSelection())) {
                WorkflowElement element = (WorkflowElement) getSelection().getFirstElement();
                actionHandler.formatResults(element.getProject(), AutomatedTestCase.LOAD_TEST);
            }
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/load_test.gif");
    action.setImageDescriptor(imageDesc);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "format.load.test.results");
    action.setText("Load Test Results");
    return action;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Aggregations

WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)65 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)25 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)25 IAction (org.eclipse.jface.action.IAction)22 Action (org.eclipse.jface.action.Action)21 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)21 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)19 ArrayList (java.util.ArrayList)17 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)14 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)11 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 IFile (org.eclipse.core.resources.IFile)8 AutomatedTestSuite (com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)7 Folder (com.centurylink.mdw.plugin.designer.model.Folder)7 LegacyExpectedResults (com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults)7 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)7 PartInitException (org.eclipse.ui.PartInitException)7 AutomatedTestResults (com.centurylink.mdw.plugin.designer.model.AutomatedTestResults)5 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)5