use of org.knime.workbench.ui.navigator.WorkflowEditorAdapter in project knime-core by knime.
the class DeleteAction method closeOpenWorkflows.
private void closeOpenWorkflows(final List<IContainer> allWorkflows) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
for (IContainer wf : allWorkflows) {
NodeContainer wfm = ProjectWorkflowMap.getWorkflow(wf.getLocationURI());
if (wfm != null) {
for (IEditorReference editRef : page.getEditorReferences()) {
IEditorPart editor = editRef.getEditor(false);
if (editor == null) {
// got closed in the mean time
continue;
}
WorkflowEditorAdapter wea = (WorkflowEditorAdapter) editor.getAdapter(WorkflowEditorAdapter.class);
NodeContainer editWFM = null;
if (wea != null) {
editWFM = wea.getWorkflowManager();
}
if (wfm == editWFM) {
page.closeEditor(editor, false);
}
}
}
}
}
Aggregations