use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createFormatFunctionTestResultsAction.
private IAction createFormatFunctionTestResultsAction() {
IAction action = new Action() {
@Override
public void run() {
if (formatFunctionTestResultsApplies(getSelection())) {
WorkflowElement element = (WorkflowElement) getSelection().getFirstElement();
actionHandler.formatResults(element.getProject(), AutomatedTestCase.FUNCTION_TEST);
}
}
};
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/auto_test.gif");
action.setImageDescriptor(imageDesc);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "format.function.test.results");
action.setText("Function Tests Results");
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method runApplies.
// top-level run action
public boolean runApplies(IStructuredSelection selection) {
if (selection.size() > 1) {
Boolean legacy = null;
WorkflowPackage testPkg = null;
for (Object o : selection.toArray()) {
if (!(o instanceof AutomatedTestCase))
return false;
// make sure they're all in the same package or legacy suite
AutomatedTestCase testCase = (AutomatedTestCase) o;
if (legacy == null)
legacy = testCase.isLegacy();
if (legacy.booleanValue() != testCase.isLegacy())
return false;
if (!testCase.isLegacy()) {
if (testPkg == null)
testPkg = testCase.getPackage();
if (!testPkg.equals(testCase.getPackage()))
return false;
}
}
WorkflowProject workflowProject = ((AutomatedTestCase) selection.getFirstElement()).getProject();
if (!workflowProject.isRemote())
return true;
return workflowProject.isUserAuthorizedInAnyGroup(UserRoleVO.PROCESS_EXECUTION);
}
if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
return false;
WorkflowElement workflowElement = (WorkflowElement) selection.getFirstElement();
if (workflowElement instanceof Report)
return true;
if (workflowElement instanceof Page)
return true;
if (workflowElement instanceof Template && ((Template) workflowElement).getLanguage().equals(RuleSetVO.VELOCITY))
return true;
if (workflowElement instanceof WorkflowProcess || workflowElement instanceof ExternalEvent) {
if (!workflowElement.getProject().isRemote())
return true;
return workflowElement.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION);
}
if (workflowElement instanceof AutomatedTestSuite || workflowElement instanceof AutomatedTestCase) {
if (workflowElement.getProject() == null)
return false;
if (workflowElement.getProject().isRemote()) {
if (!workflowElement.getProject().isUserAuthorizedInAnyGroup(UserRoleVO.PROCESS_EXECUTION))
return false;
WorkflowPackage pkg = workflowElement.getPackage();
if (pkg != null && !pkg.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION))
return false;
}
try {
AutomatedTestView testView = (AutomatedTestView) MdwPlugin.getActivePage().showView("mdw.views.launch.automatedTest");
return !testView.isLocked();
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Menu", workflowElement.getProject());
}
}
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createIncrementVersionAction.
private IAction createIncrementVersionAction() {
IAction action = new Action() {
@Override
public void run() {
if (incrementVersionApplies(getSelection()))
actionHandler.incrementVersion((WorkflowElement) getSelection().getFirstElement());
view.setFocus();
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "increment.version");
action.setText("Increment Version");
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createUpdateAction.
private IAction createUpdateAction() {
IAction action = new Action() {
@Override
public void run() {
if (updateApplies(getSelection())) {
WorkflowElement workflowElement = (WorkflowElement) getSelection().getFirstElement();
actionHandler.update(workflowElement);
}
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "update.to.latest");
action.setText("Update to Latest");
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/sync.gif");
action.setImageDescriptor(imageDesc);
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createCopyAction.
private IAction createCopyAction() {
IAction action = new Action() {
@Override
public void run() {
if (!copyApplies(getSelection()))
return;
view.setFocus();
Object[] items = getSelection().toArray();
WorkflowElement[] elements = new WorkflowElement[items.length];
for (int i = 0; i < items.length; i++) {
elements[i] = (WorkflowElement) items[i];
}
actionHandler.copy(elements, view.getClipboard());
}
};
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
action.setActionDefinitionId("org.eclipse.ui.edit.copy");
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "copy");
action.setText("Copy");
getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), action);
return action;
}
Aggregations