use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class CodeGenWizard method createJavaAssetAndOpen.
protected JavaSource createJavaAssetAndOpen(WorkflowPackage workflowPackage, String jetFile, String targetFolder, String targetFile, IProgressMonitor monitor) throws CoreException {
JetAccess jet = getJet(jetFile, targetFolder, targetFile);
Generator generator = new Generator(getShell());
IFile contentFile = generator.createFile(jet, monitor);
WorkflowProject workflowProject = workflowPackage.getProject();
JavaSource javaAsset = new JavaSource();
javaAsset.setLanguage(RuleSetVO.JAVA);
javaAsset.setName(contentFile.getName());
javaAsset.setProject(workflowProject);
javaAsset.setPackage(workflowPackage);
String content = new String(PluginUtil.readFile(contentFile));
javaAsset.setContent(content);
contentFile.refreshLocal(IResource.DEPTH_ZERO, monitor);
contentFile.delete(true, monitor);
DesignerProxy designerProxy = javaAsset.getProject().getDesignerProxy();
try {
designerProxy.createNewWorkflowAsset(javaAsset, true);
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "New " + javaAsset.getTitle(), javaAsset.getProject());
return null;
}
if (designerProxy.getRunnerStatus().equals(RunnerStatus.SUCCESS)) {
javaAsset.openFile(new NullProgressMonitor());
javaAsset.addElementChangeListener(javaAsset.getProject());
javaAsset.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, javaAsset);
WorkflowAssetFactory.registerAsset(javaAsset);
return javaAsset;
} else {
return null;
}
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createRunTestsAction.
private IAction createRunTestsAction() {
IAction action = new Action() {
@Override
public void run() {
if (!runTestsApplies(getSelection()))
return;
try {
WorkflowElement element = (WorkflowElement) getSelection().getFirstElement();
WorkflowProject project = element.getProject();
restServer = ((RestfulServer) project.getDesignerDataAccess().getCurrentServer());
restServer.getAppSummary();
refreshRolePermissions(project);
if (!isAuthorized(element)) {
MessageDialog.openError(getViewSite().getShell(), RUN_ACTION, "You are not authorized to run " + element.getName());
return;
}
view.setFocus();
actionHandler.test(getSelection());
} catch (ConnectException ex) {
PluginMessages.log(ex);
MessageDialog.openError(MdwPlugin.getShell(), RUN_ACTION, "Server appears to be offline: " + restServer.getServerUrl());
} catch (Exception ex) {
PluginMessages.log(ex);
MessageDialog.openError(MdwPlugin.getShell(), RUN_ACTION, ex.getMessage());
}
}
};
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/testrun.gif");
action.setImageDescriptor(imageDesc);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "run.tests");
action.setText("Run Tests...");
return action;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createCompareResultsAction.
private IAction createCompareResultsAction() {
IAction action = new Action() {
@SuppressWarnings("restriction")
@Override
public void run() {
if (compareResultsApplies(getSelection())) {
WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
try {
project.getProjectFolder(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST)).refreshLocal(IResource.DEPTH_INFINITE, null);
Object[] items = new Object[2];
if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
if (project.isFilePersist()) {
items[0] = project.getProjectFile(expectedResults.getVcsAssetPath());
} else {
expectedResults.openTempFile(new NullProgressMonitor());
items[0] = expectedResults.getTempFile(expectedResults.getTempFolder());
}
String actualResultsPath = expectedResults.getPackage().getName() + "/" + expectedResults.getName();
items[1] = project.getProjectFile(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST) + "/" + actualResultsPath);
} else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
items[0] = expectedResult.getExpectedResult();
items[1] = expectedResult.getActualResult();
}
if (items[1] == null || !((IFile) items[1]).exists()) {
MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file: " + ((IFile) items[1]).getLocation().toString());
return;
}
StructuredSelection compareSelection = new StructuredSelection(items);
ResultsCompareAction compareAction = new ResultsCompareAction(compareSelection);
compareAction.run(compareSelection);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Compare Test Results", project);
}
}
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "compare.results");
action.setText("Compare Results");
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/compare.gif");
action.setImageDescriptor(imageDesc);
return action;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createRunAction.
private IAction createRunAction() {
IAction action = new Action() {
@Override
public void run() {
if (!runApplies(getSelection()))
return;
try {
WorkflowElement element = (WorkflowElement) getSelection().getFirstElement();
WorkflowProject project = element.getProject();
restServer = ((RestfulServer) project.getDesignerDataAccess().getCurrentServer());
restServer.getAppSummary();
refreshRolePermissions(project);
if (!isAuthorized(element)) {
MessageDialog.openError(getViewSite().getShell(), RUN_ACTION, "You are not authorized to run " + element.getName());
return;
}
view.setFocus();
if (element instanceof AutomatedTestSuite || element instanceof AutomatedTestCase)
actionHandler.test(getSelection());
else
actionHandler.run((WorkflowElement) element);
} catch (ConnectException ex) {
PluginMessages.log(ex);
MessageDialog.openError(MdwPlugin.getShell(), RUN_ACTION, "Server appears to be offline: " + restServer.getServerUrl());
} catch (Exception ex) {
PluginMessages.log(ex);
MessageDialog.openError(MdwPlugin.getShell(), RUN_ACTION, ex.getMessage());
}
}
};
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_RUN_GIF);
action.setImageDescriptor(imageDesc);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "run");
action.setText("Run...");
return action;
}
use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createSwingLaunchAction.
private IAction createSwingLaunchAction(final String title, final String icon, final String formName, final String dataInit) {
IAction action = new Action() {
@Override
public void run() {
if (!swingLaunchApplies(getSelection()))
return;
WorkflowProject workflowProject = (WorkflowProject) getSelection().getFirstElement();
boolean is55 = workflowProject.checkRequiredVersion(5, 5);
String handlerPkg = is55 ? "com.centurylink.mdw.listener.formaction." : "com.qwest.mdw.listener.formaction.";
String listenerPackage = is55 ? "com.centurylink.mdw.swingtools/" : "";
actionHandler.launchSwing(workflowProject, title, formName == null ? null : listenerPackage + formName, handlerPkg + dataInit);
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "swing." + title);
action.setText(title);
if (icon != null) {
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICONS + icon);
action.setImageDescriptor(imageDesc);
}
return action;
}
Aggregations