From 2424c25838a3f3f6e5e46b5983a053a67d44a6e9 Mon Sep 17 00:00:00 2001 From: kiramt Date: Fri, 4 Nov 2016 11:10:36 +0000 Subject: [PATCH] JAL-2282 Message box stays on top at Jalview open; checks for links before deciding whether to display. --- src/jalview/gui/Desktop.java | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 632dae3..4d10cc8 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -20,6 +20,8 @@ */ package jalview.gui; +import static jalview.util.UrlConstants.EMBLEBI_STRING; + import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; @@ -2271,6 +2273,21 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (Cache.getDefault("CHECKURLLINKS", true)) { + // check what the actual links are - if it's just the default don't + // bother with the warning + Vector links = Preferences.sequenceURLLinks; + if (links == null || links.size() < 1) + { + // there are no links + return; + } + else if ((links.size() == 1) + && links.get(0).equals(EMBLEBI_STRING)) + { + // the only link is the default EMBL-EBI link + return; + } + // check in case URL links use old style tokens ($SEQUENCE_ID$ for // sequence id _or_ accession id) JPanel msgPanel = new JPanel(); @@ -2306,9 +2323,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements }); msgPanel.add(jcb); - JOptionPane.showMessageDialog(null, msgPanel, MessageManager - .getString("label.SEQUENCE_ID_no_longer_used"), + JOptionPane.showMessageDialog(Desktop.desktop, msgPanel, + MessageManager + .getString("label.SEQUENCE_ID_no_longer_used"), JOptionPane.WARNING_MESSAGE); + } } }); -- 1.7.10.2