Search in sources :

Example 21 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createTaskManagerAction.

private IAction createTaskManagerAction() {
    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.TaskManager).launch(project);
                } else if (getSelection().getFirstElement() instanceof WorkflowPackage) {
                    WorkflowPackage packageVersion = (WorkflowPackage) getSelection().getFirstElement();
                    WebLaunchActions.getLaunchAction(packageVersion.getProject(), WebApp.TaskManager).launch(packageVersion);
                }
            }
        }
    };
    WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(null, WebApp.TaskManager);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "launch.task.manager");
    action.setText(launchAction.getLabel());
    action.setImageDescriptor(launchAction.getImageDescriptor());
    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) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) IAction(org.eclipse.jface.action.IAction) WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 22 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createImportVcsAction.

private IAction createImportVcsAction() {
    IAction action = new Action() {

        @Override
        public void run() {
            if (!importVcsApplies(getSelection()))
                return;
            WorkflowElement selection = (WorkflowElement) getSelection().getFirstElement();
            WorkflowProject workflowProject = selection.getProject();
            boolean authorized = workflowProject.getDesignerDataModel().userHasRoleInAnyGroup(UserRoleVO.PROCESS_DESIGN);
            if (!authorized) {
                MessageDialog.openError(getViewSite().getShell(), "Package Import", NOT_AUTHORIZED + workflowProject.getName());
                return;
            }
            actionHandler.remoteImportVcs(selection.getProject());
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/gitrepo.gif");
    action.setImageDescriptor(imageDesc);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "assets.from.vcs");
    action.setText("Assets from VCS...");
    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 23 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createServerActionGroup.

private ActionGroup createServerActionGroup() {
    serverMenu = new MenuManager("Server", MdwPlugin.getImageDescriptor("icons/server.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.server");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            serverMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (serverActionApplies(selection)) {
                WorkflowProject project = (WorkflowProject) selection.getFirstElement();
                if (project.isUserAuthorizedForSystemAdmin())
                    serverMenu.add(refreshCachesAction);
                if (!project.isRemote() || project.isUserAuthorizedForSystemAdmin()) {
                    stubServerAction.setChecked(project.getDesignerProxy().isStubServerRunning());
                    serverMenu.add(stubServerAction);
                    logWatcherAction.setChecked(DesignerProxy.isLogWatcherRunning());
                    serverMenu.add(logWatcherAction);
                }
                if (!MdwPlugin.isRcp()) {
                    if (!serverMenu.isEmpty())
                        serverMenu.add(new Separator("VM"));
                    serverMenu.add(visualVmAction);
                    serverMenu.add(jconsoleAction);
                }
            }
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 24 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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 25 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject 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)

Aggregations

WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)128 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)31 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)22 ArrayList (java.util.ArrayList)22 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 CoreException (org.eclipse.core.runtime.CoreException)19 Action (org.eclipse.jface.action.Action)19 IAction (org.eclipse.jface.action.IAction)18 IProject (org.eclipse.core.resources.IProject)17 IFile (org.eclipse.core.resources.IFile)16 PartInitException (org.eclipse.ui.PartInitException)16 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)12 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)11 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 IOException (java.io.IOException)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)9