#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 73072f5..7955c4f 100644 (file)
@@ -76,7 +76,14 @@ public class EditorUtil extends AbstractUtility {
         */
        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;
        }
 
        /**