JAL-2316 Restructure identifiers.org download
[jalview.git] / src / jalview / gui / Preferences.java
index 550f324..efe1ed6 100755 (executable)
@@ -128,10 +128,13 @@ public class Preferences extends GPreferences
   public static List<String> groupURLLinks;
   static
   {
-    String string = Cache.getDefault("SEQUENCE_LINKS",
+    String inMenuString = Cache.getDefault("SEQUENCE_LINKS",
             UrlConstants.DEFAULT_STRING);
-    UrlProviderFactoryI factory = new DesktopUrlProviderFactory(
-            UrlConstants.DEFAULT_LABEL, string);
+    String notInMenuString = Cache.getDefault("STORED_LINKS", "");
+    String defaultUrl = Cache.getDefault("DEFAULT_URL",
+            UrlConstants.DEFAULT_LABEL);
+    UrlProviderFactoryI factory = new DesktopUrlProviderFactory(defaultUrl,
+            inMenuString, notInMenuString);
     sequenceUrlLinks = factory.createUrlProvider();
     dataModel = new UrlLinkTableModel(sequenceUrlLinks);
 
@@ -414,7 +417,7 @@ public class Preferences extends GPreferences
 
     // set up radio buttons
     linkUrlTable.getColumn("Default").setCellRenderer(
-            new RadioButtonRenderer());
+               new RadioButtonRenderer());
     linkUrlTable.getColumn("Default")
             .setCellEditor(new RadioButtonEditor());
 
@@ -635,17 +638,31 @@ public class Preferences extends GPreferences
     jalview.util.BrowserLauncher.resetBrowser();
 
     // save user-defined and selected links
-    String links = linkUrlTable.getModel().toString();
-    if (links.isEmpty())
+    String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
+    if (menuLinks.isEmpty())
     {
       Cache.applicationProperties.remove("SEQUENCE_LINKS");
     }
     else
     {
       Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
-              links.toString());
+              menuLinks.toString());
     }
 
+    String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
+    if (nonMenuLinks.isEmpty())
+    {
+      Cache.applicationProperties.remove("STORED_LINKS");
+    }
+    else
+    {
+      Cache.applicationProperties.setProperty("STORED_LINKS",
+              nonMenuLinks.toString());
+    }
+
+    Cache.applicationProperties.setProperty("DEFAULT_URL",
+            sequenceUrlLinks.getDefaultUrlId());
+
     Cache.applicationProperties.setProperty("USE_PROXY",
             Boolean.toString(useProxy.isSelected()));