Search in sources :

Example 51 with WorkflowProcess

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

the class ProcessExplorerDragSource method isDragAllowed.

private boolean isDragAllowed(Object selectedElement) {
    boolean dragArchived = MdwPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREFS_ALLOW_DELETE_ARCHIVED_PROCESSES);
    if (selectedElement instanceof WorkflowProcess) {
        WorkflowProcess processVersion = (WorkflowProcess) selectedElement;
        IEditorPart editor = findOpenEditor(processVersion);
        if (editor != null) {
            String message = "'" + processVersion.getLabel() + "' is currently open in an editor.\nPlease save and close before dragging.";
            MessageDialog.openError(MdwPlugin.getShell(), "Process Explorer", message);
            return false;
        }
        return dragArchived || !processVersion.isArchived();
    } else if (selectedElement instanceof ExternalEvent) {
        ExternalEvent externalEvent = (ExternalEvent) selectedElement;
        return dragArchived || !externalEvent.isArchived();
    } else if (selectedElement instanceof ActivityImpl) {
        ActivityImpl activityImpl = (ActivityImpl) selectedElement;
        return dragArchived || !activityImpl.isArchived();
    } else if (selectedElement instanceof WorkflowAsset) {
        WorkflowAsset asset = (WorkflowAsset) selectedElement;
        IEditorPart tempFileEditor = asset.getFileEditor();
        if (tempFileEditor != null && findOpenEditor(tempFileEditor.getEditorInput()) != null) {
            String message = "'" + asset.getLabel() + "' is currently open in an editor.\nPlease save and close before dragging.";
            MessageDialog.openError(MdwPlugin.getShell(), "Process Explorer", message);
            return false;
        }
        return dragArchived || !asset.isArchived();
    }
    return false;
}
Also used : ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) IEditorPart(org.eclipse.ui.IEditorPart) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 52 with WorkflowProcess

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

the class ProcessExplorerDragSource method dragSetData.

@Override
public void dragSetData(DragSourceEvent event) {
    if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
        IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
        List<?> elements = selection.toList();
        StringBuilder data = new StringBuilder();
        for (int i = 0; i < elements.size(); i++) {
            Object element = elements.get(i);
            if (element instanceof WorkflowProcess || element instanceof ExternalEvent || element instanceof ActivityImpl || element instanceof WorkflowAsset) {
                data.append(element.toString());
                if (i < elements.size() - 1)
                    data.append("#");
            }
        }
        event.data = data.toString();
    }
}
Also used : ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 53 with WorkflowProcess

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

the class AutomatedTestActionGroup method createOpenProcessInstanceAction.

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

        public void run() {
            if (openProcessInstanceApplies(view.getSelectedItem())) {
                WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
                try {
                    Long procInstId = null;
                    if (view.getSelectedItem() instanceof AutomatedTestResults) {
                        AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
                        procInstId = expectedResults.getActualProcessInstanceId();
                    } else if (view.getSelectedItem() instanceof LegacyExpectedResults) {
                        LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
                        File resultsFile = expectedResult.getActualResultFile();
                        TestFile testFile = new TestFile(null, resultsFile.getPath());
                        testFile.load();
                        TestFileLine line1 = testFile.getLines().get(0);
                        procInstId = new Long(line1.getWord(3));
                    }
                    if (procInstId == null) {
                        MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
                        return;
                    }
                    ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
                    Long processId = procInst.getProcessId();
                    ProcessVO procVO = project.getProcess(processId).getProcessVO();
                    if (procVO == null)
                        PluginMessages.uiError("Unable to locate process: " + processId, "Open Process Instance", project);
                    WorkflowProcess instance = new WorkflowProcess(project, procVO);
                    instance.setProcessInstance(procInst);
                    actionHandler.open(instance);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, "Open Process Instance", project);
                }
            }
        }
    };
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance");
    action.setText("Open Process Instance");
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) TestFileLine(com.centurylink.mdw.designer.testing.TestFileLine) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) IOException(java.io.IOException) TestFile(com.centurylink.mdw.designer.testing.TestFile) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFile(org.eclipse.core.resources.IFile) TestFile(com.centurylink.mdw.designer.testing.TestFile) File(java.io.File) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 54 with WorkflowProcess

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

the class ProcessInstanceListView method createSelectionControls.

private void createSelectionControls(Composite parent) {
    new Label(parent, SWT.NONE).setText("Workflow Project:");
    projectCombo = new Combo(parent, SWT.DROP_DOWN);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 160;
    projectCombo.setLayoutData(gd);
    refreshProjects();
    projectCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String projectName = projectCombo.getText().trim();
            workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(projectName);
            processVersion = null;
            refreshProcesses();
            processCombo.select(0);
            refreshVersions();
            versionCombo.select(0);
            resetPageIndex();
            clearVariables();
            refreshTable();
        }
    });
    projectCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String project = projectCombo.getText().trim();
            if (project.length() > 0 && projectCombo.indexOf(project) == -1) {
                processVersion = null;
                refreshProcesses();
                processCombo.select(0);
                refreshVersions();
                versionCombo.select(0);
                resetPageIndex();
                clearVariables();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    new Label(parent, SWT.NONE).setText("Process:");
    processCombo = new Combo(parent, SWT.DROP_DOWN);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 160;
    processCombo.setLayoutData(gd);
    processCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String selected = processCombo.getText().trim();
            if (selected.length() == 0) {
                processVersion = null;
                refreshVersions();
                versionCombo.select(0);
            } else {
                ProcessVO processVO = workflowProject.getDesignerProxy().getLatestProcessVO(selected);
                processVersion = new WorkflowProcess(workflowProject, processVO);
                refreshVersions();
                versionCombo.select(1);
            }
            resetPageIndex();
            clearVariables();
            refreshTable();
        }
    });
    processCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String process = processCombo.getText().trim();
            if (process.length() > 0 && processCombo.indexOf(process) == -1) {
                processVersion = null;
                refreshVersions();
                versionCombo.select(0);
                resetPageIndex();
                clearVariables();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    new Label(parent, SWT.NONE).setText("Version:");
    versionCombo = new Combo(parent, SWT.DROP_DOWN);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 50;
    versionCombo.setLayoutData(gd);
    versionCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // clear out filter version
            if (contentProvider.getFilter() != null)
                contentProvider.getFilter().setProcess(null);
            String version = versionCombo.getText().trim();
            if (version.isEmpty() && processVersion.getId() == 0)
                // avoid re-retrieve
                return;
            processVersion = getProcessVersion(processVersion, version);
            resetPageIndex();
            refreshTable();
        }
    });
    versionCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String version = versionCombo.getText().trim();
            if (version.length() > 0 && versionCombo.indexOf(version) == -1) {
                processVersion = null;
                resetPageIndex();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    instanceCountLabel = new Label(parent, SWT.NONE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    instanceCountLabel.setLayoutData(gd);
    instanceCountLabel.setText("Showing: ");
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) Combo(org.eclipse.swt.widgets.Combo) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 55 with WorkflowProcess

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

the class ProcessInstanceListView method refreshVersions.

private void refreshVersions() {
    versionCombo.removeAll();
    versionCombo.add("");
    if (processVersion != null) {
        for (WorkflowProcess pv : processVersion.getAllProcessVersions()) {
            versionCombo.add(pv.getVersionString());
        }
        versionCombo.setText(processVersion.getVersionString());
    }
}
Also used : WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Aggregations

WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)85 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)28 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)21 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)21 PartInitException (org.eclipse.ui.PartInitException)20 ArrayList (java.util.ArrayList)17 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)15 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)12 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)11 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)11 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)10 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)9 IEditorPart (org.eclipse.ui.IEditorPart)9 ProcessEditor (com.centurylink.mdw.plugin.designer.editors.ProcessEditor)8 IFile (org.eclipse.core.resources.IFile)8 CoreException (org.eclipse.core.runtime.CoreException)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 IOException (java.io.IOException)7 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)6 Activity (com.centurylink.mdw.plugin.designer.model.Activity)6