public void reset()
{
offlineMode.setSelected(WorkspaceSettings.getInstance().isOfflineMode());
rememberPasswordsBox.setSelected(WorkspaceSettings.getInstance().isRememberPasswords());
final ProxySettings proxySettings = ProxySettings.getInstance();
final String httpProxyHost = proxySettings.getHTTPProxyHost();
final String proxyHost = proxySettings.getSocksProxyHost();
switch (proxySettings.getProxyType())
{
case NO_PROXY:
{
buttonGroup.setSelected(radioButtonNoProxy.getModel(), true);
proxyHostTextField.setText("");
proxyPortTextField.setText("");
userTextField.setText("");
passwordField.setText("");
enableProxyFields(false);
enableAuthenticationFields(false);
break;
}
case AUTO_DETECT_PROXY:
{
buttonGroup.setSelected(radioButtonAutoDetectProxy.getModel(), true);
if (httpProxyHost != null &&
httpProxyHost.trim().length() > 0)
{
proxyHostTextField.setText(httpProxyHost);
proxyPortTextField.setText(String.valueOf(proxySettings.getHTTPProxyPort()));
socksCheckBox.setSelected(false);
}
else if (proxyHost != null && proxyHost.trim().length() > 0)
{
proxyHostTextField.setText(proxyHost);
proxyPortTextField.setText(String.valueOf(proxySettings.getSocksProxyPort()));
socksCheckBox.setSelected(true);
}
else
{
proxyHostTextField.setText("");
proxyPortTextField.setText("");
socksCheckBox.setSelected(false);
}
enableProxyFields(false);
userTextField.setText("");
passwordField.setText("");
enableAuthenticationFields(true);
break;
}
case USER_PROXY:
{
buttonGroup.setSelected(radioButtonUserProxy.getModel(), true);
if (proxySettings.isUseSocksProxy())
{
proxyHostTextField.setText(proxyHost);
proxyPortTextField.setText(String.valueOf(proxySettings.getSocksProxyPort()));
}
else
{
proxyHostTextField.setText(httpProxyHost);
proxyPortTextField.setText(String.valueOf(proxySettings.getHTTPProxyPort()));
}
socksCheckBox.setSelected(proxySettings.isUseSocksProxy());
enableProxyFields(true);
enableAuthenticationFields(true);
userTextField.setText(proxySettings.getProxyUser());
passwordField.setText(proxySettings.getProxyPassword());
break;
}
}
userTextField.setText(proxySettings.getProxyUser());
passwordField.setText(proxySettings.getProxyPassword());
}