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;
}
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();
}
}
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;
}
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: ");
}
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());
}
}
Aggregations