Search in sources :

Example 26 with WorkflowProject

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

the class ProcessExplorerActionGroup method createWebToolsAction.

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

        @Override
        public void run() {
            if (webLaunchApplies(getSelection())) {
                if (getSelection().getFirstElement() instanceof WorkflowProject) {
                    WorkflowProject project = (WorkflowProject) getSelection().getFirstElement();
                    WebLaunchActions.getLaunchAction(project, WebApp.WebTools).launch(project);
                } else if (getSelection().getFirstElement() instanceof WorkflowPackage) {
                    WorkflowPackage pkg = (WorkflowPackage) getSelection().getFirstElement();
                    WebLaunchActions.getLaunchAction(pkg.getProject(), WebApp.WebTools).launch(pkg);
                }
            }
        }
    };
    WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(null, WebApp.WebTools);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "launch.web.tools");
    action.setText(launchAction.getLabel());
    action.setImageDescriptor(launchAction.getImageDescriptor());
    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) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) IAction(org.eclipse.jface.action.IAction) WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 27 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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 28 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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 29 with WorkflowProject

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

the class AutomatedTestLaunchShortcut method createLaunchConfiguration.

protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(WorkflowElement element, boolean debug) throws CoreException, JSONException {
    String testName = null;
    List<String> testCases = new ArrayList<>();
    WorkflowProject workflowProject = element.getProject();
    WorkflowPackage workflowPackage = null;
    boolean isLegacyLaunch = false;
    if (element instanceof WorkflowProject) {
        testName = workflowProject.getName();
        testCases = workflowProject.getTestCaseStringList();
    } else if (element instanceof WorkflowPackage) {
        workflowPackage = (WorkflowPackage) element;
        testName = workflowPackage.getName();
        testCases = workflowPackage.getTestCaseStringList();
    } else if (element instanceof AutomatedTestCase) {
        AutomatedTestCase testCase = (AutomatedTestCase) element;
        if (testCase.isLegacy()) {
            testName = workflowProject.getName() + LEGACY;
            isLegacyLaunch = true;
        } else {
            workflowPackage = testCase.getPackage();
            testName = workflowPackage.getName();
        }
        testCases = new ArrayList<>();
        if (testCase.isPostman() && testCase.getItems() != null && workflowPackage != null) {
            testCases.addAll(workflowPackage.getTestCaseItems(testCase));
        } else
            testCases.add(testCase.getPath());
    } else if (element instanceof AutomatedTestSuite) {
        testName = workflowProject.getName() + LEGACY;
        isLegacyLaunch = true;
        testCases = ((AutomatedTestSuite) element).getTestCaseStringList();
    }
    return createLaunchConfiguration(workflowProject, workflowPackage, isLegacyLaunch, testName, testCases, debug);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)

Example 30 with WorkflowProject

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

the class AutomatedTestLaunchShortcut method launch.

public void launch(IEditorPart editor, String mode) {
    if (editor.getEditorInput() instanceof IFileEditorInput) {
        IFileEditorInput fileEditorInput = (IFileEditorInput) editor.getEditorInput();
        IFile file = fileEditorInput.getFile();
        WorkflowProject project = WorkflowProjectManager.getInstance().getWorkflowProject(file.getProject());
        WorkflowPackage pkg = project.getPackage((IFolder) file.getParent());
        try {
            performLaunch(pkg.getAsset(file), mode);
        } catch (CoreException | JSONException ex) {
            PluginMessages.uiError(ex, "Test Exec", project);
        }
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) IFileEditorInput(org.eclipse.ui.IFileEditorInput) JSONException(org.json.JSONException) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Aggregations

WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)128 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)31 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)22 ArrayList (java.util.ArrayList)22 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 CoreException (org.eclipse.core.runtime.CoreException)19 Action (org.eclipse.jface.action.Action)19 IAction (org.eclipse.jface.action.IAction)18 IProject (org.eclipse.core.resources.IProject)17 IFile (org.eclipse.core.resources.IFile)16 PartInitException (org.eclipse.ui.PartInitException)16 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)12 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)11 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 IOException (java.io.IOException)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)9