diff options
author | Siva Velusamy <vsiva@google.com> | 2011-12-19 15:20:32 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2011-12-19 15:20:32 -0800 |
commit | 939fcf8c656eadcfe325bb877f824b5c74068167 (patch) | |
tree | 2540d0cdb34347b27fb14b592667f8ce3bf5f8c0 | |
parent | 97322e8733f3c89e011415f66794aac3370512e0 (diff) | |
download | sdk-939fcf8c656eadcfe325bb877f824b5c74068167.zip sdk-939fcf8c656eadcfe325bb877f824b5c74068167.tar.gz sdk-939fcf8c656eadcfe325bb877f824b5c74068167.tar.bz2 |
Do not initialize DDMS Console from ADT plugin.
When ADT plugin starts up, it attempts to set the console to be used
for certain parts of DDMS to be the Android console.
Doing this however causes the DDMS plugin to be activated, which
launches adb server if it is not already there.
Removing this enables us to not touch adb unnecessarily.
This patch moves the initialization of the DDMS console into the
DDMS plugin, and uses the DDMS console as opposed to the Android
console for messages from DDMS.
Change-Id: I010a7028a2f22ac4da1c55903e001dcdd329d91f
2 files changed, 30 insertions, 19 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index ff0effa..6e6c798 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -17,8 +17,6 @@ package com.android.ide.eclipse.adt; import com.android.AndroidConstants; -import com.android.ddmuilib.console.DdmConsole; -import com.android.ddmuilib.console.IDdmConsole; import com.android.ide.common.log.ILogger; import com.android.ide.common.resources.ResourceFile; import com.android.ide.common.sdk.LoadStatus; @@ -218,22 +216,6 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { } }); - // set up the ddms console to use this objects - DdmConsole.setConsole(new IDdmConsole() { - public void printErrorToConsole(String message) { - AdtPlugin.printErrorToConsole((String)null, message); - } - public void printErrorToConsole(String[] messages) { - AdtPlugin.printErrorToConsole((String)null, (Object[])messages); - } - public void printToConsole(String message) { - AdtPlugin.printToConsole((String)null, message); - } - public void printToConsole(String[] messages) { - AdtPlugin.printToConsole((String)null, (Object[])messages); - } - }); - // get the eclipse store IPreferenceStore eclipseStore = getPreferenceStore(); AdtPrefs.init(eclipseStore); diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java index 6ed677b..93c4142 100644 --- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java @@ -27,6 +27,8 @@ import com.android.ddmlib.Log.LogLevel; import com.android.ddmuilib.DdmUiPreferences; import com.android.ddmuilib.StackTracePanel; import com.android.ddmuilib.DevicePanel.IUiSelectionListener; +import com.android.ddmuilib.console.DdmConsole; +import com.android.ddmuilib.console.IDdmConsole; import com.android.ide.eclipse.ddms.i18n.Messages; import com.android.ide.eclipse.ddms.preferences.PreferenceInitializer; @@ -169,7 +171,7 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL public void printLog(LogLevel logLevel, String tag, String message) { if (logLevel.getPriority() >= LogLevel.ERROR.getPriority()) { printToStream(errorConsoleStream, tag, message); - ConsolePlugin.getDefault().getConsoleManager().showConsoleView(mDdmsConsole); + showConsoleView(mDdmsConsole); } else { printToStream(consoleStream, tag, message); } @@ -193,6 +195,28 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL }); + // set up the ddms console to use this objects + DdmConsole.setConsole(new IDdmConsole() { + public void printErrorToConsole(String message) { + printToStream(errorConsoleStream, null, message); + showConsoleView(mDdmsConsole); + } + public void printErrorToConsole(String[] messages) { + for (String m : messages) { + printToStream(errorConsoleStream, null, m); + } + showConsoleView(mDdmsConsole); + } + public void printToConsole(String message) { + printToStream(consoleStream, null, message); + } + public void printToConsole(String[] messages) { + for (String m : messages) { + printToStream(consoleStream, null, m); + } + } + }); + // set the listener for the preference change eclipseStore.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { @@ -309,6 +333,11 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL }.schedule(); } + private void showConsoleView(MessageConsole console) { + ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console); + } + + private IConfigurationElement[] findConfigElements(String name) { // get the adb location from an implementation of the ADB Locator extension point. |