From 0c78f4668d4ea1332ddd3bf0eab6065daffb20fc Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 14 Dec 2010 17:56:25 +0000 Subject: [PATCH] JAL-725 - show progress when opening URL in browser --- src/jalview/gui/Desktop.java | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 5e6c341..580fceb 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1274,18 +1274,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements validate(); } - public static int getViewCount(String viewId) + public static int getViewCount(String alignmentId) { - AlignViewport[] aps = getViewports(viewId); + AlignViewport[] aps = getViewports(alignmentId); return (aps == null) ? 0 : aps.length; } /** * - * @param viewId - * @return all AlignmentPanels concerning the viewId sequence set + * @param alignmentId + * @return all AlignmentPanels concerning the alignmentId sequence set */ - public static AlignmentPanel[] getAlignmentPanels(String viewId) + public static AlignmentPanel[] getAlignmentPanels(String alignmentId) { int count = 0; if (Desktop.desktop == null) @@ -1303,7 +1303,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements AlignFrame af = (AlignFrame) frames[t]; for (int a = 0; a < af.alignPanels.size(); a++) { - if (viewId + if (alignmentId .equals(((AlignmentPanel) af.alignPanels.elementAt(a)).av .getSequenceSetId())) { @@ -2155,6 +2155,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements changeSupport); } + Thread t3=null; + { + // TODO: do rest service discovery + } if (blocking) { while (alive) @@ -2167,6 +2171,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } alive = (t1 != null && t1.isAlive()) || (t2 != null && t2.isAlive()) + || (t3 != null && t3.isAlive()) || (t0 != null && t0.isAlive()); } } @@ -2230,12 +2235,24 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ public static void showUrl(final String url) { + showUrl(url, Desktop.instance); + } + /** + * Like showUrl but allows progress handler to be specified + * @param url + * @param progress (null) or object implementing IProgressIndicator + */ + public static void showUrl(final String url, final IProgressIndicator progress) + { new Thread(new Runnable() { public void run() { try { + if (progress!=null) { + progress.setProgressBar("Opening "+url, this.hashCode()); + } jalview.util.BrowserLauncher.openURL(url); } catch (Exception ex) { @@ -2249,6 +2266,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements ex.printStackTrace(); } + if (progress!=null) { + progress.setProgressBar(null, this.hashCode()); + } } }).start(); } -- 1.7.10.2