JAL-2282 Message box stays on top at Jalview open; checks for links
authorkiramt <k.mourao@dundee.ac.uk>
Fri, 4 Nov 2016 11:10:36 +0000 (11:10 +0000)
committerkiramt <k.mourao@dundee.ac.uk>
Fri, 4 Nov 2016 11:10:36 +0000 (11:10 +0000)
before deciding whether to display.

src/jalview/gui/Desktop.java

index 632dae3..4d10cc8 100644 (file)
@@ -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<String> 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);
+
         }
       }
     });