If browser not set, remove property
[jalview.git] / src / jalview / gui / Preferences.java
index c44436d..32052f7 100755 (executable)
@@ -194,8 +194,15 @@ public class Preferences extends GPreferences
       Cache.applicationProperties.setProperty("STARTUP_FILE", startupFileTextfield.getText());\r
       Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",  Boolean.toString(startupCheckbox.isSelected()));\r
 \r
-      Cache.applicationProperties.setProperty("DEFAULT_BROWSER", defaultBrowser.getText());\r
-      jalview.util.BrowserLauncher.resetBrowser();\r
+      if(defaultBrowser.getText().trim().length()<1)\r
+        Cache.applicationProperties.remove("DEFAULT_BROWSER");\r
+      else\r
+      {\r
+        Cache.applicationProperties.setProperty("DEFAULT_BROWSER",\r
+                                                defaultBrowser.getText());\r
+        jalview.util.BrowserLauncher.resetBrowser();\r
+      }\r
+\r
         if(nameLinks.size()>0)\r
         {\r
           StringBuffer links = new StringBuffer();\r
@@ -210,10 +217,22 @@ public class Preferences extends GPreferences
           links.setLength( links.length()-1 );\r
           Cache.applicationProperties.setProperty("SEQUENCE_LINKS", links.toString());\r
         }\r
+        else\r
+          Cache.applicationProperties.remove("SEQUENCE_LINKS");\r
+\r
 \r
         Cache.applicationProperties.setProperty("USE_PROXY", Boolean.toString(useProxy.isSelected()));\r
-        Cache.applicationProperties.setProperty("PROXY_SERVER",proxyServerTB.getText());\r
-        Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText());\r
+\r
+        if (proxyServerTB.getText().trim().length() < 1)\r
+          Cache.applicationProperties.remove("PROXY_SERVER");\r
+        else\r
+          Cache.applicationProperties.setProperty("PROXY_SERVER",\r
+                                                  proxyServerTB.getText());\r
+\r
+        if (proxyPortTB.getText().trim().length() < 1)\r
+          Cache.applicationProperties.remove("PROXY_PORT");\r
+        else\r
+          Cache.applicationProperties.setProperty("PROXY_PORT", proxyPortTB.getText());\r
 \r
         if(useProxy.isSelected())\r
         {\r