JAL-2316 Restructure identifiers.org download
[jalview.git] / src / jalview / gui / Desktop.java
index 92e5019..41ce9a7 100644 (file)
@@ -34,11 +34,13 @@ import jalview.io.JalviewFileView;
 import jalview.jbgui.GSplitFrame;
 import jalview.jbgui.GStructureViewer;
 import jalview.structure.StructureSelectionManager;
-import jalview.urls.UrlProviderI;
+import jalview.urls.IdOrgSettings;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
+import jalview.util.UrlConstants;
 import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.UrlDownloadClient;
 import jalview.ws.params.ParamManager;
 
 import java.awt.BorderLayout;
@@ -74,6 +76,7 @@ import java.beans.PropertyChangeListener;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Hashtable;
@@ -389,6 +392,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     showNews.setVisible(false);
 
+    getIdentifiersOrgData();
+
     checkURLLinks();
 
     this.addWindowListener(new WindowAdapter()
@@ -525,6 +530,29 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     });
   }
 
+  public void getIdentifiersOrgData()
+  {
+    // Thread off the identifiers fetcher
+    addDialogThread(new Runnable()
+    {
+      @Override
+      public void run()
+      {
+        Cache.log.debug("Downloading data from identifiers.org");
+        UrlDownloadClient client = new UrlDownloadClient();
+        try
+        {
+          client.download(IdOrgSettings.getUrl(),
+                  IdOrgSettings.getDownloadLocation());
+        } catch (IOException e)
+        {
+          Cache.log.debug("Exception downloading identifiers.org data"
+                  + e.getMessage());
+        }
+      }
+    });
+  }
+
   @Override
   protected void showNews_actionPerformed(ActionEvent e)
   {
@@ -2278,7 +2306,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           // check what the actual links are - if it's just the default don't
           // bother with the warning
           Vector<String> links = Preferences.sequenceUrlLinks
-                  .getLinksForDisplay();
+                  .getLinksForMenu();
 
           // only need to check links if there is one with a
           // SEQUENCE_ID which is not the default EMBL_EBI link
@@ -2289,7 +2317,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           {
             String link = li.next();
             if (link.contains(SEQUENCE_ID)
-                    && !link.equals(UrlProviderI.DEFAULT_STRING))
+                    && !link.equals(UrlConstants.DEFAULT_STRING))
             {
               check = true;
               int barPos = link.indexOf("|");