use of com.centurylink.mdw.plugin.project.WorkflowProjectManager 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);
}
});
}
}
}
use of com.centurylink.mdw.plugin.project.WorkflowProjectManager in project mdw-designer by CenturyLinkCloud.
the class MdwHubAction method populateMenu.
/**
* populates the plugin action menu (the mdwhub 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) {
if (workflowProject.checkRequiredVersion(5, 5)) {
String projName = workflowProject.isFrameworkProject() ? "MDWFramework" : workflowProject.getName();
// MDWWeb
MenuItem item = new MenuItem(menu, SWT.NONE);
final WebLaunchAction launchAction = WebLaunchActions.getLaunchAction(workflowProject, WebApp.MdwHub);
item.setText(projName + " - " + launchAction.getLabel());
item.setImage(launchAction.getIconImage());
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
mostRecentHubWorkflowProject = workflowProject;
launchAction.launch(workflowProject);
}
});
}
}
}
}
use of com.centurylink.mdw.plugin.project.WorkflowProjectManager in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerView method handleRefresh.
public void handleRefresh() {
BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
public void run() {
treeViewer.collapseAll();
WorkflowProjectManager projectMgr = WorkflowProjectManager.getInstance();
projectMgr.refresh();
treeViewer.setInput(projectMgr.getWorkflowProjects());
}
});
WorkflowElementActionHandler actionHandler = new WorkflowElementActionHandler();
for (WorkflowProject project : WorkflowProjectManager.getInstance().getWorkflowProjects()) {
if (!project.isFilePersist())
actionHandler.syncOpenEditors(project);
}
}
use of com.centurylink.mdw.plugin.project.WorkflowProjectManager in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementActionHandler method syncOpenEditors.
public void syncOpenEditors(final WorkflowProject project) {
final WorkflowProjectManager projectMgr = WorkflowProjectManager.getInstance();
final List<ProcessEditor> processEditors = getOpenProcessEditors(project);
final List<IEditorPart> assetEditors = getOpenAssetEditors(project);
if (!processEditors.isEmpty() || !assetEditors.isEmpty()) {
// sync open editors
IRunnableWithProgress loader = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Loading " + project.getLabel(), 100);
monitor.worked(25);
// sync process editors
for (ProcessEditor ed : processEditors) {
WorkflowProcess pv = ed.getProcess();
pv.setProject(projectMgr.getWorkflowProject(pv.getProject().getName()));
if (pv.getPackage() != null && !pv.getPackage().isDefaultPackage()) {
WorkflowPackage pkg = pv.getProject().getPackage(pv.getPackage().getName());
WorkflowProcess oldPv = pkg.getProcess(pv.getName());
if (oldPv != null)
pkg.removeProcess(oldPv);
pkg.addProcess(pv);
pv.setPackage(pkg);
}
}
monitor.worked(50);
// sync asset editors
Map<IFile, AssetWorkbenchListener> assetListeners = WorkflowAssetFactory.getWorkbenchListeners();
for (IEditorPart assetEd : assetEditors) {
FileEditorInput fileInput = (FileEditorInput) assetEd.getEditorInput();
AssetWorkbenchListener wbListener = assetListeners.get(fileInput.getFile());
if (wbListener != null) {
WorkflowAsset asset = wbListener.getAsset();
WorkflowProject wfProj = projectMgr.getWorkflowProject(asset.getProject().getName());
WorkflowAsset oldAsset = wfProj.getAsset(asset.getName(), asset.getLanguage(), asset.getVersion());
if (asset.getPackage() != null && !asset.getPackage().isDefaultPackage()) {
WorkflowPackage pkg = wfProj.getPackage(asset.getPackage().getName());
if (pkg != null) {
pkg.removeAsset(oldAsset);
pkg.addAsset(asset);
asset.setPackage(pkg);
} else {
asset.setPackage(wfProj.getDefaultPackage());
}
} else {
asset.setPackage(wfProj.getDefaultPackage());
}
asset.addElementChangeListener(wfProj);
if (oldAsset != null)
WorkflowAssetFactory.deRegisterAsset(oldAsset);
WorkflowAssetFactory.registerAsset(asset);
assetEd.addPropertyListener(asset.new AssetEditorPropertyListener(assetEd));
WorkflowAssetFactory.registerWorkbenchListener(fileInput.getFile(), wbListener);
}
}
monitor.worked(25);
monitor.done();
}
};
ProgressMonitorDialog progMonDlg = new MdwProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
progMonDlg.run(true, false, loader);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Sync Open Editors", project);
}
}
}
use of com.centurylink.mdw.plugin.project.WorkflowProjectManager in project mdw-designer by CenturyLinkCloud.
the class RefreshCacheAction method populateMenu.
/**
* populates the plugin action menu (the refr_cache 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.getSourceProjectName();
MenuItem item = new MenuItem(menu, SWT.NONE);
item.setText(projName + " Refresh");
item.setImage(image);
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!workflowProject.isUserAuthorizedForSystemAdmin()) {
PluginMessages.uiMessage("You must be in the System Admin role to refresh the cache for this environment", "Not Authorized", PluginMessages.INFO_MESSAGE);
} else {
mostRecentCacheRefreshWorkflowProject = workflowProject;
workflowProject.getDesignerProxy().getCacheRefresh().doRefresh(false);
}
}
});
}
}
}
Aggregations