- if (e.getClickCount() == 2)\r
- {\r
- int y = e.getY();\r
-\r
- if (av.getWrapAlignment())\r
- {\r
- y -= (2 * av.charHeight);\r
- }\r
-\r
- int seq = av.getIndex(y);\r
- String id = av.getAlignment().getSequenceAt(seq).getName();\r
-\r
- try\r
- {\r
- jalview.util.BrowserLauncher.openURL(\r
- "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:" +\r
- id + "]+-vn+2");\r
- }\r
- catch (Exception ex)\r
- {\r
- // TODO: JBPNote : state dependent error message for real browserLaunch problems rather than unix misconfiguration.\r
- System.err.println(ex.getMessage() +\r
- "\nUnixers: Try adding this jalview.browser property line \n" +\r
- "in your jalview.properties file (/usr/local/bin/firefox is an exanmple browser path):\n" +\r
- "jalview.browser=/usr/local/bin/firefox\n");\r
-\r
- //ex.printStackTrace();\r
- }\r
- }\r
+ if (e.getClickCount() < 2)\r
+ return;\r
+\r
+ java.util.Vector links = Preferences.sequenceURLLinks;\r
+ if (links == null || links.size() < 1)\r
+ return;\r
+\r
+ int y = e.getY();\r
+\r
+ if (av.getWrapAlignment())\r
+ {\r
+ y = getWrappedY(y);\r
+ }\r
+\r
+ //DEFAULT LINK IS FIRST IN THE LINK LIST\r
+ int seq = av.getIndex(y);\r
+ if(seq==-1)\r
+ return;\r
+\r
+ String id = av.getAlignment().getSequenceAt(seq).getName();\r
+ if (id.indexOf("|") > -1)\r
+ id = id.substring(id.lastIndexOf("|") + 1);\r
+\r
+\r
+ String url = links.elementAt(0).toString();\r
+ url = url.substring(url.indexOf("|")+1);\r
+\r
+ int index = url.indexOf("$SEQUENCE_ID$");\r
+ url = url.substring(0, index)+ id + url.substring(index+13);\r
+\r
+ try\r
+ {\r
+ jalview.util.BrowserLauncher.openURL(url);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Unixers: Couldn't find default web browser."\r
+ +"\nAdd the full path to your browser in Preferences.",\r
+ "Web browser not found", JOptionPane.WARNING_MESSAGE );\r
+ ex.printStackTrace();\r
+ }\r