From: jprocter Date: Wed, 1 Aug 2012 15:19:23 +0000 (+0100) Subject: JAL-1130 refactored standard hyperlink handler code to desktop X-Git-Tag: Jalview_2_9~307^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=90d38cfe94515a5c34f37ecf709b387bcec82073;p=jalview.git JAL-1130 refactored standard hyperlink handler code to desktop --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 6018b28..3c34deb 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -80,8 +80,10 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; +import javax.swing.event.HyperlinkEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; +import javax.swing.event.HyperlinkEvent.EventType; /** * Jalview Desktop @@ -2574,5 +2576,33 @@ public class Desktop extends jalview.jbgui.GDesktop implements return wsparamManager; } + /** + * static hyperlink handler proxy method for use by Jalview's internal windows + * @param e + */ + public static void hyperlinkUpdate(HyperlinkEvent e) + { + if (e.getEventType() == EventType.ACTIVATED) + { + String url=null; + try + { + url = e.getURL().toString(); + Desktop.showUrl(url); + } catch (Exception x) + { + if (url!=null) { + if (Cache.log!=null) { + Cache.log.error("Couldn't handle string "+url+" as a URL."); + } else { + System.err.println("Couldn't handle string "+url+" as a URL."); + } + } + // ignore any exceptions due to dud links. + } + + } + } + } diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 9f8a8a8..51c8e83 100755 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -822,21 +822,6 @@ public class WebserviceInfo extends GWebserviceInfo implements public void hyperlinkUpdate(HyperlinkEvent e) { - if (e.getEventType() == EventType.ACTIVATED) - { - String url=null; - try - { - url = e.getURL().toString(); - Desktop.showUrl(url); - } catch (Exception x) - { - if (url!=null) { - Cache.log.error("Couldn't handle string "+url+" as a URL."); - } - // ignore any exceptions due to dud links. - } - - } + Desktop.hyperlinkUpdate(e); } }