use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class CodeGenWizard method init.
public void init(IWorkbench workbench, IStructuredSelection selection, Code codeElement) {
this.workbench = workbench;
this.selection = selection;
this.codeElement = codeElement;
setDefaultPageImageDescriptor(MdwPlugin.getImageDescriptor("icons/mdw_wiz.png"));
setNeedsProgressMonitor(true);
if (selection != null) {
if (selection.getFirstElement() instanceof WorkflowPackage) {
WorkflowPackage workflowPackage = (WorkflowPackage) selection.getFirstElement();
getCodeElement().setProject(workflowPackage.getProject());
getCodeElement().setPackage(workflowPackage);
} else if (selection.getFirstElement() instanceof WorkflowElement) {
WorkflowElement workflowElement = ((WorkflowElement) selection.getFirstElement());
getCodeElement().setProject(workflowElement.getProject());
getCodeElement().setPackage(workflowElement.getPackage());
} else if (selection.getFirstElement() instanceof IResource) {
IResource resource = (IResource) selection.getFirstElement();
if (resource.getProject() != null) {
WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(resource.getProject());
if (workflowProject != null)
getCodeElement().setProject(workflowProject);
}
}
}
if (getCodeElement().getProject() == null) {
// choose any available workflow project
List<WorkflowProject> workflowProjects = WorkflowProjectManager.getInstance().getWorkflowProjects();
if (workflowProjects == null || workflowProjects.size() == 0)
MessageDialog.openError(getShell(), "Error", "No MDW projects found");
else
getCodeElement().setProject(workflowProjects.get(0));
}
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method isSomethingToPaste.
public boolean isSomethingToPaste(IStructuredSelection selection) {
if (selection.getFirstElement() instanceof WorkflowElement) {
WorkflowElement element = (WorkflowElement) selection.getFirstElement();
WorkflowPackage destPackage = element.getPackage();
if (destPackage != null) {
Object clipboardContents = view.getClipboard().getContents(TextTransfer.getInstance());
if (clipboardContents instanceof String) {
String clipString = (String) clipboardContents;
if (clipString.startsWith("Process~") || clipString.startsWith("ExternalEvent~") || clipString.startsWith("WorkflowAsset~")) {
ProcessExplorerDropTarget dropTarget = view.getDropTarget();
return (dropTarget != null && dropTarget.isValidDrop(clipString, destPackage, DND.DROP_COPY));
}
}
}
}
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage 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.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createMdwHubAction.
private IAction createMdwHubAction() {
IAction action = new Action() {
@Override
public void run() {
if (webLaunchApplies(getSelection())) {
if (getSelection().getFirstElement() instanceof WorkflowProject) {
WorkflowProject project = (WorkflowProject) getSelection().getFirstElement();
WebLaunchActions.getLaunchAction(project, WebApp.MdwHub).launch(project);
} else if (getSelection().getFirstElement() instanceof WorkflowPackage) {
WorkflowPackage packageVersion = (WorkflowPackage) getSelection().getFirstElement();
WebLaunchActions.getLaunchAction(packageVersion.getProject(), WebApp.MdwHub).launch(packageVersion);
}
}
}
};
WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(null, WebApp.MdwHub);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "launch.hub");
action.setText(launchAction.getLabel());
action.setImageDescriptor(launchAction.getImageDescriptor());
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method debugApplies.
public boolean debugApplies(IStructuredSelection selection) {
if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
return false;
WorkflowElement workflowElement = (WorkflowElement) selection.getFirstElement();
if (workflowElement instanceof AutomatedTestSuite || workflowElement instanceof AutomatedTestCase) {
WorkflowProject prj = workflowElement.getProject();
if (prj == null || !prj.checkRequiredVersion(6, 0) || !prj.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());
}
}
if (workflowElement instanceof WorkflowProcess || workflowElement instanceof ExternalEvent)
return !MdwPlugin.isRcp() && workflowElement.isUserAuthorized(UserRoleVO.PROCESS_EXECUTION);
else
return false;
}
Aggregations