aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-09-03 17:14:29 -0700
committerXavier Ducrohet <xav@android.com>2010-09-03 17:25:49 -0700
commit0b21937765ca5307a6a7e244ba4eddd36954b9cf (patch)
tree0158022cbfffe20f234920a61514c814d1ea59c3 /eclipse/plugins/com.android.ide.eclipse.hierarchyviewer
parentd739049a624f4492bf292cde501af39a77b01624 (diff)
downloadsdk-0b21937765ca5307a6a7e244ba4eddd36954b9cf.zip
sdk-0b21937765ca5307a6a7e244ba4eddd36954b9cf.tar.gz
sdk-0b21937765ca5307a6a7e244ba4eddd36954b9cf.tar.bz2
DDMS now receives the adb location through an extension point.
Previously DDMS received the adb location through a normal Java API which requires the other plug-in to be actually running (This was done in the the start method of ADT). The new change allows DDMS to start a plug-in (by loading an extension provided by the plug-in) to query for the location of adb. This allows us to have plug-ins with no UI able to provide the location of ADB (ie a "platform" plug-in that has no UI besides a pref page, that is started by DDMS indirectly). Also cleaned up how HierarchyViewer use the AndroidDebugBridge. Change-Id: I8e842a294eea94c06417149144a2ce435e719cfd
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.hierarchyviewer')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java49
1 files changed, 15 insertions, 34 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
index 978cfac..9bc3993 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
@@ -16,7 +16,9 @@
package com.android.ide.eclipse.hierarchyviewer;
+import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.Log;
+import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
import com.android.ddmlib.Log.ILogOutput;
import com.android.ddmlib.Log.LogLevel;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
@@ -111,11 +113,23 @@ public class HierarchyViewerPlugin extends AbstractUIPlugin {
});
final HierarchyViewerDirector director = HierarchyViewerPluginDirector.createDirector();
+ director.startListenForDevices();
+ // make the director receive change in ADB.
+ AndroidDebugBridge.addDebugBridgeChangeListener(new IDebugBridgeChangeListener() {
+ public void bridgeChanged(AndroidDebugBridge bridge) {
+ director.acquireBridge(bridge);
+ }
+ });
+
+ // get the current ADB if any
+ director.acquireBridge(AndroidDebugBridge.getBridge());
+
+ // populate the UI with current devices (if any) in a thread
new Thread() {
@Override
public void run() {
- initDirector(director);
+ director.populateDeviceSelectionModel();
}
}.start();
}
@@ -149,39 +163,6 @@ public class HierarchyViewerPlugin extends AbstractUIPlugin {
}
/**
- * Set the location of the adb executable and optionally starts adb
- *
- * @param adb location of adb
- * @param startAdb flag to start adb
- */
- public static void setAdb(String adb, boolean startAdb) {
- if (adb != null) {
- // store the location for future ddms only start.
- sPlugin.getPreferenceStore().setValue(ADB_LOCATION, adb);
-
- // starts the server in a thread in case this is blocking.
- if (startAdb) {
- new Thread() {
- @Override
- public void run() {
- initDirector(HierarchyViewerDirector.getDirector());
- }
- }.start();
- }
- }
- }
-
- private static boolean initDirector(HierarchyViewerDirector director) {
- if (director.acquireBridge()) {
- director.startListenForDevices();
- director.populateDeviceSelectionModel();
- return true;
- }
-
- return false;
- }
-
- /**
* Prints a message, associated with a project to the specified stream
*
* @param stream The stream to write to