X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=f337898415aeae7010b9338a52fa35093039faed;hb=a934d28336923f2966aeac29f7d1a877e5db1cec;hp=c61c70e30be633b42f8d72731bf34d7f87b2cbcd;hpb=0fd3b7ae342185573d564705d087f7e6d2abd78c;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index c61c70e..f337898 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -536,10 +536,27 @@ public class Preferences extends GPreferences } } - useProxy.setSelected(Cache.getDefault("USE_PROXY", false)); - useProxy_actionPerformed(); // make sure useProxy is correctly initialised - proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", "")); - proxyPortTB.setText(Cache.getDefault("PROXY_PORT", "")); + String proxyTypeString = Cache.getDefault("USE_PROXY", "false"); + switch (proxyTypeString) + { + case "none": + proxyType.setSelected(noProxy.getModel(), true); + break; + case "false": + proxyType.setSelected(systemProxy.getModel(), true); + break; + case "true": + proxyType.setSelected(customProxy.getModel(), true); + break; + default: + String message = "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): " + + proxyTypeString; + Cache.log.warn(message); + } + proxyServerHttpTB.setText(Cache.getDefault("PROXY_SERVER", "")); + proxyPortHttpTB.setText(Cache.getDefault("PROXY_PORT", "")); + proxyServerHttpsTB.setText(Cache.getDefault("PROXY_SERVER_HTTPS", "")); + proxyPortHttpsTB.setText(Cache.getDefault("PROXY_PORT_HTTPS", "")); defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", "")); @@ -812,22 +829,35 @@ public class Preferences extends GPreferences sequenceUrlLinks.getPrimaryUrlId()); Cache.applicationProperties.setProperty("USE_PROXY", - Boolean.toString(useProxy.isSelected())); + customProxy.isSelected() ? "true" + : noProxy.isSelected() ? "none" : "false"); + + Cache.setOrRemove("PROXY_SERVER", proxyServerHttpTB.getText()); - Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText()); + Cache.setOrRemove("PROXY_PORT", proxyPortHttpTB.getText()); - Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText()); + Cache.setOrRemove("PROXY_SERVER_HTTPS", proxyServerHttpsTB.getText()); - if (useProxy.isSelected()) + Cache.setOrRemove("PROXY_PORT_HTTPS", proxyPortHttpsTB.getText()); + + if (noProxy.isSelected()) { - System.setProperty("http.proxyHost", proxyServerTB.getText()); - System.setProperty("http.proxyPort", proxyPortTB.getText()); + Cache.log.warn("Setting no proxy settings"); + Cache.setProxyProperties(null, null, null, null); } - else + else if (customProxy.isSelected()) { - System.setProperty("http.proxyHost", ""); - System.setProperty("http.proxyPort", ""); + Cache.log.warn("Setting custom proxy settings"); + Cache.setProxyProperties(proxyServerHttpTB.getText(), + proxyPortHttpTB.getText(), proxyServerHttpsTB.getText(), + proxyPortHttpsTB.getText()); } + else // systemProxy should be selected and is sensible default + { + Cache.log.warn("Setting system proxy settings"); + Cache.resetProxyProperties(); + } + Cache.setProperty("VERSION_CHECK", Boolean.toString(versioncheck.isSelected())); if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected())