Search in sources :

Example 6 with WorkflowProjectManager

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

the class TaskManagerAction method populateMenu.

/**
 * populates the plugin action menu (the taskmgr 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();
            MenuItem item = new MenuItem(menu, SWT.NONE);
            final WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(workflowProject, WebApp.TaskManager);
            item.setText(projName + " - " + launchAction.getLabel());
            item.setImage(launchAction.getIconImage());
            item.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    mostRecentTaskManagerWorkflowProject = 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)

Aggregations

WorkflowProjectManager (com.centurylink.mdw.plugin.project.WorkflowProjectManager)6 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 MenuItem (org.eclipse.swt.widgets.MenuItem)4 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)3 WorkflowElementActionHandler (com.centurylink.mdw.plugin.actions.WorkflowElementActionHandler)1 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)1 ProcessEditor (com.centurylink.mdw.plugin.designer.editors.ProcessEditor)1 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)1 AssetWorkbenchListener (com.centurylink.mdw.plugin.designer.model.WorkflowAsset.AssetWorkbenchListener)1 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ConnectException (java.net.ConnectException)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1