Search in sources :

Example 11 with Activity

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

the class ProcessesSection method select.

@Override
public boolean select(Object toTest) {
    if (toTest == null || !(toTest instanceof Activity))
        return false;
    Activity activity = (Activity) toTest;
    if (activity.isForProcessInstance())
        return false;
    PropertyEditorList propEditorList = new PropertyEditorList(activity);
    for (PropertyEditor propertyEditor : propEditorList) {
        // return true if any widgets specify PROCESSES section
        if (PropertyEditor.SECTION_PROCESSES.equals(propertyEditor.getSection()))
            return true;
    }
    return false;
}
Also used : PropertyEditorList(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList) Activity(com.centurylink.mdw.plugin.designer.model.Activity) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 12 with Activity

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

the class WorkflowAssetEditor method createWorkflowAsset.

@SuppressWarnings("restriction")
private WorkflowElement createWorkflowAsset() {
    if (isProcess()) {
        WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
        actionHandler.create(WorkflowProcess.class, getElement().getPackage());
        return null;
    } else {
        IWorkbench workbench = PlatformUI.getWorkbench();
        org.eclipse.ui.internal.dialogs.NewWizard wizard = new org.eclipse.ui.internal.dialogs.NewWizard();
        wizard.setCategoryId("mdw.designer.asset");
        wizard.init(workbench, new StructuredSelection(new Object[] { getElement().getPackage() }));
        IDialogSettings workbenchSettings = org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.getDefault().getDialogSettings();
        IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");
        if (wizardSettings == null)
            wizardSettings = workbenchSettings.addNewSection("NewWizardAction");
        wizardSettings.put("NewWizardSelectionPage.STORE_SELECTED_ID", getWizardId());
        wizard.setDialogSettings(wizardSettings);
        wizard.setForcePreviousAndNextButtons(true);
        if (isTaskTemplate() && getElement() instanceof Activity) {
            Activity activity = (Activity) getElement();
            if (activity.isAutoFormManualTask())
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.AUTOFORM);
            else
                wizardSettings.put(TaskTemplate.TASK_TYPE, TaskTemplate.CUSTOM);
        }
        WizardDialog dialog = new WizardDialog(null, wizard);
        dialog.create();
        dialog.open();
        IWizardPage wizardPage = dialog.getCurrentPage();
        if (wizardPage instanceof WorkflowAssetPage)
            return ((WorkflowAssetPage) wizardPage).getWorkflowAsset();
    }
    return null;
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Activity(com.centurylink.mdw.plugin.designer.model.Activity) WorkflowAssetPage(com.centurylink.mdw.plugin.designer.wizards.WorkflowAssetPage) WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) IWorkbench(org.eclipse.ui.IWorkbench) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 13 with Activity

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

the class WorkflowAssetEditor method updateVersionAttribute.

private void updateVersionAttribute(WorkflowElement workflowAsset) {
    AssetVersionSpec versionSpec = AssetVersionSpec.parse(workflowAsset.getLabel());
    String versionAttr = null;
    if (isProcess()) {
        if (getProject().checkRequiredVersion(5, 5) && !(getElement() instanceof Activity && ((Activity) getElement()).isOldMultipleSubProcInvoke())) {
            if (MdwPlugin.getSettings().isInferSmartSubprocVersionSpec())
                versionAttr = AssetVersionSpec.getDefaultSmartVersionSpec(versionSpec.getVersion());
            else
                versionAttr = versionSpec.getVersion();
        } else {
            // pre-5.5
            versionAttr = String.valueOf(((WorkflowProcess) workflowAsset).getVersion());
        // compatibility
        }
        getElement().setAttribute(WorkAttributeConstant.PROCESS_VERSION, versionAttr);
    } else if (// assets only save
    getProject().checkRequiredVersion(5, 5)) // version for 5.5
    {
        if (MdwPlugin.getSettings().isInferSmartSubprocVersionSpec())
            versionAttr = AssetVersionSpec.getDefaultSmartVersionSpec(versionSpec.getVersion());
        else
            versionAttr = versionSpec.getVersion();
        getElement().setAttribute(getAssetVersionAttributeName(), versionAttr);
    }
}
Also used : Activity(com.centurylink.mdw.plugin.designer.model.Activity) AssetVersionSpec(com.centurylink.mdw.model.value.attribute.AssetVersionSpec) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 14 with Activity

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

the class WorkflowElementActionHandler method run.

public void run(Object element) {
    if (element instanceof WorkflowProcess) {
        WorkflowProcess processVersion = (WorkflowProcess) element;
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Process Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        if (MdwPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREFS_WEB_BASED_PROCESS_LAUNCH)) {
            // web-based process launch
            try {
                IViewPart viewPart = getPage().showView("mdw.views.designer.process.launch");
                if (viewPart != null) {
                    ProcessLaunchView launchView = (ProcessLaunchView) viewPart;
                    launchView.setProcess(processVersion);
                }
            } catch (PartInitException ex) {
                PluginMessages.log(ex);
            }
        } else {
            if (editorPart == null) {
                // process must be open
                open((WorkflowElement) element);
            }
            ProcessLaunchShortcut launchShortcut = new ProcessLaunchShortcut();
            launchShortcut.launch(new StructuredSelection(processVersion), ILaunchManager.RUN_MODE);
        }
    } else if (element instanceof Activity) {
        Activity activity = (Activity) element;
        WorkflowProcess processVersion = activity.getProcess();
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Activity Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        ActivityLaunchShortcut launchShortcut = new ActivityLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(activity), ILaunchManager.RUN_MODE);
    } else if (element instanceof ExternalEvent) {
        ExternalEvent externalEvent = (ExternalEvent) element;
        ExternalEventLaunchShortcut launchShortcut = new ExternalEventLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(externalEvent), ILaunchManager.RUN_MODE);
    } else if (element instanceof Template) {
        Template template = (Template) element;
        IEditorPart editorPart = template.getFileEditor();
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Run Template", "Save template '" + template.getName() + "' before running?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        template.openFile(new NullProgressMonitor());
        new TemplateRunDialog(getShell(), template).open();
    } else if (element instanceof Page) {
        Page page = (Page) element;
        IEditorPart editorPart = page.getFileEditor();
        if (editorPart != null) {
            if (editorPart.isDirty()) {
                if (MessageDialog.openQuestion(getShell(), "Run Page", "Save page '" + page.getName() + "' before running?"))
                    editorPart.doSave(new NullProgressMonitor());
            }
        }
        page.run();
    } else if (element instanceof WorkflowProject || element instanceof ServerSettings) {
        ServerSettings serverSettings;
        if (element instanceof WorkflowProject) {
            WorkflowProject workflowProject = (WorkflowProject) element;
            if (workflowProject.isRemote())
                throw new IllegalArgumentException("Cannot run server for remote projects.");
            serverSettings = workflowProject.getServerSettings();
        } else {
            serverSettings = (ServerSettings) element;
        }
        if (ServerRunner.isServerRunning()) {
            String question = "A server may be running already.  Shut down the currently-running server?";
            MessageDialog dlg = new MessageDialog(getShell(), "Server Running", null, question, MessageDialog.QUESTION_WITH_CANCEL, new String[] { "Shutdown", "Ignore", "Cancel" }, 0);
            int res = dlg.open();
            if (res == 0)
                new ServerRunner(serverSettings, getShell().getDisplay()).stop();
            else if (res == 2)
                return;
        }
        if (serverSettings.getHome() == null && element instanceof WorkflowProject) {
            final IProject project = serverSettings.getProject().isCloudProject() ? serverSettings.getProject().getSourceProject() : serverSettings.getProject().getEarProject();
            @SuppressWarnings("restriction") org.eclipse.ui.internal.dialogs.PropertyDialog dialog = org.eclipse.ui.internal.dialogs.PropertyDialog.createDialogOn(getShell(), "mdw.workflow.mdwServerConnectionsPropertyPage", project);
            if (dialog != null)
                dialog.open();
        } else {
            IPreferenceStore prefStore = MdwPlugin.getDefault().getPreferenceStore();
            if (element instanceof WorkflowProject)
                prefStore.setValue(PreferenceConstants.PREFS_SERVER_WF_PROJECT, ((WorkflowProject) element).getName());
            else
                prefStore.setValue(PreferenceConstants.PREFS_RUNNING_SERVER, serverSettings.getServerName());
            ServerRunner runner = new ServerRunner(serverSettings, getShell().getDisplay());
            if (serverSettings.getProject() != null)
                runner.setJavaProject(serverSettings.getProject().getJavaProject());
            runner.start();
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IViewPart(org.eclipse.ui.IViewPart) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ExternalEventLaunchShortcut(com.centurylink.mdw.plugin.launch.ExternalEventLaunchShortcut) AdapterActivity(com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity) EvaluatorActivity(com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity) StartActivity(com.centurylink.mdw.plugin.designer.model.Activity.StartActivity) Activity(com.centurylink.mdw.plugin.designer.model.Activity) ActivityLaunchShortcut(com.centurylink.mdw.plugin.launch.ActivityLaunchShortcut) TemplateRunDialog(com.centurylink.mdw.plugin.designer.dialogs.TemplateRunDialog) SearchResultsPage(com.centurylink.mdw.plugin.search.SearchResultsPage) Page(com.centurylink.mdw.plugin.designer.model.Page) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Template(com.centurylink.mdw.plugin.designer.model.Template) TaskTemplate(com.centurylink.mdw.plugin.designer.model.TaskTemplate) ProcessLaunchShortcut(com.centurylink.mdw.plugin.launch.ProcessLaunchShortcut) ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) PartInitException(org.eclipse.ui.PartInitException) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IEditorPart(org.eclipse.ui.IEditorPart) IProject(org.eclipse.core.resources.IProject) ServerRunner(com.centurylink.mdw.plugin.server.ServerRunner) ProcessLaunchView(com.centurylink.mdw.plugin.designer.views.ProcessLaunchView) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 15 with Activity

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

the class WorkflowElementActionHandler method debug.

public void debug(Object element) {
    if (element instanceof WorkflowProcess) {
        WorkflowProcess processVersion = (WorkflowProcess) element;
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Process Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        if (editorPart == null) {
            // process must be open
            open(processVersion);
        }
        ProcessLaunchShortcut launchShortcut = new ProcessLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(processVersion), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof Activity) {
        Activity activity = (Activity) element;
        WorkflowProcess processVersion = activity.getProcess();
        IEditorPart editorPart = findOpenEditor(processVersion);
        if (editorPart != null && editorPart.isDirty()) {
            if (MessageDialog.openQuestion(getShell(), "Activity Launch", "Save process '" + processVersion.getLabel() + "' before launching?"))
                editorPart.doSave(new NullProgressMonitor());
        }
        ActivityLaunchShortcut launchShortcut = new ActivityLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(activity), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof ExternalEvent) {
        ExternalEvent externalEvent = (ExternalEvent) element;
        ExternalEventLaunchShortcut launchShortcut = new ExternalEventLaunchShortcut();
        launchShortcut.launch(new StructuredSelection(externalEvent), ILaunchManager.DEBUG_MODE);
    } else if (element instanceof WorkflowProject || element instanceof ServerSettings) {
        ServerSettings serverSettings;
        if (element instanceof WorkflowProject) {
            WorkflowProject workflowProject = (WorkflowProject) element;
            serverSettings = workflowProject.getServerSettings();
        } else {
            serverSettings = (ServerSettings) element;
        }
        serverSettings.setDebug(true);
        if (serverSettings.getDebugPort() == 0)
            serverSettings.setDebugPort(8500);
        run(serverSettings);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProcessLaunchShortcut(com.centurylink.mdw.plugin.launch.ProcessLaunchShortcut) ServerSettings(com.centurylink.mdw.plugin.project.model.ServerSettings) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ExternalEventLaunchShortcut(com.centurylink.mdw.plugin.launch.ExternalEventLaunchShortcut) AdapterActivity(com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity) EvaluatorActivity(com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity) StartActivity(com.centurylink.mdw.plugin.designer.model.Activity.StartActivity) Activity(com.centurylink.mdw.plugin.designer.model.Activity) ActivityLaunchShortcut(com.centurylink.mdw.plugin.launch.ActivityLaunchShortcut) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IEditorPart(org.eclipse.ui.IEditorPart) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Aggregations

Activity (com.centurylink.mdw.plugin.designer.model.Activity)17 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)7 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)6 PropertyEditorList (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditorList)6 IEditorPart (org.eclipse.ui.IEditorPart)4 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 PartInitException (org.eclipse.ui.PartInitException)3 Node (com.centurylink.mdw.designer.display.Node)2 TextNote (com.centurylink.mdw.designer.display.TextNote)2 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)2 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)2 AdapterActivity (com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity)2 EvaluatorActivity (com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity)2 StartActivity (com.centurylink.mdw.plugin.designer.model.Activity.StartActivity)2 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)2 EmbeddedSubProcess (com.centurylink.mdw.plugin.designer.model.EmbeddedSubProcess)2 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)2 Note (com.centurylink.mdw.plugin.designer.model.Note)2 ActivityLaunchShortcut (com.centurylink.mdw.plugin.launch.ActivityLaunchShortcut)2