use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.
the class SearchPage method search.
public boolean search(List<WorkflowProject> scopedProjects) {
try {
SearchQuery searchQuery = createSearchQuery();
ProgressMonitorDialog context = new MdwProgressMonitorDialog(getShell());
NewSearchUI.runQueryInForeground(context, searchQuery);
// this shouldn't be necessary according to the Eclipse API docs
NewSearchUI.activateSearchResultView();
ISearchResultViewPart part = NewSearchUI.getSearchResultView();
part.updateLabel();
SearchResultsPage page = (SearchResultsPage) part.getActivePage();
page.setSearchQuery(searchQuery);
page.setInput(searchQuery.getSearchResult(), null);
return true;
} catch (OperationCanceledException ex) {
setMessage("Search cancelled", IMessageProvider.INFORMATION);
return false;
} catch (Exception ex) {
PluginMessages.uiError(ex, getEntityTitle() + " Search");
return false;
}
}
use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementActionHandler method remoteImportVcs.
public void remoteImportVcs(final WorkflowProject workflowProject) {
VcsRepository repo = workflowProject.getMdwVcsRepository();
String msg = "Pull latest assets into " + workflowProject.getName() + " from Git branch: " + repo.getBranch() + "?";
boolean proceed = MessageDialog.openConfirm(getShell(), "Import from VCS", msg);
if (proceed) {
ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(getShell());
try {
pmDialog.run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Importing remote project from Git...", IProgressMonitor.UNKNOWN);
monitor.worked(20);
try {
workflowProject.getDesignerProxy().remoteImportVcs();
} catch (Exception ex) {
PluginMessages.log(ex);
throw new InvocationTargetException(ex);
}
}
});
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Import From VCS", workflowProject);
}
}
}
use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog 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.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.
the class ProjectUpdater method updateWithDialog.
/**
* Download the file into the local folder in the specified project.
*/
public void updateWithDialog() {
Shell shell = MdwPlugin.getShell();
try {
ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
pmDialog.run(true, true, this);
} catch (InvocationTargetException ex) {
PluginMessages.uiError(shell, ex, "MDW Update", workflowProject);
} catch (InterruptedException ex) {
PluginMessages.log(ex);
MessageDialog.openError(shell, "MDW Update", "Update cancelled");
}
}
use of com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog in project mdw-designer by CenturyLinkCloud.
the class ToolboxWrapper method searchReferences.
private void searchReferences(ActivityImpl activityImpl) {
List<WorkflowProject> projects = new ArrayList<>();
projects.add(getProject());
Shell shell = MdwPlugin.getActiveWorkbenchWindow().getShell();
ProcessSearchQuery searchQuery = new ProcessSearchQuery(projects, SearchQuery.SearchType.CONTAINING_ENTITY, "*", true, shell);
searchQuery.setContainedEntityId(activityImpl.getId());
searchQuery.setContainedEntityName(activityImpl.getImplClassName());
try {
ProgressMonitorDialog context = new MdwProgressMonitorDialog(shell);
NewSearchUI.runQueryInForeground(context, searchQuery);
// this shouldn't be necessary according to the Eclipse API docs
NewSearchUI.activateSearchResultView();
ISearchResultViewPart part = NewSearchUI.getSearchResultView();
part.updateLabel();
SearchResultsPage page = (SearchResultsPage) part.getActivePage();
page.setSearchQuery(searchQuery);
page.setInput(searchQuery.getSearchResult(), null);
} catch (OperationCanceledException ex) {
MessageDialog.openInformation(shell, "Search Cancelled", "Search for usages cancelled.");
} catch (Exception ex) {
PluginMessages.uiError(shell, ex, "Search for Usages", getProject());
}
}
Aggregations