// utility method to add an attribute which name is derived from the enum name(). private static void addToElement( SystemProperty systemProperty, ActionRecorder actionRecorder, String value, XmlElement to) { to.getXml().setAttribute(systemProperty.toCamelCase(), value); XmlAttribute xmlAttribute = new XmlAttribute(to, to.getXml().getAttributeNode(systemProperty.toCamelCase()), null); actionRecorder.recordAttributeAction( xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new Actions.ActionLocation(to.getSourceLocation(), PositionImpl.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */)); }
// utility method to add an attribute in android namespace which local name is derived from // the enum name(). private static void addToElementInAndroidNS( SystemProperty systemProperty, ActionRecorder actionRecorder, String value, XmlElement to) { String toolsPrefix = getAndroidPrefix(to.getXml()); to.getXml() .setAttributeNS( SdkConstants.ANDROID_URI, toolsPrefix + XmlUtils.NS_SEPARATOR + systemProperty.toCamelCase(), value); Attr attr = to.getXml().getAttributeNodeNS(SdkConstants.ANDROID_URI, systemProperty.toCamelCase()); XmlAttribute xmlAttribute = new XmlAttribute(to, attr, null); actionRecorder.recordAttributeAction( xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new Actions.ActionLocation(to.getSourceLocation(), PositionImpl.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */)); }