Automated import from //branches/donutburger/...@142707,142707
This commit is contained in:
committed by
The Android Open Source Project
parent
46a1d90217
commit
26aa2cdeb0
@@ -34,6 +34,7 @@ import org.xml.sax.SAXException;
|
|||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -585,19 +586,31 @@ public class AndroidManifestParser {
|
|||||||
// get the result from the handler
|
// get the result from the handler
|
||||||
|
|
||||||
return new AndroidManifestParser(manifestHandler.getPackage(),
|
return new AndroidManifestParser(manifestHandler.getPackage(),
|
||||||
manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
|
manifestHandler.getActivities(),
|
||||||
manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
|
manifestHandler.getLauncherActivity(),
|
||||||
manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
|
manifestHandler.getProcesses(),
|
||||||
|
manifestHandler.getDebuggable(),
|
||||||
|
manifestHandler.getApiLevelRequirement(),
|
||||||
|
manifestHandler.getInstrumentations(),
|
||||||
manifestHandler.getUsesLibraries());
|
manifestHandler.getUsesLibraries());
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
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) {
|
} catch (SAXException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
||||||
"Parser exception for %s", manifestFile.getFullPath());
|
"Parser exception for %s: %s",
|
||||||
|
manifestFile.getFullPath(),
|
||||||
|
e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
// Don't log a console error when failing to read a non-existing file
|
||||||
"I/O error for %s", manifestFile.getFullPath());
|
if (!(e instanceof FileNotFoundException)) {
|
||||||
|
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
||||||
|
"I/O error for %s: %s",
|
||||||
|
manifestFile.getFullPath(),
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -633,20 +646,33 @@ public class AndroidManifestParser {
|
|||||||
// get the result from the handler
|
// get the result from the handler
|
||||||
|
|
||||||
return new AndroidManifestParser(manifestHandler.getPackage(),
|
return new AndroidManifestParser(manifestHandler.getPackage(),
|
||||||
manifestHandler.getActivities(), manifestHandler.getLauncherActivity(),
|
manifestHandler.getActivities(),
|
||||||
manifestHandler.getProcesses(), manifestHandler.getDebuggable(),
|
manifestHandler.getLauncherActivity(),
|
||||||
manifestHandler.getApiLevelRequirement(), manifestHandler.getInstrumentations(),
|
manifestHandler.getProcesses(),
|
||||||
|
manifestHandler.getDebuggable(),
|
||||||
|
manifestHandler.getApiLevelRequirement(),
|
||||||
|
manifestHandler.getInstrumentations(),
|
||||||
manifestHandler.getUsesLibraries());
|
manifestHandler.getUsesLibraries());
|
||||||
} catch (ParserConfigurationException e) {
|
} catch (ParserConfigurationException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
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) {
|
} catch (SAXException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
||||||
"Parser exception for %s", manifestFile.getAbsolutePath());
|
"Parser exception for %s: %s",
|
||||||
|
manifestFile.getAbsolutePath(),
|
||||||
|
e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
// Don't log a console error when failing to read a non-existing file
|
||||||
"I/O error for %s", manifestFile.getAbsolutePath());
|
if (!(e instanceof FileNotFoundException)) {
|
||||||
|
AdtPlugin.logAndPrintError(e, AndroidManifestParser.class.getCanonicalName(),
|
||||||
|
"I/O error for %s: %s",
|
||||||
|
manifestFile.getAbsolutePath(),
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1234,7 +1234,8 @@ public class UiElementNode implements IPropertySource {
|
|||||||
if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
|
if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$
|
||||||
String uri = attr.getNodeValue();
|
String uri = attr.getNodeValue();
|
||||||
String nsPrefix = attr.getLocalName();
|
String nsPrefix = attr.getLocalName();
|
||||||
if (SdkConstants.NS_RESOURCES.equals(uri)) {
|
// Is this the URI we are looking for? If yes, we found its prefix.
|
||||||
|
if (nsUri.equals(uri)) {
|
||||||
return nsPrefix;
|
return nsPrefix;
|
||||||
}
|
}
|
||||||
visited.add(nsPrefix);
|
visited.add(nsPrefix);
|
||||||
@@ -1244,7 +1245,8 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
// Use a sensible default prefix if we can't find one.
|
// 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
|
// 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 prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
String base = prefix;
|
String base = prefix;
|
||||||
for (int i = 1; visited.contains(prefix); i++) {
|
for (int i = 1; visited.contains(prefix); i++) {
|
||||||
@@ -1477,16 +1479,16 @@ public class UiElementNode implements IPropertySource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (attribute != null) {
|
if (attribute != null) {
|
||||||
final UiAttributeNode fAttribute = attribute;
|
|
||||||
|
|
||||||
// get the current value and compare it to the new value
|
// get the current value and compare it to the new value
|
||||||
String oldValue = fAttribute.getCurrentValue();
|
String oldValue = attribute.getCurrentValue();
|
||||||
final String newValue = (String)value;
|
final String newValue = (String)value;
|
||||||
|
|
||||||
if (oldValue.equals(newValue)) {
|
if (oldValue.equals(newValue)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final UiAttributeNode fAttribute = attribute;
|
||||||
AndroidEditor editor = getEditor();
|
AndroidEditor editor = getEditor();
|
||||||
editor.editXmlModel(new Runnable() {
|
editor.editXmlModel(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -1495,6 +1497,4 @@ public class UiElementNode implements IPropertySource {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user