import org.xml.sax.SAXParseException;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
// get the result from the handler
return new AndroidManifestParser(manifestHandler.getPackage(),
- manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
- manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
- manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
+ manifestHandler.getActivities(),
+ manifestHandler.getLauncherActivity(),
+ manifestHandler.getProcesses(),
+ manifestHandler.getDebuggable(),
+ manifestHandler.getApiLevelRequirement(),
+ manifestHandler.getInstrumentations(),
manifestHandler.getUsesLibraries());
} catch (ParserConfigurationException e) {
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "Bad parser configuration for %s", manifestFile.getFullPath());
+ "Bad parser configuration for %s: %s",
+ manifestFile.getFullPath(),
+ e.getMessage());
} catch (SAXException e) {
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "Parser exception for %s", manifestFile.getFullPath());
+ "Parser exception for %s: %s",
+ manifestFile.getFullPath(),
+ e.getMessage());
} catch (IOException e) {
- AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "I/O error for %s", manifestFile.getFullPath());
+ // Don't log a console error when failing to read a non-existing file
+ if (!(e instanceof FileNotFoundException)) {
+ AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
+ "I/O error for %s: %s",
+ manifestFile.getFullPath(),
+ e.getMessage());
+ }
}
return null;
// get the result from the handler
return new AndroidManifestParser(manifestHandler.getPackage(),
- manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
- manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
- manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
+ manifestHandler.getActivities(),
+ manifestHandler.getLauncherActivity(),
+ manifestHandler.getProcesses(),
+ manifestHandler.getDebuggable(),
+ manifestHandler.getApiLevelRequirement(),
+ manifestHandler.getInstrumentations(),
manifestHandler.getUsesLibraries());
} catch (ParserConfigurationException e) {
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "Bad parser configuration for %s", manifestFile.getAbsolutePath());
+ "Bad parser configuration for %s: %s",
+ manifestFile.getAbsolutePath(),
+ e.getMessage());
} catch (SAXException e) {
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "Parser exception for %s", manifestFile.getAbsolutePath());
+ "Parser exception for %s: %s",
+ manifestFile.getAbsolutePath(),
+ e.getMessage());
} catch (IOException e) {
- AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
- "I/O error for %s", manifestFile.getAbsolutePath());
- }
+ // Don't log a console error when failing to read a non-existing file
+ if (!(e instanceof FileNotFoundException)) {
+ AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
+ "I/O error for %s: %s",
+ manifestFile.getAbsolutePath(),
+ e.getMessage());
+ }
+ }
+
return null;
}
Node attr = attrs.item(n);
if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
String uri = attr.getNodeValue();
- String nsPrefix = attr.getLocalName();
- if (SdkConstants.NS_RESOURCES.equals(uri)) {
+ String nsPrefix = attr.getLocalName();
+ // Is this the URI we are looking for? If yes, we found its prefix.
+ if (nsUri.equals(uri)) {
return nsPrefix;
}
visited.add(nsPrefix);
// Use a sensible default prefix if we can't find one.
// We need to make sure the prefix is not one that was declared in the scope
- // visited above.
+ // visited above. Use a default namespace prefix "android" for the Android resource
+ // NS and use "ns" for all other custom namespaces.
String prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
String base = prefix;
for (int i = 1; visited.contains(prefix); i++) {
}
}
}
-
+
if (attribute != null) {
- final UiAttributeNode fAttribute = attribute;
// get the current value and compare it to the new value
- String oldValue = fAttribute.getCurrentValue();
+ String oldValue = attribute.getCurrentValue();
final String newValue = (String)value;
if (oldValue.equals(newValue)) {
return;
}
-
+
+ final UiAttributeNode fAttribute = attribute;
AndroidEditor editor = getEditor();
editor.editXmlModel(new Runnable() {
public void run() {
});
}
}
-
-
}