Search in sources :

Example 6 with WorkflowElement

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;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 7 with WorkflowElement

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;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 8 with WorkflowElement

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);
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 9 with WorkflowElement

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);
}
Also used : WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 10 with WorkflowElement

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;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Aggregations

WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)65 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)25 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)25 IAction (org.eclipse.jface.action.IAction)22 Action (org.eclipse.jface.action.Action)21 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)21 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)19 ArrayList (java.util.ArrayList)17 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)14 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)11 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 IFile (org.eclipse.core.resources.IFile)8 AutomatedTestSuite (com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)7 Folder (com.centurylink.mdw.plugin.designer.model.Folder)7 LegacyExpectedResults (com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults)7 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)7 PartInitException (org.eclipse.ui.PartInitException)7 AutomatedTestResults (com.centurylink.mdw.plugin.designer.model.AutomatedTestResults)5 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)5