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