Search in sources :

Example 1 with WorkflowElementActionHandler

use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.

the class ServerRunnerLaunchShortcut method launch.

public void launch(ISelection selection, String mode) {
    Object firstElement = ((StructuredSelection) selection).getFirstElement();
    IProject project = null;
    if (firstElement instanceof IProject)
        project = (IProject) firstElement;
    else if (firstElement instanceof IJavaProject)
        project = ((IJavaProject) firstElement).getProject();
    else
        throw new IllegalArgumentException("Unsupported selection: " + firstElement);
    WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
    WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
    actionHandler.run(workflowProject);
}
Also used : WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) IJavaProject(org.eclipse.jdt.core.IJavaProject) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject)

Example 2 with WorkflowElementActionHandler

use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.

the class TestCaseSection method drawWidgets.

public void drawWidgets(Composite composite, WorkflowElement selection) {
    testCase = (AutomatedTestCase) selection;
    testNameEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    testNameEditor.setLabel("Test Name");
    testNameEditor.setWidth(250);
    testNameEditor.render(composite);
    testNameEditor.setEditable(false);
    commandFileEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    commandFileEditor.setLabel("Command File");
    commandFileEditor.setWidth(600);
    commandFileEditor.render(composite);
    commandFileEditor.setEditable(false);
    commandEditEditor = new PropertyEditor(selection, PropertyEditor.TYPE_LINK);
    commandEditEditor.setLabel("Edit Command File");
    commandEditEditor.addValueChangeListener(new ValueChangeListener() {

        public void propertyValueChanged(Object newValue) {
            WorkflowElementActionHandler handler = new WorkflowElementActionHandler();
            handler.open(testCase);
        }
    });
    commandEditEditor.render(composite);
    statusEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    statusEditor.setLabel("Status");
    statusEditor.setWidth(250);
    statusEditor.render(composite);
    statusEditor.setEditable(false);
    startTimeEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    startTimeEditor.setLabel("Start Time");
    startTimeEditor.setWidth(110);
    startTimeEditor.render(composite);
    startTimeEditor.setEditable(false);
    endTimeEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    endTimeEditor.setLabel("End Time");
    endTimeEditor.setWidth(110);
    endTimeEditor.render(composite);
    endTimeEditor.setEditable(false);
    messageEditor = new PropertyEditor(selection, PropertyEditor.TYPE_TEXT);
    messageEditor.setLabel("Message");
    commandFileEditor.setWidth(600);
    messageEditor.render(composite);
    messageEditor.setEditable(false);
}
Also used : WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)

Example 3 with WorkflowElementActionHandler

use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.

the class ServiceMixServerBehavior method start.

public void start(boolean debug, IProgressMonitor monitor) throws CoreException {
    serverSettings = getServerSettings();
    if (serverSettings == null) {
        String msg = "Unable to find server settings for: " + getServer().getName() + ".\nCheck Runtime Environment and Server configurations.";
        showError(msg, "Launch " + getServer().getName());
        return;
    }
    if (debug) {
        // debugging only for this run
        serverSettings.setDebug(true);
        if (serverSettings.getDebugPort() == 0)
            serverSettings.setDebugPort(8500);
    }
    if (getServer().shouldPublish() && ServerCore.isAutoPublishing())
        getServer().publish(IServer.PUBLISH_CLEAN, monitor);
    // if (ServerRunner.isServerRunning())
    // return;
    setServerRestartState(false);
    setServerState(IServer.STATE_STARTING);
    setMode(debug ? "debug" : "run");
    MdwPlugin.getDisplay().asyncExec(new Runnable() {

        public void run() {
            try {
                WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
                actionHandler.run(serverSettings);
            } catch (Exception ex) {
                PluginMessages.uiError(ex, "Server Launch");
                setServerState(IServer.STATE_STOPPED);
                return;
            }
        }
    });
}
Also used : WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) CoreException(org.eclipse.core.runtime.CoreException)

Example 4 with WorkflowElementActionHandler

use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.

the class ServiceMixServerBehavior method stop.

@Override
public void stop(boolean force) {
    int state = getServer().getServerState();
    // stopped or stopping, no need to run stop command again
    if (state == IServer.STATE_STOPPED || state == IServer.STATE_STOPPING)
        return;
    setServerState(IServer.STATE_STOPPING);
    serverSettings = getServerSettings();
    if (serverSettings == null) {
        showError("Launch " + getServer().getName(), "Unable to find server settings for: " + getServer().getName());
        return;
    }
    MdwPlugin.getDisplay().asyncExec(new Runnable() {

        public void run() {
            try {
                WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
                actionHandler.stop(serverSettings);
            } catch (Exception ex) {
                PluginMessages.uiError(ex, "Server Launch");
            }
            setServerState(IServer.STATE_STOPPED);
        }
    });
}
Also used : WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) CoreException(org.eclipse.core.runtime.CoreException)

Example 5 with WorkflowElementActionHandler

use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.

the class WorkflowAssetVersionsSection method createContextMenu.

private Menu createContextMenu(Shell shell) {
    Menu menu = new Menu(shell, SWT.POP_UP);
    final StructuredSelection selection = (StructuredSelection) tableEditor.getTableViewer().getSelection();
    // open
    if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowAsset) {
        final WorkflowAsset asset = (WorkflowAsset) selection.getFirstElement();
        MenuItem openItem = new MenuItem(menu, SWT.PUSH);
        openItem.setText("Open");
        openItem.setImage(workflowAsset.getIconImage());
        openItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                openAsset(asset);
            }
        });
    }
    // view comments
    if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowAsset) {
        final WorkflowAsset asset = (WorkflowAsset) selection.getFirstElement();
        MenuItem viewCommentsItem = new MenuItem(menu, SWT.PUSH);
        viewCommentsItem.setText("View Comments");
        ImageDescriptor viewCommentsImageDesc = MdwPlugin.getImageDescriptor("icons/view.gif");
        viewCommentsItem.setImage(viewCommentsImageDesc.createImage());
        viewCommentsItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                openViewCommentsDialog(asset);
            }
        });
    }
    // delete
    if (!selection.isEmpty() && !workflowAsset.getProject().isProduction() && workflowAsset.isUserAuthorized(UserRoleVO.ASSET_DESIGN) && (selection.size() == 1 && ((WorkflowAsset) selection.getFirstElement()).isLatestVersion() || MdwPlugin.getSettings().isAllowDeleteArchivedProcesses())) {
        MenuItem deleteItem = new MenuItem(menu, SWT.PUSH);
        deleteItem.setText("Delete...");
        ImageDescriptor deleteImageDesc = MdwPlugin.getImageDescriptor("icons/delete.gif");
        deleteItem.setImage(deleteImageDesc.createImage());
        deleteItem.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (selection.size() >= 1 && selection.getFirstElement() instanceof WorkflowAsset) {
                    WorkflowAsset[] assets = new WorkflowAsset[selection.size()];
                    int idx = 0;
                    for (Iterator<?> iter = selection.iterator(); iter.hasNext(); ) {
                        assets[idx] = (WorkflowAsset) iter.next();
                        idx++;
                    }
                    WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
                    actionHandler.delete(assets);
                    boolean removedSelected = false;
                    for (WorkflowAsset a : assets) {
                        if (a.equals(workflowAsset))
                            removedSelected = true;
                    }
                    if (removedSelected) {
                        WorkflowAsset sel = null;
                        for (WorkflowAsset toSel : workflowAsset.getAllVersions()) {
                            if (!toSel.equals(workflowAsset)) {
                                sel = toSel;
                                break;
                            }
                        }
                        workflowAsset.fireElementChangeEvent(ChangeType.ELEMENT_DELETE, null);
                        setSelection(sel);
                    } else {
                        // just remove and refresh
                        for (WorkflowAsset a : assets) workflowAsset.getProject().removeWorkflowAsset(a);
                        setSelection(workflowAsset);
                    }
                }
            }
        });
    }
    return menu;
}
Also used : WorkflowElementActionHandler(com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Iterator(java.util.Iterator) MenuItem(org.eclipse.swt.widgets.MenuItem) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

WorkflowElementActionHandler (com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler)15 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)3 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)3 Menu (org.eclipse.swt.widgets.Menu)3 MenuItem (org.eclipse.swt.widgets.MenuItem)3 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)2 Iterator (java.util.Iterator)2 CoreException (org.eclipse.core.runtime.CoreException)2 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)1 DocumentReference (com.centurylink.mdw.model.value.variable.DocumentReference)1 Activity (com.centurylink.mdw.plugin.designer.model.Activity)1 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)1 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)1 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)1 DocumentStorage (com.centurylink.mdw.plugin.designer.storage.DocumentStorage)1 StorageEditorInput (com.centurylink.mdw.plugin.designer.storage.StorageEditorInput)1