use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createImportPackageAction.
private IAction createImportPackageAction() {
IAction action = new Action() {
@Override
public void run() {
if (!importPackageApplies(getSelection()))
return;
WorkflowElement selection = (WorkflowElement) getSelection().getFirstElement();
WorkflowProject workflowProject = selection.getProject();
boolean authorized = (workflowProject.isFilePersist() && !workflowProject.isRemote()) || workflowProject.getDesignerDataModel().userHasRoleInAnyGroup(UserRoleVO.PROCESS_DESIGN);
if (!authorized) {
MessageDialog.openError(getViewSite().getShell(), "Package Import", NOT_AUTHORIZED + workflowProject.getName());
return;
}
actionHandler.imporT(WorkflowPackage.class, selection);
}
};
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PACKAGE_GIF);
action.setImageDescriptor(imageDesc);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "import.packages");
action.setText("Package(s)...");
return action;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method pasteApplies.
public boolean pasteApplies(IStructuredSelection selection) {
if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowElement) {
WorkflowElement element = (WorkflowElement) selection.getFirstElement();
WorkflowPackage pkg = element.getPackage();
if (pkg != null && !pkg.isArchived() && pkg.isUserAuthorized(UserRoleVO.ASSET_DESIGN))
return true;
}
return false;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createNewActionGroup.
private ActionGroup createNewActionGroup() {
newMenu = new MenuManager("New", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new");
return new ActionGroup() {
@Override
public void fillContextMenu(IMenuManager menu) {
newMenu.removeAll();
IStructuredSelection selection = getSelection();
if (!newMenuApplies(selection))
return;
if (!MdwPlugin.isRcp())
newMenu.add(newCloudProjectAction);
if (createApplies(WorkflowProject.class, selection))
newMenu.add(newRemoteProjectAction);
newMenu.add(new Separator());
if (createApplies(WorkflowPackage.class, selection))
newMenu.add(newPackageAction);
if (createApplies(WorkflowProcess.class, selection))
newMenu.add(newProcessAction);
newMenu.add(new Separator());
if (createApplies(Activity.class, selection)) {
MenuManager activityMenu = new MenuManager("Activity", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.activity");
activityMenu.add(newGeneralActivityAction);
activityMenu.add(newStartActivityAction);
activityMenu.add(newAdapterActivityAction);
activityMenu.add(newEvaluatorActivityAction);
newMenu.add(activityMenu);
}
if (createApplies(ExternalEvent.class, selection)) {
MenuManager eventHandlerMenu = new MenuManager("Event Handler", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.new.event.handler");
eventHandlerMenu.add(newEventHandlerAction);
eventHandlerMenu.add(newCamelProcessHandlerAction);
eventHandlerMenu.add(newCamelNotifyHandlerAction);
newMenu.add(eventHandlerMenu);
}
newMenu.add(new Separator());
if (createApplies(WorkflowAsset.class, selection)) {
newMenu.add(new Separator());
newMenu.add(newCamelRouteAction);
newMenu.add(newJarFileAction);
newMenu.add(newJavaSourceAction);
newMenu.add(newJsonAction);
newMenu.add(newKotlinAction);
newMenu.add(newPageAction);
newMenu.add(newReportAction);
newMenu.add(newRuleAction);
newMenu.add(newScriptAction);
newMenu.add(newSpringConfigAction);
if (selection.getFirstElement() instanceof WorkflowElement && ((WorkflowElement) selection.getFirstElement()).getProject().isFilePersist())
newMenu.add(newTaskTemplateAction);
newMenu.add(newTemplateAction);
newMenu.add(newTestCaseAction);
newMenu.add(newTextResourceAction);
newMenu.add(newWebResourceAction);
newMenu.add(newWordDocAction);
newMenu.add(newXmlDocAction);
newMenu.add(newYamlAction);
newMenu.add(newKotlinAction);
newMenu.add(new Separator());
}
newMenu.add(new Separator(OTHER));
IWorkbenchAction otherAction = ActionFactory.NEW.create(getViewSite().getWorkbenchWindow());
otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "new.other");
otherAction.setText(OTHER_DOT);
newMenu.add(otherAction);
}
};
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method importPackageApplies.
public boolean importPackageApplies(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 (element.getProject().isRemote() && project.checkRequiredVersion(6))
return "mdw".equalsIgnoreCase(project.getRemoteAppSummary(true).getAuthMethod());
if (project.isFilePersist() && !project.isRemote())
// local file persist can always import (even Git)
return true;
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 createOpenAction.
private IAction createOpenAction() {
IAction action = new Action() {
@Override
public void run() {
if (!openApplies())
return;
for (Object item : getSelection().toList()) {
if (!actionHandler.open((WorkflowElement) item))
view.expand(item);
}
}
};
action.setActionDefinitionId("org.eclipse.jdt.ui.edit.text.java.open.editor");
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open");
action.setText("Open");
getActionBars().setGlobalActionHandler("org.eclipse.ui.navigator.Open", action);
return action;
}
Aggregations