aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/app/src
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2010-02-01 18:15:05 -0800
committerRaphael <raphael@google.com>2010-02-01 18:15:05 -0800
commitac8a9accc840aefdca84fbc1a16b408037a79b66 (patch)
treec04131ccf71b72b15b8df463e87e1fff067e6c64 /sdkmanager/app/src
parent232ddc3cc681f1e40b98fb8abc8be25beb509245 (diff)
downloadsdk-ac8a9accc840aefdca84fbc1a16b408037a79b66.zip
sdk-ac8a9accc840aefdca84fbc1a16b408037a79b66.tar.gz
sdk-ac8a9accc840aefdca84fbc1a16b408037a79b66.tar.bz2
SDK Manager: apply settings instantaneously.
SDK Bug: 2411665 Change-Id: I6d4a38f4f2d974a727d8e0891d63618d82c578ad
Diffstat (limited to 'sdkmanager/app/src')
-rwxr-xr-xsdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java54
1 files changed, 14 insertions, 40 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java b/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java
index c800054..eac7515 100755
--- a/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java
@@ -42,7 +42,6 @@ public class SettingsPage extends Composite implements ISettingsPage {
// UI widgets
private Group mProxySettingsGroup;
private Group mMiscGroup;
- private Button mApplyButton;
private Label mProxyServerLabel;
private Label mProxyPortLabel;
private Text mProxyServerText;
@@ -50,12 +49,18 @@ public class SettingsPage extends Composite implements ISettingsPage {
private Button mForceHttpCheck;
private Button mAskAdbRestartCheck;
- private ModifyListener mSetApplyDirty = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- mApplyButton.setEnabled(true);
+ private SelectionAdapter mApplyOnSelected = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ applyNewSettings(); //$hide$
}
};
+ private ModifyListener mApplyOnModified = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ applyNewSettings(); //$hide$
+ }
+ };
/**
* Create the composite.
@@ -80,7 +85,7 @@ public class SettingsPage extends Composite implements ISettingsPage {
mProxyServerText = new Text(mProxySettingsGroup, SWT.BORDER);
mProxyServerText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- mProxyServerText.addModifyListener(mSetApplyDirty);
+ mProxyServerText.addModifyListener(mApplyOnModified);
mProxyServerText.setToolTipText(tooltip);
mProxyPortLabel = new Label(mProxySettingsGroup, SWT.NONE);
@@ -92,7 +97,7 @@ public class SettingsPage extends Composite implements ISettingsPage {
mProxyPortText = new Text(mProxySettingsGroup, SWT.BORDER);
mProxyPortText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- mProxyPortText.addModifyListener(mSetApplyDirty);
+ mProxyPortText.addModifyListener(mApplyOnModified);
mProxyPortText.setToolTipText(tooltip);
mMiscGroup = new Group(this, SWT.NONE);
@@ -105,34 +110,14 @@ public class SettingsPage extends Composite implements ISettingsPage {
mForceHttpCheck.setText("Force https://... sources to be fetched using http://...");
mForceHttpCheck.setToolTipText("If you are not able to connect to the official Android repository " +
"using HTTPS, enable this setting to force accessing it via HTTP.");
- mForceHttpCheck.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- onForceHttpSelected(); //$hide$
- }
- });
+ mForceHttpCheck.addSelectionListener(mApplyOnSelected);
mAskAdbRestartCheck = new Button(mMiscGroup, SWT.CHECK);
mAskAdbRestartCheck.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
mAskAdbRestartCheck.setText("Ask before restarting ADB");
mAskAdbRestartCheck.setToolTipText("When checked, the user will be asked for permission " +
"to restart ADB after updating an addon-on package or a tool package.");
- mAskAdbRestartCheck.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- onForceHttpSelected(); //$hide$
- }
- });
-
- mApplyButton = new Button(this, SWT.NONE);
- mApplyButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- mApplyButton.setText("Save && Apply");
- mApplyButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- onApplySelected(); //$hide$
- }
- });
+ mAskAdbRestartCheck.addSelectionListener(mApplyOnSelected);
postCreate(); //$hide$
}
@@ -164,9 +149,6 @@ public class SettingsPage extends Composite implements ISettingsPage {
mProxyPortText.setText( in_settings.getProperty(KEY_HTTP_PROXY_PORT, "")); //$NON-NLS-1$
mForceHttpCheck.setSelection(Boolean.parseBoolean(in_settings.getProperty(KEY_FORCE_HTTP)));
mAskAdbRestartCheck.setSelection(Boolean.parseBoolean(in_settings.getProperty(KEY_ASK_ADB_RESTART)));
-
- // We loaded fresh settings so there's nothing dirty to apply
- mApplyButton.setEnabled(false);
}
/** Called by the application to retrieve settings from the UI and store them in
@@ -193,20 +175,12 @@ public class SettingsPage extends Composite implements ISettingsPage {
* Callback invoked when user presses the "Save and Apply" button.
* Notify the application that settings have changed.
*/
- private void onApplySelected() {
+ private void applyNewSettings() {
if (mSettingsChangedCallback != null) {
mSettingsChangedCallback.onSettingsChanged(this);
- mApplyButton.setEnabled(false);
}
}
- /**
- * Callback invoked when the users presses the Force HTTPS checkbox.
- */
- private void onForceHttpSelected() {
- mSetApplyDirty.modifyText(null);
- }
-
// End of hiding from SWT Designer
//$hide<<$
}