• 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ãoe8c4a0d26754497028c7e654ff8599364e4a68ba (tree)
Hora2009-03-26 07:55:29
AutorRaphael Moll <>
CommiterThe Android Open Source Project

Mensagem de Log

Automated import from //branches/master/...@142743,142743

Mudança Sumário

Diff

--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java
@@ -34,6 +34,7 @@ import org.xml.sax.SAXException;
3434 import org.xml.sax.SAXParseException;
3535
3636 import java.io.File;
37+import java.io.FileNotFoundException;
3738 import java.io.FileReader;
3839 import java.io.IOException;
3940 import java.util.ArrayList;
@@ -585,19 +586,31 @@ public class AndroidManifestParser {
585586 // get the result from the handler
586587
587588 return new AndroidManifestParser(manifestHandler.getPackage(),
588- manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
589- manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
590- manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
589+ manifestHandler.getActivities(),
590+ manifestHandler.getLauncherActivity(),
591+ manifestHandler.getProcesses(),
592+ manifestHandler.getDebuggable(),
593+ manifestHandler.getApiLevelRequirement(),
594+ manifestHandler.getInstrumentations(),
591595 manifestHandler.getUsesLibraries());
592596 } catch (ParserConfigurationException e) {
593597 AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
594- "Bad parser configuration for %s", manifestFile.getFullPath());
598+ "Bad parser configuration for %s: %s",
599+ manifestFile.getFullPath(),
600+ e.getMessage());
595601 } catch (SAXException e) {
596602 AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
597- "Parser exception for %s", manifestFile.getFullPath());
603+ "Parser exception for %s: %s",
604+ manifestFile.getFullPath(),
605+ e.getMessage());
598606 } catch (IOException e) {
599- AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
600- "I/O error for %s", manifestFile.getFullPath());
607+ // Don't log a console error when failing to read a non-existing file
608+ if (!(e instanceof FileNotFoundException)) {
609+ AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
610+ "I/O error for %s: %s",
611+ manifestFile.getFullPath(),
612+ e.getMessage());
613+ }
601614 }
602615
603616 return null;
@@ -633,20 +646,33 @@ public class AndroidManifestParser {
633646 // get the result from the handler
634647
635648 return new AndroidManifestParser(manifestHandler.getPackage(),
636- manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
637- manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
638- manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
649+ manifestHandler.getActivities(),
650+ manifestHandler.getLauncherActivity(),
651+ manifestHandler.getProcesses(),
652+ manifestHandler.getDebuggable(),
653+ manifestHandler.getApiLevelRequirement(),
654+ manifestHandler.getInstrumentations(),
639655 manifestHandler.getUsesLibraries());
640656 } catch (ParserConfigurationException e) {
641657 AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
642- "Bad parser configuration for %s", manifestFile.getAbsolutePath());
658+ "Bad parser configuration for %s: %s",
659+ manifestFile.getAbsolutePath(),
660+ e.getMessage());
643661 } catch (SAXException e) {
644662 AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
645- "Parser exception for %s", manifestFile.getAbsolutePath());
663+ "Parser exception for %s: %s",
664+ manifestFile.getAbsolutePath(),
665+ e.getMessage());
646666 } catch (IOException e) {
647- AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
648- "I/O error for %s", manifestFile.getAbsolutePath());
649- }
667+ // Don't log a console error when failing to read a non-existing file
668+ if (!(e instanceof FileNotFoundException)) {
669+ AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
670+ "I/O error for %s: %s",
671+ manifestFile.getAbsolutePath(),
672+ e.getMessage());
673+ }
674+ }
675+
650676 return null;
651677 }
652678
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java
@@ -1233,8 +1233,9 @@ public class UiElementNode implements IPropertySource {
12331233 Node attr = attrs.item(n);
12341234 if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
12351235 String uri = attr.getNodeValue();
1236- String nsPrefix = attr.getLocalName();
1237- if (SdkConstants.NS_RESOURCES.equals(uri)) {
1236+ String nsPrefix = attr.getLocalName();
1237+ // Is this the URI we are looking for? If yes, we found its prefix.
1238+ if (nsUri.equals(uri)) {
12381239 return nsPrefix;
12391240 }
12401241 visited.add(nsPrefix);
@@ -1244,7 +1245,8 @@ public class UiElementNode implements IPropertySource {
12441245
12451246 // Use a sensible default prefix if we can't find one.
12461247 // We need to make sure the prefix is not one that was declared in the scope
1247- // visited above.
1248+ // visited above. Use a default namespace prefix "android" for the Android resource
1249+ // NS and use "ns" for all other custom namespaces.
12481250 String prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
12491251 String base = prefix;
12501252 for (int i = 1; visited.contains(prefix); i++) {
@@ -1475,18 +1477,18 @@ public class UiElementNode implements IPropertySource {
14751477 }
14761478 }
14771479 }
1478-
1480+
14791481 if (attribute != null) {
1480- final UiAttributeNode fAttribute = attribute;
14811482
14821483 // get the current value and compare it to the new value
1483- String oldValue = fAttribute.getCurrentValue();
1484+ String oldValue = attribute.getCurrentValue();
14841485 final String newValue = (String)value;
14851486
14861487 if (oldValue.equals(newValue)) {
14871488 return;
14881489 }
1489-
1490+
1491+ final UiAttributeNode fAttribute = attribute;
14901492 AndroidEditor editor = getEditor();
14911493 editor.editXmlModel(new Runnable() {
14921494 public void run() {
@@ -1495,6 +1497,4 @@ public class UiElementNode implements IPropertySource {
14951497 });
14961498 }
14971499 }
1498-
1499-
15001500 }