Search in sources :

Example 6 with WorkflowProcess

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

the class WorkflowElementActionHandler method exportAttributes.

public void exportAttributes(String attributePrefix, WorkflowElement element) {
    if (element instanceof WorkflowPackage || element instanceof WorkflowProcess) {
        ExportAttributesWizard exportAttributesWizard = new ExportAttributesWizard();
        exportAttributesWizard.init(getWorkbench(), element);
        exportAttributesWizard.setPrefix(attributePrefix);
        new WizardDialog(getShell(), exportAttributesWizard).open();
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ExportAttributesWizard(com.centurylink.mdw.plugin.designer.wizards.ExportAttributesWizard) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 7 with WorkflowProcess

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

the class MdwWorkbenchWindowAdvisor method postWindowOpen.

public void postWindowOpen() {
    IWorkbenchPage activePage = Activator.getActivePage();
    // check for updates
    // IHandlerService handlerService = (IHandlerService)
    // activePage.getWorkbenchWindow().getService(IHandlerService.class);
    // try
    // {
    // Object result =
    // handlerService.executeCommand("org.eclipse.equinox.p2.ui.sdk.update", null);
    // System.out.println("result: " + result);
    // if (result != null)
    // System.out.println("result class: " + result.getClass().getName());
    // }
    // catch (Exception ex)
    // {
    // ex.printStackTrace();
    // }
    PluginMessages.log("MDW workbench startup...");
    if (activePage != null) {
        activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.tools");
        activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.dev");
        activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.designerClassic");
        activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.navigation");
        activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.annotationNavigation");
        activePage.hideActionSet("org.eclipse.ui.externaltools.ExternalToolsSet");
        activePage.showActionSet("org.eclipse.search.menu");
        // make sure the process explorer view is visible
        try {
            ProcessExplorerView processExplorerView = (ProcessExplorerView) activePage.showView("mdw.views.designer.processes");
            if (mdwHost != null && mdwPort != null) {
                final Shell shell = activePage.getActivePart().getSite().getShell();
                BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {

                    public void run() {
                        try {
                            discoveryException = null;
                            projectToImport = getWorkflowProject(mdwHost, mdwPort, mdwContextRoot);
                            if (projectToImport == null)
                                throw new DiscoveryException("Unable to discover workflow app at: " + mdwHost + ":" + mdwPort);
                        } catch (DiscoveryException ex) {
                            discoveryException = ex;
                        }
                    }
                });
                if (discoveryException != null)
                    throw discoveryException;
                WorkflowProject existing = WorkflowProjectManager.getInstance().getRemoteWorkflowProject(projectToImport.getName());
                if (existing != null)
                    WorkflowProjectManager.getInstance().deleteProject(existing);
                ProgressMonitorDialog progMonDlg = new ProgressMonitorDialog(shell);
                ProjectInflator projectInflator = new ProjectInflator(projectToImport, null);
                projectInflator.inflateRemoteProject(progMonDlg);
                ProjectImporter projectImporter = new ProjectImporter(projectToImport);
                projectImporter.doImport();
                processExplorerView.handleRefresh();
                // handle preselected entity
                if (preselectType != null && preselectType.trim().length() > 0 && preselectId != null && preselectId.trim().length() > 0) {
                    if (!preselectType.equals(PRESELECT_PROCESS_INSTANCE))
                        throw new UnsupportedOperationException("Unsupported preselect type: " + preselectType);
                    BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {

                        public void run() {
                            // open the process instance
                            IWorkbenchPage page = MdwPlugin.getActivePage();
                            try {
                                WorkflowProcess instance = getProcessInstance(new Long(preselectId));
                                page.openEditor(instance, "mdw.editors.process");
                                page.showView("org.eclipse.ui.views.PropertySheet");
                            } catch (PartInitException ex) {
                                PluginMessages.uiError(ex, "Open Process Instance", projectToImport);
                            }
                        }
                    });
                }
            }
        } catch (Exception ex) {
            PluginMessages.uiError(ex, "Initialize Workspace");
        }
    }
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ProcessExplorerView(com.centurylink.mdw.plugin.designer.views.ProcessExplorerView) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) PartInitException(org.eclipse.ui.PartInitException) DiscoveryException(com.centurylink.mdw.plugin.designer.DiscoveryException) ProjectImporter(com.centurylink.mdw.plugin.project.assembly.ProjectImporter) Shell(org.eclipse.swt.widgets.Shell) ProjectInflator(com.centurylink.mdw.plugin.project.assembly.ProjectInflator) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) DiscoveryException(com.centurylink.mdw.plugin.designer.DiscoveryException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 8 with WorkflowProcess

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

the class MdwWorkbenchWindowAdvisor method getProcessInstance.

private WorkflowProcess getProcessInstance(Long processInstanceId) {
    PluginDataAccess dataAccess = projectToImport.getDataAccess();
    ProcessInstanceVO processInstanceInfo = dataAccess.getProcessInstance(processInstanceId);
    ProcessVO processVO = new ProcessVO();
    processVO.setProcessId(processInstanceInfo.getProcessId());
    processVO.setProcessName(processInstanceInfo.getProcessName());
    WorkflowProcess instanceVersion = new WorkflowProcess(projectToImport, processVO);
    instanceVersion.setProcessInstance(processInstanceInfo);
    return instanceVersion;
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) PluginDataAccess(com.centurylink.mdw.plugin.designer.PluginDataAccess)

Example 9 with WorkflowProcess

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

the class ProcessVersionsSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    process = (WorkflowProcess) selection;
    tableEditor = new TableEditor(process, TableEditor.TYPE_TABLE);
    List<ColumnSpec> columnSpecs = new ArrayList<ColumnSpec>();
    ColumnSpec packageColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Package", "package");
    packageColSpec.width = 160;
    columnSpecs.add(packageColSpec);
    ColumnSpec versionColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Version", "version");
    versionColSpec.width = 60;
    columnSpecs.add(versionColSpec);
    ColumnSpec idColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "ID", "id");
    idColSpec.width = 65;
    columnSpecs.add(idColSpec);
    ColumnSpec createDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Created", "createDate");
    createDateColSpec.width = 110;
    columnSpecs.add(createDateColSpec);
    ColumnSpec userColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "User", "user");
    userColSpec.width = 75;
    columnSpecs.add(userColSpec);
    ColumnSpec commentsColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Comments", "comments");
    commentsColSpec.width = 200;
    columnSpecs.add(commentsColSpec);
    ColumnSpec lockedToColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Locked To", "lockedTo");
    lockedToColSpec.width = 75;
    columnSpecs.add(lockedToColSpec);
    ColumnSpec modDateColSpec = new ColumnSpec(PropertyEditor.TYPE_TEXT, "Last Modified", "modDate");
    modDateColSpec.width = 110;
    columnSpecs.add(modDateColSpec);
    tableEditor.setColumnSpecs(columnSpecs);
    tableEditor.setReadOnly(true);
    tableEditor.setContentProvider(new ProcessVersionContentProvider());
    tableEditor.setLabelProvider(new ProcessVersionLabelProvider());
    tableEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            openProcess((WorkflowProcess) newValue);
        }
    });
    tableEditor.render(composite);
    // right-click menu
    tableEditor.getTable().addListener(SWT.MenuDetect, new Listener() {

        public void handleEvent(Event event) {
            tableEditor.getTable().setMenu(createContextMenu(tableEditor.getTable().getShell()));
        }
    });
}
Also used : ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) Listener(org.eclipse.swt.widgets.Listener) ElementChangeListener(com.centurylink.mdw.plugin.designer.model.ElementChangeListener) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) ArrayList(java.util.ArrayList) Event(org.eclipse.swt.widgets.Event) ElementChangeEvent(com.centurylink.mdw.plugin.designer.model.ElementChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 10 with WorkflowProcess

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

the class ArtifactEditor method openTempFile.

public void openTempFile(IProgressMonitor monitor) {
    tempFileEditor = null;
    try {
        IFolder folder = getTempFolder();
        if (!folder.exists())
            PluginUtil.createFoldersAsNeeded(getElement().getProject().getSourceProject(), folder, monitor);
        final IFile file = getTempFile(folder);
        final IWorkbenchPage activePage = MdwPlugin.getActivePage();
        if (file.exists()) {
            IEditorInput editorInput = new FileEditorInput(file);
            tempFileEditor = activePage.findEditor(editorInput);
            if (tempFileEditor == null) {
                // we'll refresh from attribute value
                new TempFileRemover(folder, file).remove(monitor);
            } else {
                // activate existing editor
                tempFileEditor = IDE.openEditor(activePage, file, true);
            }
        }
        if (tempFileEditor == null) {
            // either the file didn't exist or it was not currently open,
            // set from value
            byte[] value = valueProvider.getArtifactContent();
            if (value == null)
                value = "".getBytes();
            InputStream source = new ByteArrayInputStream(value);
            file.create(source, true, monitor);
            if (getElement().isReadOnly()) {
                ResourceAttributes resourceAttrs = file.getResourceAttributes();
                resourceAttrs.setReadOnly(true);
                file.setResourceAttributes(resourceAttrs);
            }
            final Display display = Display.getCurrent();
            if (display != null) {
                display.syncExec(new Runnable() {

                    public void run() {
                        try {
                            if (!valueProvider.beforeTempFileOpened())
                                return;
                            tempFileEditor = IDE.openEditor(activePage, file, true);
                            if (tempFileEditor != null) {
                                // listen for artifact made dirty and
                                // propagate to process canvas
                                tempFileEditor.addPropertyListener(new IPropertyListener() {

                                    public void propertyChanged(Object source, int propId) {
                                        if (source instanceof EditorPart && propId == IWorkbenchPartConstants.PROP_DIRTY) {
                                            if (((EditorPart) source).isDirty())
                                                // process
                                                fireValueChanged(null, true);
                                        // editor
                                        // should
                                        // show
                                        // dirty
                                        }
                                    }
                                });
                                // listen for artifact resource changes
                                ArtifactResourceListener resourceListener = new ArtifactResourceListener(getElement(), valueProvider, file);
                                getProject().addArtifactResourceListener(resourceListener);
                                // listen for workbench closed to prevent
                                // re-opening editor when the workbench is
                                // next opened
                                PlatformUI.getWorkbench().addWorkbenchListener(new ArtifactEditorWorkbenchListener(tempFileEditor));
                            }
                            valueProvider.afterTempFileOpened(tempFileEditor);
                        } catch (PartInitException ex) {
                            PluginMessages.log(ex);
                        }
                    }
                });
            }
            // register to listen to process editor events
            WorkflowProcess processVersion = null;
            if (getElement() instanceof Activity)
                processVersion = ((Activity) getElement()).getProcess();
            else if (getElement() instanceof WorkflowProcess)
                processVersion = (WorkflowProcess) getElement();
            if (processVersion != null) {
                IEditorPart processEditor = activePage.findEditor(processVersion);
                if (processEditor != null && tempFileEditor != null)
                    ((ProcessEditor) processEditor).addActiveScriptEditor(tempFileEditor);
            }
        }
    } catch (Exception ex) {
        PluginMessages.uiError(ex, "Open Temp File", getElement().getProject());
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Activity(com.centurylink.mdw.plugin.designer.model.Activity) IEditorPart(org.eclipse.ui.IEditorPart) EditorPart(org.eclipse.ui.part.EditorPart) ArtifactResourceListener(com.centurylink.mdw.plugin.workspace.ArtifactResourceListener) IEditorPart(org.eclipse.ui.IEditorPart) ResourceAttributes(org.eclipse.core.resources.ResourceAttributes) IPropertyListener(org.eclipse.ui.IPropertyListener) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) TempFileRemover(com.centurylink.mdw.plugin.workspace.TempFileRemover) ByteArrayInputStream(java.io.ByteArrayInputStream) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) IEditorInput(org.eclipse.ui.IEditorInput) IFolder(org.eclipse.core.resources.IFolder) Display(org.eclipse.swt.widgets.Display)

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