allow das fetch to be blocking or non-blocking (bug #0059977)
authorjprocter <Jim Procter>
Wed, 10 Feb 2010 14:45:03 +0000 (14:45 +0000)
committerjprocter <Jim Procter>
Wed, 10 Feb 2010 14:45:03 +0000 (14:45 +0000)
src/jalview/gui/FeatureSettings.java

index 22800ea..52267d3 100755 (executable)
@@ -1102,8 +1102,9 @@ public class FeatureSettings extends JPanel
    * features from the named sources (rather than any turned on by default)
    * 
    * @param sources
+   * @param block if true then runs in same thread, otherwise passes to the Swing executor
    */
-  public void fetchDasFeatures(Vector sources)
+  public void fetchDasFeatures(Vector sources, boolean block)
   {
     initDasSources();
     Vector resolved = resolveSourceNicknames(sources);
@@ -1114,17 +1115,22 @@ public class FeatureSettings extends JPanel
     if (resolved.size() > 0)
     {
       final Vector dassources = resolved;
-      SwingUtilities.invokeLater(new Runnable()
+      fetchDAS.setEnabled(false);
+      // cancelDAS.setEnabled(true); doDasFetch does this.
+      Runnable fetcher=new Runnable()
       {
 
         public void run()
         {
-          fetchDAS.setEnabled(false);
-          cancelDAS.setEnabled(true);
           doDasFeatureFetch(dassources, true, false);
 
         }
-      });
+      };
+      if (block)
+        { fetcher.run();
+        } else {
+          SwingUtilities.invokeLater(fetcher);
+        }
     }
   }