Revision: 19152
          http://sourceforge.net/p/gate/code/19152
Author:   markagreenwood
Date:     2016-03-17 18:39:49 +0000 (Thu, 17 Mar 2016)
Log Message:
-----------
move GUI updating inthe coref editor onto the EDT

Modified Paths:
--------------
    gate/trunk/src/main/gate/gui/docview/CorefEditor.java

Modified: gate/trunk/src/main/gate/gui/docview/CorefEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/docview/CorefEditor.java       2016-03-17 
18:25:58 UTC (rev 19151)
+++ gate/trunk/src/main/gate/gui/docview/CorefEditor.java       2016-03-17 
18:39:49 UTC (rev 19152)
@@ -957,42 +957,53 @@
       return;
     }
 
-    String currentAnnotSet = (String) annotSets.getSelectedItem();
+    System.out.println("calling from here");
+    
+    final String currentAnnotSet =
+            annotSets.getSelectedItem() != null ? (String)annotSets
+                    .getSelectedItem() : annotSets.getItemAt(0);
+                    
     // get all the types of the currently Selected AnnotationSet
-    if (currentAnnotSet == null)
-      currentAnnotSet = annotSets.getItemAt(0);
     AnnotationSet temp = getAnnotationSet(currentAnnotSet);
     Set<String> types = temp.getAllTypes();
     annotTypesModel = new DefaultComboBoxModel<String>();
     if (types != null) {
       annotTypesModel = new DefaultComboBoxModel<String>(types.toArray(new 
String[types.size()]));
     }
-    annotTypes.setModel(annotTypesModel);
-    annotTypes.updateUI();
+    
+    SwingUtilities.invokeLater(new Runnable() {
+      
+      @Override
+      public void run() {
+        annotTypes.setModel(annotTypesModel);
+        annotTypes.updateUI();
 
-    // and redraw the CorefTree
-    if (rootNode.getChildCount() > 0)
-      rootNode.removeAllChildren();
+        // and redraw the CorefTree
+        if (rootNode.getChildCount() > 0)
+          rootNode.removeAllChildren();
 
-    CorefTreeNode annotSetNode = 
corefAnnotationSetNodesMap.get(currentAnnotSet);
+        CorefTreeNode annotSetNode = 
corefAnnotationSetNodesMap.get(currentAnnotSet);
 
-    if (annotSetNode != null) {
-      rootNode.add(annotSetNode);
-      currentSelections = selectionChainsMap.get(currentAnnotSet);
-      currentColors = colorChainsMap.get(currentAnnotSet);
-      if (!corefTree.isVisible()) {
-        if (popupWindow != null && popupWindow.isVisible()) {
-          popupWindow.setVisible(false);
+        if (annotSetNode != null) {
+          rootNode.add(annotSetNode);
+          currentSelections = selectionChainsMap.get(currentAnnotSet);
+          currentColors = colorChainsMap.get(currentAnnotSet);
+          if (!corefTree.isVisible()) {
+            if (popupWindow != null && popupWindow.isVisible()) {
+              popupWindow.setVisible(false);
+            }
+            corefTree.setVisible(true);
+          }
+          corefTree.repaint();
+          corefTree.updateUI();
+
         }
-        corefTree.setVisible(true);
+        else {
+          corefTree.setVisible(false);
+        }
+    
       }
-      corefTree.repaint();
-      corefTree.updateUI();
-
-    }
-    else {
-      corefTree.setVisible(false);
-    }
+    });
   }
 
   /**

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to