use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createWebActionGroup.
private ActionGroup createWebActionGroup() {
webMenu = new MenuManager("Web", MdwPlugin.getImageDescriptor("icons/webtools.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.web");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
webMenu.removeAll();
IStructuredSelection selection = getSelection();
if (webLaunchApplies(selection) && selection.getFirstElement() instanceof WorkflowElement) {
if (((WorkflowElement) selection.getFirstElement()).getProject().checkRequiredVersion(5, 5)) {
webMenu.add(mdwHubAction);
} else {
webMenu.add(taskManagerAction);
webMenu.add(webToolsAction);
}
}
}
};
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method importVcsApplies.
public boolean importVcsApplies(IStructuredSelection selection) {
if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
return false;
WorkflowElement element = (WorkflowElement) selection.getFirstElement();
if (element.isArchived())
return false;
if (!(element instanceof WorkflowProject))
return false;
WorkflowProject project = (WorkflowProject) element;
if (!project.isInitialized())
return false;
if (!project.isGitVcs() || !project.isRemote())
return false;
return project.getDesignerDataModel().userHasRoleInAnyGroup(UserRoleVO.PROCESS_DESIGN);
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createOpenInstanceAction.
private IAction createOpenInstanceAction() {
IAction action = new Action() {
@Override
public void run() {
if (openInstanceApplies(getSelection())) {
WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
try {
Long procInstId = null;
if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
java.io.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.setText(OPEN_PROCESS_INSTANCE);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
action.setImageDescriptor(imageDesc);
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestActionGroup method createCompareResultsAction.
private IAction createCompareResultsAction() {
IAction action = new Action() {
@SuppressWarnings("restriction")
public void run() {
if (compareResultsApplies(view.getSelectedItem())) {
WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
try {
project.getProjectFolder(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST)).refreshLocal(IResource.DEPTH_INFINITE, null);
Object[] items = new Object[2];
if (view.getSelectedItem() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
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 (view.getSelectedItem() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
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.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestActionGroup method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
final WorkflowElement selection = view.getSelectedItem();
if (selection == null)
return;
// open commands
if (openTestCaseApplies(selection))
menu.add(openTestCase);
// rerun tests
if (rerunApplies(selection))
menu.add(rerunSelectionAction);
// open expected
if (openExpectedApplies(selection))
menu.add(openExpectedAction);
// compare results with expected
if (compareResultsApplies(selection))
menu.add(compareResultsAction);
// open process instance
if (openProcessInstanceApplies(selection))
menu.add(openProcessInstanceAction);
// format
if (formatMenuApplies(selection)) {
menu.add(formatMenu);
formatActionGroup.fillContextMenu(menu);
}
}
Aggregations