Search in sources :

Example 1 with ProcessSaveAsDialog

use of com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveAsDialog in project mdw-designer by CenturyLinkCloud.

the class ProcessCanvasWrapper method saveProcessAs.

public void saveProcessAs() {
    ProcessSaveAsDialog newProcessDialog = new ProcessSaveAsDialog(getParent().getShell(), getProcess());
    if (newProcessDialog.open() != Dialog.OK)
        // cancelled
        return;
    String newName = newProcessDialog.getNewName();
    WorkflowPackage newPkg = getProject().getDefaultPackage();
    if (!StringHelper.isEmpty(newProcessDialog.getPackageName()))
        newPkg = getProject().getPackage(newProcessDialog.getPackageName());
    flowchartPage.getProcess().blankOutTaskLogicalId();
    flowchartPage.getProcess().save_temp_vars();
    getDesignerProxy().saveProcessAs(getProcess(), newPkg, newName);
    WorkflowProcess newProc = getProject().getProcess(newName);
    if (newProc != null) {
        // update the process explorer tree
        newProc.sync();
        newProc.addElementChangeListener(getProject());
        newProc.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, newProc);
        // update the canvas editor
        openProcessDefinition(newProc);
        IWorkbenchPage page = MdwPlugin.getActivePage();
        if (page != null) {
            ProcessEditor processEditor = (ProcessEditor) page.findEditor(getProcess());
            if (processEditor != null)
                page.closeEditor(processEditor, false);
        }
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ProcessSaveAsDialog(com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveAsDialog) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessEditor(com.centurylink.mdw.plugin.designer.editors.ProcessEditor)

Aggregations

ProcessSaveAsDialog (com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveAsDialog)1 ProcessEditor (com.centurylink.mdw.plugin.designer.editors.ProcessEditor)1 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1