You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/11/07 15:40:09 UTC

svn commit: r1198756 - in /uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor: AnnotationEditor.java styleview/AnnotationStyleViewPage.java

Author: joern
Date: Mon Nov  7 14:40:09 2011
New Revision: 1198756

URL: http://svn.apache.org/viewvc?rev=1198756&view=rev
Log:
UIMA-2273 Moved input changed notifcation after code which updates the Annotation Editor itself.

Modified:
    uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
    uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/styleview/AnnotationStyleViewPage.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=1198756&r1=1198755&r2=1198756&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 Mon Nov  7 14:40:09 2011
@@ -805,8 +805,6 @@ public final class AnnotationEditor exte
   protected void doSetInput(IEditorInput input) throws CoreException {
     ICasDocument oldDocument = getDocument();
     super.doSetInput(input);
-    ICasDocument newDocument = getDocument();
-    fireCasDocumentChanged(oldDocument, newDocument);
     
     if (CasEditorPlugin.getDefault().
             getAndClearShowMigrationDialogFlag()) {
@@ -822,9 +820,10 @@ public final class AnnotationEditor exte
       });
     }
     
-    
     if (getDocument() != null) {
-            
+      
+      shownAnnotationTypes.clear();
+      
       // Synchronize shown types with the editor
       String shownTypesString = getCasDocumentProvider().getSessionPreferenceStore(input).getString("LastShownTypes");
       
@@ -868,6 +867,9 @@ public final class AnnotationEditor exte
         }
       }
     }
+    
+    ICasDocument newDocument = getDocument();
+    fireCasDocumentChanged(oldDocument, newDocument);
   }
   
   private void fireCasDocumentChanged(ICasDocument oldDocument, ICasDocument newDocument) {

Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/styleview/AnnotationStyleViewPage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/styleview/AnnotationStyleViewPage.java?rev=1198756&r1=1198755&r2=1198756&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/styleview/AnnotationStyleViewPage.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/styleview/AnnotationStyleViewPage.java Mon Nov  7 14:40:09 2011
@@ -106,12 +106,12 @@ class AnnotationStyleViewPage extends Pa
         annotationTypes = null;
       }
       
-      
-      Display.getDefault().syncExec(new Runnable() {
-        public void run() {
-          treeViewer.refresh();
-        }
-      });
+      treeViewer.refresh();
+//      Display.getDefault().syncExec(new Runnable() {
+//        public void run() {
+//          treeViewer.refresh();
+//        }
+//      });
     }
 
     public Object[] getElements(Object inputElement) {
@@ -225,6 +225,11 @@ class AnnotationStyleViewPage extends Pa
     return selectedNodes;
   }
   
+  private void setCheckBoxes() {
+    treeViewer.setCheckedElements(typesToNodes(editor.getShownAnnotationTypes(), editor));
+    treeViewer.setGrayed(new AnnotationTypeNode(editor, editor.getAnnotationMode()), true);
+  }
+  
   @Override
   public void createControl(Composite parent) {
 
@@ -281,10 +286,6 @@ class AnnotationStyleViewPage extends Pa
       }
     };
     
-    treeViewer.setCheckedElements(typesToNodes(editor.getShownAnnotationTypes(), editor));
-    
-    treeViewer.setGrayed(new AnnotationTypeNode(editor, editor.getAnnotationMode()), true);
-    
     treeViewer.addCheckStateListener(new ICheckStateListener() {
       
       public void checkStateChanged(CheckStateChangedEvent event) {
@@ -378,8 +379,10 @@ class AnnotationStyleViewPage extends Pa
   }
 
   public void casDocumentChanged(ICasDocument oldDocument, ICasDocument newDocument) {
-    if (newDocument != null)
+    if (newDocument != null) {
       treeViewer.setInput(newDocument.getCAS().getTypeSystem());
+      setCheckBoxes();
+    }
     else 
       treeViewer.setInput(null);