diff options
author | Tor Norbye <tnorbye@google.com> | 2012-05-31 12:44:44 -0700 |
---|---|---|
committer | android code review <noreply-gerritcodereview@google.com> | 2012-05-31 12:44:45 -0700 |
commit | 791cb2d5d16701c8daeced9a36604c35be9acb13 (patch) | |
tree | 2dbc2fd634730ad70aa4484291de50277813da49 | |
parent | 12a5400414ec295f08bba82a9020bcfa9dab65f4 (diff) | |
parent | f47baf1439853c55aef67fd93fe2dc132df0af50 (diff) | |
download | sdk-791cb2d5d16701c8daeced9a36604c35be9acb13.zip sdk-791cb2d5d16701c8daeced9a36604c35be9acb13.tar.gz sdk-791cb2d5d16701c8daeced9a36604c35be9acb13.tar.bz2 |
Merge "Eclipse 4.x fix: Don't attempt to get display too early"
3 files changed, 29 insertions, 14 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 10cd093..48cebee 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 @@ -211,8 +211,6 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger, ISdkLog { public void start(BundleContext context) throws Exception { super.start(context); - Display display = getDisplay(); - // set the default android console. mAndroidConsole = new MessageConsole("Android", null); //$NON-NLS-1$ ConsolePlugin.getDefault().getConsoleManager().addConsoles( @@ -221,17 +219,6 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger, ISdkLog { // get the stream to write in the android console. mAndroidConsoleStream = mAndroidConsole.newMessageStream(); mAndroidConsoleErrorStream = mAndroidConsole.newMessageStream(); - mRed = new Color(display, 0xFF, 0x00, 0x00); - - // because this can be run, in some cases, by a non ui thread, and because - // changing the console properties update the ui, we need to make this change - // in the ui thread. - display.asyncExec(new Runnable() { - @Override - public void run() { - mAndroidConsoleErrorStream.setColor(mRed); - } - }); // get the eclipse store IPreferenceStore eclipseStore = getPreferenceStore(); @@ -303,12 +290,32 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger, ISdkLog { DesignerPlugin.dispose(); - mRed.dispose(); + if (mRed != null) { + mRed.dispose(); + mRed = null; + } + synchronized (AdtPlugin.class) { sPlugin = null; } } + /** Called when the workbench has been started */ + public void workbenchStarted() { + Display display = getDisplay(); + mRed = new Color(display, 0xFF, 0x00, 0x00); + + // because this can be run, in some cases, by a non ui thread, and because + // changing the console properties update the ui, we need to make this change + // in the ui thread. + display.asyncExec(new Runnable() { + @Override + public void run() { + mAndroidConsoleErrorStream.setColor(mRed); + } + }); + } + /** * Returns the shared instance * diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/properties/XmlProperty.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/properties/XmlProperty.java index c846ea1..6591575 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/properties/XmlProperty.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/properties/XmlProperty.java @@ -167,6 +167,9 @@ class XmlProperty extends Property { Object s = null; try { Element element = (Element) mNode.getXmlNode(); + if (element == null) { + return false; + } String name = mDescriptor.getXmlLocalName(); String uri = mDescriptor.getNamespaceUri(); if (uri != null) { @@ -182,6 +185,9 @@ class XmlProperty extends Property { public String getStringValue() { Element element = (Element) mNode.getXmlNode(); + if (element == null) { + return null; + } String name = mDescriptor.getXmlLocalName(); String uri = mDescriptor.getNamespaceUri(); Attr attr; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java index f6dc870..0fcf102 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java @@ -68,6 +68,8 @@ public class AdtStartup implements IStartup { } initializeWindowCoordinator(); + + AdtPlugin.getDefault().workbenchStarted(); } private boolean isFirstTime() { |