#5420 Add check to dispose input if duplicate editor is already open
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 1 Dec 2015 16:20:44 +0000 (17:20 +0100)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 1 Dec 2015 16:20:44 +0000 (17:20 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java

index 73072f5531601d18f7c7c4d8b82813764cd1b45e..7955c4fe51bd07dbe40e495f6a2d36fd4c26c193 100644 (file)
@@ -76,7 +76,14 @@ public class EditorUtil extends AbstractUtility {
         */
        private static IEditorPart open(final IEditorInput input,
                        final String editorId) throws PartInitException {
         */
        private static IEditorPart open(final IEditorInput input,
                        final String editorId) throws PartInitException {
-               return getActivePage().openEditor(input, editorId);
+               IEditorPart editor = getActivePage().openEditor(input, editorId);
+               if(input != null &&
+                       editor.getEditorInput() != null &&
+                       input != editor.getEditorInput() &&
+                       input instanceof CdmEntitySessionInput) {
+                   ((CdmEntitySessionInput)input).dispose();
+               }
+               return editor;
        }
 
        /**
        }
 
        /**