use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceListView method createContextMenu.
private Menu createContextMenu(Shell shell) {
Menu menu = new Menu(shell, SWT.POP_UP);
final StructuredSelection selection = (StructuredSelection) getTableViewer().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof ProcessInstanceVO) {
final ProcessInstanceVO processInstanceInfo = (ProcessInstanceVO) selection.getFirstElement();
// open instance
MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open");
ImageDescriptor openImageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
openItem.setImage(openImageDesc.createImage());
openItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleOpen(processInstanceInfo);
}
});
// owning document
if (OwnerType.DOCUMENT.equals(processInstanceInfo.getOwner()) || OwnerType.TESTER.equals(processInstanceInfo.getOwner())) {
MenuItem docItem = new MenuItem(menu, SWT.PUSH);
docItem.setText("View Owning Document");
ImageDescriptor docImageDesc = MdwPlugin.getImageDescriptor("icons/doc.gif");
docItem.setImage(docImageDesc.createImage());
docItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IStorage storage = new DocumentStorage(workflowProject, new DocumentReference(processInstanceInfo.getOwnerId(), null));
final IStorageEditorInput input = new StorageEditorInput(storage);
final IWorkbenchPage page = MdwPlugin.getActivePage();
if (page != null) {
BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
public void run() {
try {
page.openEditor(input, "org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "View Document", workflowProject);
}
}
});
}
}
});
}
// instance hierarchy
MenuItem hierarchyItem = new MenuItem(menu, SWT.PUSH);
hierarchyItem.setText("Instance Hierarchy");
ImageDescriptor hierarchyImageDesc = MdwPlugin.getImageDescriptor("icons/hierarchy.gif");
hierarchyItem.setImage(hierarchyImageDesc.createImage());
hierarchyItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WorkflowProcess pv = new WorkflowProcess(processVersion);
pv.setProcessVO(processVersion.getProcessVO());
pv.setProcessInstance(processInstanceInfo);
new WorkflowElementActionHandler().showHierarchy(pv);
}
});
}
// delete
if (!selection.isEmpty() && !processVersion.getProject().isProduction() && processVersion.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION)) {
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() {
@Override
public void widgetSelected(SelectionEvent e) {
if (selection.size() == 1 && selection.getFirstElement() instanceof ProcessInstanceVO) {
ProcessInstanceVO pii = (ProcessInstanceVO) selection.getFirstElement();
if (MessageDialog.openConfirm(getSite().getShell(), "Confirm Delete", "Delete process instance ID: " + pii.getId() + " for workflow project '" + processVersion.getProject().getName() + "'?")) {
List<ProcessInstanceVO> instances = new ArrayList<>();
instances.add((ProcessInstanceVO) selection.getFirstElement());
handleDelete(instances);
}
} else {
if (MessageDialog.openConfirm(getSite().getShell(), "Confirm Delete", "Delete selected process instances for workflow project '" + processVersion.getProject().getName() + "'?")) {
List<ProcessInstanceVO> instances = new ArrayList<>();
for (Object instance : selection.toArray()) {
if (instance instanceof ProcessInstanceVO)
instances.add((ProcessInstanceVO) instance);
}
handleDelete(instances);
}
}
}
});
}
return menu;
}
use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.
the class ToolboxView method handleDelete.
public void handleDelete() {
ActivityImpl activityImpl = getSelection();
if (activityImpl == null) {
MessageDialog.openWarning(getSite().getShell(), "No Selection", "Please select an Activity Implementor To Delete");
return;
}
if (isDirty()) {
MessageDialog.openWarning(getSite().getShell(), MSG_SAVE, "Please save or abandon outstanding changes before deleting");
return;
} else {
new WorkflowElementActionHandler().delete(new WorkflowElement[] { activityImpl });
toolboxWrapper.update();
dirtyStateChanged(false);
actionGroup.getDeleteAction().setEnabled(false);
}
}
use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.
the class ProcessVersionsSection method createContextMenu.
private Menu createContextMenu(Shell shell) {
Menu menu = new Menu(shell, SWT.POP_UP);
final StructuredSelection selection = (StructuredSelection) tableEditor.getTableViewer().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowProcess) {
final WorkflowProcess processVer = (WorkflowProcess) selection.getFirstElement();
MenuItem openItem = new MenuItem(menu, SWT.PUSH);
openItem.setText("Open");
ImageDescriptor openImageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
openItem.setImage(openImageDesc.createImage());
openItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
openProcess(processVer);
}
});
}
// delete
if (!selection.isEmpty() && !process.getProject().isProduction() && process.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION) && (selection.size() == 1 && ((WorkflowProcess) selection.getFirstElement()).isLatest()) || 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 WorkflowProcess) {
WorkflowProcess[] processVers = new WorkflowProcess[selection.size()];
int idx = 0;
for (Iterator<?> iter = selection.iterator(); iter.hasNext(); ) {
processVers[idx] = (WorkflowProcess) iter.next();
idx++;
}
WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
actionHandler.delete(processVers);
boolean removedSelected = false;
for (WorkflowProcess pv : processVers) {
if (pv.equals(process))
removedSelected = true;
else
process.remove(pv);
}
if (removedSelected) {
WorkflowProcess sel = null;
for (WorkflowProcess toSel : process.getAllProcessVersions()) {
if (!toSel.equals(process)) {
sel = toSel;
break;
}
}
setSelection(sel);
} else {
// just force refresh
setSelection(process);
}
}
}
});
}
return menu;
}
use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchMainTab method openProcess.
private void openProcess(WorkflowProcess processVersion) {
WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
actionHandler.open(processVersion);
}
use of com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler in project mdw-designer by CenturyLinkCloud.
the class ServerConnectionsPropertyPage method createServerStartupControls.
private void createServerStartupControls(Composite parent) {
Composite composite = createComposite(parent, 3);
GridData gd = null;
if (!workingCopy.isOsgi()) {
startServerButton = new Button(composite, SWT.PUSH);
gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = 2;
startServerButton.setLayoutData(gd);
startServerButton.setText("Start Server");
startServerButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// save settings to workflowProject
performOk();
WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
actionHandler.run(getProject());
}
});
new Label(composite, SWT.NONE).setText(" (Using MDW Server Runner)");
}
serverStatusLabel = new Label(composite, SWT.NONE);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
serverStatusLabel.setLayoutData(gd);
serverStatusLabel.setVisible(false);
serverStatusLabel.setImage(serverWaitImage);
serverMessageLabel = new Label(composite, SWT.NONE);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = 20;
gd.widthHint = 350;
gd.horizontalSpan = 2;
serverMessageLabel.setLayoutData(gd);
serverMessageLabel.setVisible(false);
serverMessageLabel.setText("Server status has not been determined yet.");
}
Aggregations