Search in sources :

Example 1 with WorkflowProject

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

the class DesignerProxy method moveWorkflowAssetToPackage.

public Long moveWorkflowAssetToPackage(final Long assetId, final WorkflowPackage targetPackage) {
    String progressMsg = "Moving Asset ID: " + assetId + TO_PKG + targetPackage.getName() + "'";
    String errorMsg = "Move Workflow Asset";
    final WorkflowProject workflowProject = targetPackage.getProject();
    final WorkflowAsset asset = workflowProject.getAsset(assetId);
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            if (asset.isInDefaultPackage()) {
                dataAccess.getDesignerDataAccess().addRuleSetToPackage(asset.getRuleSetVO(), targetPackage.getPackageVO());
                WorkflowPackage defaultPackage = workflowProject.getDefaultPackage();
                defaultPackage.removeAsset(asset);
            } else {
                // id can change from repackaging for VCS assets
                Long newId = dataAccess.getDesignerDataAccess().addRuleSetToPackage(asset.getRuleSetVO(), targetPackage.getPackageVO());
                dataAccess.getDesignerDataAccess().removeRuleSetFromPackage(asset.getRuleSetVO(), asset.getPackage().getPackageVO());
                asset.setId(newId);
                asset.getPackage().removeAsset(asset);
            }
            targetPackage.addAsset(asset);
        }
    };
    designerRunner.run();
    return asset.getId();
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) RemoteException(java.rmi.RemoteException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 2 with WorkflowProject

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

the class DesignerProxy method renamePackage.

public void renamePackage(final WorkflowPackage packageToRename, final String newName) {
    if (packageToRename.isDefaultPackage())
        return;
    final WorkflowProject workflowProject = packageToRename.getProject();
    if (workflowProject.packageNameExists(newName)) {
        Shell shell = MdwPlugin.getActiveWorkbenchWindow().getShell();
        MessageDialog.openError(shell, RENAME_ERROR, "Package name already exists: '" + newName + "'");
        return;
    }
    String progressMsg = "Renaming package to '" + newName + "'";
    String errorMsg = "Rename Package";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, workflowProject) {

        public void perform() throws DataAccessException, RemoteException {
            packageToRename.getPackageVO().setId(dataAccess.getDesignerDataAccess().renamePackage(packageToRename.getId(), newName, 1));
        }
    };
    designerRunner.run();
    packageToRename.setName(newName);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) RemoteException(java.rmi.RemoteException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 3 with WorkflowProject

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

the class WebToolsAction method run.

public void run(IAction action) {
    WorkflowProject workflowProject = getProject(getSelection());
    WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(workflowProject, WebApp.WebTools);
    if (workflowProject != null)
        launchAction.launch(workflowProject);
    else if (mostRecentWebToolsLaunchWorkflowProject != null)
        launchAction.launch(mostRecentWebToolsLaunchWorkflowProject);
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 4 with WorkflowProject

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

the class WebToolsAction method populateMenu.

/**
 * populates the plugin action menu (the webtools icon) with its items
 */
public void populateMenu(Menu menu) {
    WorkflowProjectManager wfProjectMgr = WorkflowProjectManager.getInstance();
    List<WorkflowProject> workflowProjects = wfProjectMgr.getWorkflowProjects();
    if (workflowProjects.isEmpty()) {
        MenuItem item = new MenuItem(menu, SWT.NONE);
        item.setText("(No Projects)");
        item.setImage(MdwPlugin.getImageDescriptor("icons/wait.gif").createImage());
        item.setEnabled(false);
    } else {
        for (final WorkflowProject workflowProject : workflowProjects) {
            String projName = workflowProject.isFrameworkProject() ? "MDWFramework" : workflowProject.getName();
            // MDWWeb
            MenuItem item = new MenuItem(menu, SWT.NONE);
            final WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(workflowProject, WebApp.WebTools);
            item.setText(projName + " - " + launchAction.getLabel());
            item.setImage(launchAction.getIconImage());
            item.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    mostRecentWebToolsLaunchWorkflowProject = workflowProject;
                    launchAction.launch(workflowProject);
                }
            });
        }
    }
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) MenuItem(org.eclipse.swt.widgets.MenuItem) WorkflowProjectManager(com.centurylink.mdw.plugin.project.WorkflowProjectManager)

Example 5 with WorkflowProject

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

the class WorkflowElementActionHandler method showInstances.

public void showInstances(WorkflowElement element) {
    if (element instanceof WorkflowProject) {
        // TODO myTasks is hardcoded
        WorkflowProject project = (WorkflowProject) element;
        try {
            IViewPart viewPart = getPage().showView("mdw.views.designer.list.myTasks");
            if (viewPart != null) {
                MyTasksView myTasksView = (MyTasksView) viewPart;
                myTasksView.setProject(project);
                myTasksView.refreshTable();
            }
        } catch (PartInitException ex) {
            PluginMessages.log(ex);
        }
    } else if (element instanceof WorkflowProcess) {
        try {
            IViewPart viewPart = getPage().showView("mdw.views.designer.process.instance.list");
            if (viewPart != null) {
                ProcessInstanceListView instancesView = (ProcessInstanceListView) viewPart;
                instancesView.setProcess((WorkflowProcess) element);
            }
        } catch (PartInitException ex) {
            PluginMessages.log(ex);
        }
    }
}
Also used : MyTasksView(com.centurylink.mdw.plugin.designer.views.MyTasksView) IViewPart(org.eclipse.ui.IViewPart) ProcessInstanceListView(com.centurylink.mdw.plugin.designer.views.ProcessInstanceListView) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) PartInitException(org.eclipse.ui.PartInitException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

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