• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

development


Commit MetaInfo

Revisão0105db6763d878836bedc7e9d265bd037ab91a33 (tree)
Hora2009-03-26 08:30:11
AutorRaphael Moll <>
CommiterThe Android Open Source Project

Mensagem de Log

Automated import from //branches/donutburger/...@142709,142709

Mudança Sumário

Diff

--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java
@@ -17,6 +17,7 @@
1717
1818 package com.android.ide.eclipse.editors.wizards;
1919
20+import com.android.ide.eclipse.adt.AdtPlugin;
2021 import com.android.ide.eclipse.adt.sdk.AndroidTargetData;
2122 import com.android.ide.eclipse.adt.sdk.Sdk;
2223 import com.android.ide.eclipse.common.AndroidConstants;
@@ -39,6 +40,7 @@ import org.eclipse.core.resources.IResource;
3940 import org.eclipse.core.runtime.CoreException;
4041 import org.eclipse.core.runtime.IAdaptable;
4142 import org.eclipse.core.runtime.IPath;
43+import org.eclipse.core.runtime.IStatus;
4244 import org.eclipse.core.runtime.Path;
4345 import org.eclipse.jdt.core.IJavaProject;
4446 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -745,8 +747,35 @@ class NewXmlFileCreationPage extends WizardPage {
745747 // cleared above.
746748
747749 // get the AndroidTargetData from the project
748- IAndroidTarget target = Sdk.getCurrent().getTarget(mProject);
749- AndroidTargetData data = Sdk.getCurrent().getTargetData(target);
750+ IAndroidTarget target = null;
751+ AndroidTargetData data = null;
752+
753+ target = Sdk.getCurrent().getTarget(mProject);
754+ if (target == null) {
755+ // A project should have a target. The target can be missing if the project
756+ // is an old project for which a target hasn't been affected or if the
757+ // target no longer exists in this SDK. Simply log the error and dismiss.
758+
759+ AdtPlugin.log(IStatus.INFO,
760+ "NewXmlFile wizard: no platform target for project %s", //$NON-NLS-1$
761+ mProject.getName());
762+ continue;
763+ } else {
764+ data = Sdk.getCurrent().getTargetData(target);
765+
766+ if (data == null) {
767+ // We should have both a target and its data.
768+ // However if the wizard is invoked whilst the platform is still being
769+ // loaded we can end up in a weird case where we have a target but it
770+ // doesn't have any data yet.
771+ // Lets log a warning and silently ignore this root.
772+
773+ AdtPlugin.log(IStatus.INFO,
774+ "NewXmlFile wizard: no data for target %s, project %s", //$NON-NLS-1$
775+ target.getName(), mProject.getName());
776+ continue;
777+ }
778+ }
750779
751780 IDescriptorProvider provider = data.getDescriptorProvider((Integer)rootSeed);
752781 ElementDescriptor descriptor = provider.getDescriptor();