check if ddms is available before launching debug

This commit is contained in:
Eugene Kudelevsky
2011-01-21 18:36:38 +03:00
parent fcb29b6627
commit 6c3feb929d
2 changed files with 14 additions and 1 deletions
@@ -300,7 +300,7 @@ public abstract class AndroidRunConfigurationBase extends ModuleBasedConfigurati
return true;
}
private static boolean isDdmsCorrupted(@NotNull AndroidFacet facet) {
static boolean isDdmsCorrupted(@NotNull AndroidFacet facet) {
AndroidDebugBridge bridge = facet.getDebugBridge();
if (bridge != null) {
IDevice[] devices = bridge.getDevices();
@@ -574,6 +574,10 @@ public abstract class AndroidRunningState implements RunProfileState, AndroidDeb
myApplicationDeployed = true;
}
if (!myApplicationLauncher.launch(this, device)) return false;
if (!checkDdms()) {
return false;
}
synchronized (myDebugLock) {
Client client = device.getClient(myTargetPackageName);
if (client != null) {
@@ -600,6 +604,15 @@ public abstract class AndroidRunningState implements RunProfileState, AndroidDeb
}
}
private boolean checkDdms() {
if (myDebugMode && AndroidRunConfigurationBase.isDdmsCorrupted(myFacet)) {
getProcessHandler()
.notifyTextAvailable("Debug info is not available. Please close other application using ADB: DDMS, Eclipse\n", STDERR);
return false;
}
return true;
}
private boolean uploadAndInstallDependentModules(@NotNull IDevice device) throws IOException {
for (AndroidFacet depFacet : myAdditionalFacet2PackageName.keySet()) {
String packageName = myAdditionalFacet2PackageName.get(depFacet);