Author: joern
Date: Tue Nov  8 11:53:27 2011
New Revision: 1199205

URL: http://svn.apache.org/viewvc?rev=1199205&view=rev
Log:
UIMA-2273 Unregisters old listeners when input is changed.

Modified:
    
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java

Modified: 
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java?rev=1199205&r1=1199204&r2=1199205&view=diff
==============================================================================
--- 
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
 Tue Nov  8 11:53:27 2011
@@ -803,6 +803,18 @@ public final class AnnotationEditor exte
   protected void doSetInput(IEditorInput input) throws CoreException {
     IEditorInput oldInput = getEditorInput();
     ICasDocument oldDocument = getDocument();
+    
+    // Unregister the editor listeners on the old input
+    // TODO: Should we make methods to encapsulate the register/unregister 
code?
+    if (oldDocument != null) {
+      oldDocument.removeChangeListener(mAnnotationSynchronizer);
+      mAnnotationSynchronizer = null;
+      
+      getCasDocumentProvider().getTypeSystemPreferenceStore(getEditorInput()).
+              removePropertyChangeListener(mAnnotationStyleListener);
+      mAnnotationStyleListener = null;
+    }
+    
     super.doSetInput(input);
     
     if (CasEditorPlugin.getDefault().


Reply via email to