use of com.centurylink.mdw.plugin.designer.model.WorkflowElement 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;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createImportActionGroup.
private ActionGroup createImportActionGroup() {
importMenu = new MenuManager("Import", MdwPlugin.getImageDescriptor("icons/import.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
importMenu.removeAll();
IStructuredSelection selection = getSelection();
WorkflowElement element = (WorkflowElement) selection.getFirstElement();
if (!importMenuApplies(selection))
return;
if (importProjectApplies())
importMenu.add(importProjectAction);
if (importPackageApplies(selection))
importMenu.add(importPackageAction);
if (importVcsApplies(selection))
importMenu.add(importVcsAction);
if (importProcessApplies(selection)) {
if (element instanceof WorkflowProcess) {
importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.process.version");
importProcessAction.setText("New Process Version...");
} else {
importProcessAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.process");
importProcessAction.setText(PROCESS_DOT);
}
importMenu.add(importProcessAction);
}
if (importWorkflowAssetApplies(selection)) {
if (element instanceof WorkflowAsset) {
WorkflowAsset asset = (WorkflowAsset) element;
// menu item text and icon are dynamic
importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.new.asset.version");
importWorkflowAssetAction.setText("New " + asset.getTitle() + " Version...");
importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICONS + asset.getIcon()));
} else {
importWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.asset");
importWorkflowAssetAction.setText("Asset...");
importWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICON_DOC_GIF));
}
importMenu.add(importWorkflowAssetAction);
}
if (importAttributesApplies(selection)) {
List<IAction> importAttrsActions = getImportAttributeActions(selection);
if (!importAttrsActions.isEmpty()) {
MenuManager attributesMenu = new MenuManager("Attributes", MdwPlugin.getImageDescriptor("icons/attribute.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.import.attributes");
attributesMenu.removeAll();
for (IAction action : importAttrsActions) attributesMenu.add(action);
importMenu.add(attributesMenu);
}
}
if (importTaskTemplateApplies(selection))
importMenu.add(importTaskTemplateAction);
importMenu.add(new Separator(OTHER));
IWorkbenchAction otherAction = ActionFactory.IMPORT.create(getViewSite().getWorkbenchWindow());
otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.other");
otherAction.setText(OTHER_DOT);
importMenu.add(otherAction);
}
};
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method getExportAttributeActions.
private List<IAction> getExportAttributeActions(IStructuredSelection selection) {
List<IAction> exportAttributesActions = new ArrayList<>();
if (selection != null && selection.getFirstElement() instanceof WorkflowElement) {
// bam
IAction action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(WorkAttributeConstant.BAM_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.monitoring");
action.setText("Monitoring...");
exportAttributesActions.add(action);
// simulation
action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(WorkAttributeConstant.SIMULATION_ATTR_PREFIX, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.simulation");
action.setText("Simulation...");
exportAttributesActions.add(action);
// pagelet-driven attributes
WorkflowProject project = ((WorkflowElement) selection.getFirstElement()).getProject();
List<PageletTab> pageletTabs = project.getPageletTabs();
if (pageletTabs != null) {
for (PageletTab pageletTab : pageletTabs) {
final String prefix = pageletTab.getOverrideAttributePrefix();
action = new Action() {
@Override
public void run() {
if (!exportAttributesApplies(getSelection()))
return;
view.setFocus();
actionHandler.exportAttributes(prefix, (WorkflowElement) getSelection().getFirstElement());
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.attributes." + prefix);
action.setText(pageletTab.getLabel() + "...");
exportAttributesActions.add(action);
}
}
}
return exportAttributesActions;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createDeleteAction.
private IAction createDeleteAction() {
IAction action = new Action() {
@Override
public void run() {
if (!deleteApplies(getSelection()))
return;
view.setFocus();
Object[] items = getSelection().toArray();
WorkflowElement[] elements = new WorkflowElement[items.length];
boolean includesArchived = false;
for (int i = 0; i < items.length; i++) {
elements[i] = (WorkflowElement) items[i];
if (elements[i].isArchived())
includesArchived = true;
}
actionHandler.delete(elements);
view.select(null);
getContext().setSelection(new StructuredSelection());
if (// TODO archived elements are not being
includesArchived)
// listened to
view.refreshItem(elements[0].getProject());
}
};
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
action.setActionDefinitionId("org.eclipse.ui.edit.delete");
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "delete");
action.setText("Delete");
getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), action);
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createSetVersionAction.
private IAction createSetVersionAction() {
IAction action = new Action() {
@Override
public void run() {
if (setVersionApplies(getSelection()))
actionHandler.setVersion((WorkflowElement) getSelection().getFirstElement());
view.setFocus();
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "set.version");
action.setText("Set Version");
return action;
}
Aggregations