X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;fp=src%2Fjalview%2Fgui%2FPreferences.java;h=d4c9689444233f4701231ac952d1464a151543c6;hb=88acca19255b75f23d6a3c3a07756e2ca3c04402;hp=3fd8393441542c12405ff739875df44bcd1a553b;hpb=2870c673db9f3e6b5848757f2e9b873d334261fa;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 3fd8393..d4c9689 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -193,7 +193,12 @@ public class Preferences extends GPreferences public Preferences(int selectTab) { - super(selectTab); + new Preferences(selectTab, null); + } + + public Preferences(int selectTab, String message) + { + super(selectTab, message); frame = new JInternalFrame(); frame.setContentPane(this); wsPrefs = new WsPreferences(); @@ -505,9 +510,9 @@ public class Preferences extends GPreferences 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); + Cache.log.warn( + "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): " + + proxyTypeString); } proxyServerHttpTB.setText(Cache.getDefault("PROXY_SERVER", "")); proxyPortHttpTB.setText(Cache.getDefault("PROXY_PORT", "")); @@ -518,7 +523,7 @@ public class Preferences extends GPreferences .setText(Cache.getDefault("PROXY_AUTH_USERNAME", "")); // we are not storing or retrieving proxy password from .jalview_properties proxyAuthPasswordTB.setText(Cache.proxyAuthPassword == null ? "" - : Cache.proxyAuthPassword.toString()); + : new String(Cache.proxyAuthPassword)); setCustomProxyEnabled(); defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", "")); @@ -850,41 +855,6 @@ public class Preferences extends GPreferences } } - public void setProxyFromSettings() - { - String proxyType = Cache.getDefault("USE_PROXY", - Cache.PROXYTYPE_SYSTEM); - if (proxyType.equals(Cache.PROXYTYPE_NONE)) - { - if (!previousProxyType.equals(proxyType)) - Cache.log.info("Setting no proxy settings"); - Cache.setProxyProperties(null, null, null, null, null, null, null, - null, null); - } - else if (proxyType.equals(Cache.PROXYTYPE_CUSTOM)) - { - if (!previousProxyType.equals(proxyType)) - Cache.log.info("Setting custom proxy settings"); - boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false); - Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null), - Cache.getDefault("PROXY_PORT", null), - Cache.getDefault("PROXY_SERVER_HTTPS", null), - Cache.getDefault("PROXY_PORT_HTTPS", null), - proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "") - : null, - proxyAuthSet ? Cache.proxyAuthPassword : null, - proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "") - : null, - proxyAuthSet ? Cache.proxyAuthPassword : null, "localhost"); - } - else // systemProxy should be selected and is sensible default anyway - { - if (!previousProxyType.equals(proxyType)) - Cache.log.info("Setting system proxy settings"); - Cache.resetProxyProperties(); - } - } - public void saveProxySettings() { Cache.applicationProperties.setProperty("USE_PROXY", @@ -899,7 +869,7 @@ public class Preferences extends GPreferences Boolean.toString(proxyAuth.isSelected())); Cache.setOrRemove("PROXY_AUTH_USERNAME", proxyAuthUsernameTB.getText()); Cache.proxyAuthPassword = proxyAuthPasswordTB.getPassword(); - setProxyFromSettings(); + Cache.setProxyPropertiesFromPreferences(previousProxyType); } /**