diff options
author | Pierre Zurek <pierrezurek@gmail.com> | 2010-09-30 21:35:11 +0200 |
---|---|---|
committer | Pierre Zurek <pierrezurek@gmail.com> | 2011-01-12 00:03:35 +0100 |
commit | ff0b9891ab1650c6d06509ad4ae202c77e202cc3 (patch) | |
tree | 4ed7627281df1f17d2ff547c62d2a6a8d387ccde /ddms/app/src | |
parent | c2c5bf104f24205ee46c2d1415f2d9c4991d1ed4 (diff) | |
download | sdk-ff0b9891ab1650c6d06509ad4ae202c77e202cc3.zip sdk-ff0b9891ab1650c6d06509ad4ae202c77e202cc3.tar.gz sdk-ff0b9891ab1650c6d06509ad4ae202c77e202cc3.tar.bz2 |
Allow the user to set the ADBHOST variable.
With those changes the ADBHOST variable can be
directly set in the Preferences of DDMS and Eclipse,
so that the user can reset adb from inside those
two programs.
Change-Id: I94b24744e8daa3b3b2fe5a3db39203b39cb093ac
Diffstat (limited to 'ddms/app/src')
-rw-r--r-- | ddms/app/src/com/android/ddms/PrefsDialog.java | 33 | ||||
-rw-r--r-- | ddms/app/src/com/android/ddms/UIThread.java | 13 |
2 files changed, 46 insertions, 0 deletions
diff --git a/ddms/app/src/com/android/ddms/PrefsDialog.java b/ddms/app/src/com/android/ddms/PrefsDialog.java index fbdbfe6..418b8ba 100644 --- a/ddms/app/src/com/android/ddms/PrefsDialog.java +++ b/ddms/app/src/com/android/ddms/PrefsDialog.java @@ -36,6 +36,7 @@ import org.eclipse.jface.preference.PreferenceNode; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.preference.PreferenceStore; import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; @@ -85,6 +86,8 @@ public final class PrefsDialog { private final static String PREFS_THREAD_REFRESH_INTERVAL = "threadStatusInterval"; //$NON-NLS-1$ private final static String PREFS_LOG_LEVEL = "ddmsLogLevel"; //$NON-NLS-1$ private final static String PREFS_TIMEOUT = "timeOut"; //$NON-NLS-1$ + private final static String PREFS_USE_ADBHOST = "useAdbHost"; //$NON-NLS-1$ + private final static String PREFS_ADBHOST_VALUE = "adbHostValue"; //$NON-NLS-1$ /** @@ -151,6 +154,8 @@ public final class PrefsDialog { DdmPreferences.setInitialThreadUpdate(mPrefStore.getBoolean(PREFS_DEFAULT_THREAD_UPDATE)); DdmPreferences.setInitialHeapUpdate(mPrefStore.getBoolean(PREFS_DEFAULT_HEAP_UPDATE)); DdmPreferences.setTimeOut(mPrefStore.getInt(PREFS_TIMEOUT)); + DdmPreferences.setUseAdbHost(mPrefStore.getBoolean(PREFS_USE_ADBHOST)); + DdmPreferences.setAdbHostValue(mPrefStore.getString(PREFS_ADBHOST_VALUE)); // some static values String out = System.getenv("ANDROID_PRODUCT_OUT"); //$NON-NLS-1$ @@ -185,6 +190,9 @@ public final class PrefsDialog { mPrefStore.setDefault(PREFS_SELECTED_DEBUG_PORT, DdmPreferences.DEFAULT_SELECTED_DEBUG_PORT); + mPrefStore.setDefault(PREFS_USE_ADBHOST, DdmPreferences.DEFAULT_USE_ADBHOST); + mPrefStore.setDefault(PREFS_ADBHOST_VALUE, DdmPreferences.DEFAULT_ADBHOST_VALUE); + mPrefStore.setDefault(PREFS_DEFAULT_THREAD_UPDATE, true); mPrefStore.setDefault(PREFS_DEFAULT_HEAP_UPDATE, false); mPrefStore.setDefault(PREFS_THREAD_REFRESH_INTERVAL, @@ -239,6 +247,10 @@ public final class PrefsDialog { (String) event.getNewValue()); } else if (changed.equals(PREFS_TIMEOUT)) { DdmPreferences.setTimeOut(mPrefStore.getInt(PREFS_TIMEOUT)); + } else if (changed.equals(PREFS_USE_ADBHOST)) { + DdmPreferences.setUseAdbHost(mPrefStore.getBoolean(PREFS_USE_ADBHOST)); + } else if (changed.equals(PREFS_ADBHOST_VALUE)) { + DdmPreferences.setAdbHostValue(mPrefStore.getString(PREFS_ADBHOST_VALUE)); } else { Log.v("ddms", "Preference change: " + event.getProperty() + ": '" + event.getOldValue() @@ -301,6 +313,9 @@ public final class PrefsDialog { */ private static class DebuggerPrefs extends FieldEditorPreferencePage { + private BooleanFieldEditor mUseAdbHost; + private StringFieldEditor mAdbHostValue; + /** * Basic constructor. */ @@ -323,6 +338,24 @@ public final class PrefsDialog { ife = new PortFieldEditor(PREFS_SELECTED_DEBUG_PORT, "Port of Selected VM:", getFieldEditorParent()); addField(ife); + + mUseAdbHost = new BooleanFieldEditor(PREFS_USE_ADBHOST, + "Use ADBHOST", getFieldEditorParent()); + addField(mUseAdbHost); + + mAdbHostValue = new StringFieldEditor(PREFS_ADBHOST_VALUE, + "ADBHOST value:", getFieldEditorParent()); + mAdbHostValue.setEnabled(getPreferenceStore() + .getBoolean(PREFS_USE_ADBHOST), getFieldEditorParent()); + addField(mAdbHostValue); + } + + @Override + public void propertyChange(PropertyChangeEvent event) { + // TODO Auto-generated method stub + if (event.getSource().equals(mUseAdbHost)) { + mAdbHostValue.setEnabled(mUseAdbHost.getBooleanValue(), getFieldEditorParent()); + } } } diff --git a/ddms/app/src/com/android/ddms/UIThread.java b/ddms/app/src/com/android/ddms/UIThread.java index 4e2bb06..2dc1cf0 100644 --- a/ddms/app/src/com/android/ddms/UIThread.java +++ b/ddms/app/src/com/android/ddms/UIThread.java @@ -769,12 +769,25 @@ public class UIThread implements IUiSelectionListener, IClientChangeListener { } }); + final MenuItem actionResetAdb = new MenuItem(actionMenu, SWT.NONE); + actionResetAdb.setText("&Reset adb"); + actionResetAdb.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AndroidDebugBridge bridge = AndroidDebugBridge.getBridge(); + if (bridge != null) { + bridge.restart(); + } + } + }); + // configure Action items based on current state actionMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent e) { actionHaltItem.setEnabled(mTBHalt.getEnabled() && mCurrentClient != null); actionCauseGcItem.setEnabled(mTBCauseGc.getEnabled() && mCurrentClient != null); + actionResetAdb.setEnabled(true); } }); |