OSDN Git Service

DDMS plugin: Indicate which missing files prevent it from starting
authorRaphael <raphael@google.com>
Fri, 7 Oct 2011 04:41:26 +0000 (21:41 -0700)
committerRaphael <raphael@google.com>
Fri, 7 Oct 2011 19:20:59 +0000 (12:20 -0700)
DDMS plugin checks for 3 files when the tools location is set.
If any is missing, it won't connect to ADB. However there is
no way to know that exactly. This adds a log with the path
of the missing file.

Change-Id: If7b679342e6eef314470f63998cdb701e1e1920b

eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java

index 02ca3b0..6ed677b 100644 (file)
@@ -471,8 +471,22 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
         File hprofConverter = new File(hprofConvLocation);
         File traceview = new File(traceViewLocation);
 
-        if (adb.isFile() == false || hprofConverter.isFile() == false ||
-                traceview.isFile() == false) {
+        String missing = "";
+        if (adb.isFile() == false) {
+            missing += adb.getAbsolutePath() + " ";
+        }
+        if (hprofConverter.isFile() == false) {
+            missing += hprofConverter.getAbsolutePath() + " ";
+        }
+        if (traceview.isFile() == false) {
+            missing += traceview.getAbsolutePath() + " ";
+        }
+
+        if (missing.length() > 0) {
+            String msg = String.format("DDMS files not found: %1$s", missing);
+            Log.e("DDMS", msg);
+            Status status = new Status(IStatus.ERROR, PLUGIN_ID, msg, null /*exception*/);
+            getDefault().getLog().log(status);
             return false;
         }
 
@@ -734,6 +748,9 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
         String dateTag = getMessageTag(tag);
 
         stream.print(dateTag);
+        if (!dateTag.endsWith(" ")) {
+            stream.print(" ");          //$NON-NLS-1$
+        }
         stream.println(message);
     }