From 6f694e726408981d940e3352cb4b9cdce4a122f6 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 10 Feb 2010 14:45:03 +0000 Subject: [PATCH] allow das fetch to be blocking or non-blocking (bug #0059977) --- src/jalview/gui/FeatureSettings.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 22800ea..52267d3 100755 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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); + } } } -- 1.7.10.2