private void reuseEditor(IWorkbenchPage page, TableViewer viewer,
IEditorInput input, String editorId) throws PartInitException {
logger.debug("entering reuseEditor for EditorId " + editorId);
IEditorReference[] editorReferences = page.getEditorReferences();
IPWEditor editor = null;
for (IEditorReference ref : editorReferences) {
if (ref.getEditor(true) instanceof IPWEditor) {
IPWEditor pwEditor = (IPWEditor) ref.getEditor(true);
logger.debug("Editor present: " + pwEditor.getId());
if (editorId.equals(pwEditor.getId())) {
editor = pwEditor;
} else {
// this is not the editor we are looking for
logger.debug("Closing editor " + pwEditor.getId());
page.closeEditor(pwEditor, false);
}
}
}
if (editor != null) {