use of org.jetbrains.android.dom.wrappers.ValueResourceElementWrapper in project android by JetBrains.
the class AndroidResourceRenameResourceProcessor method prepareIdRenaming.
private static void prepareIdRenaming(XmlAttributeValue value, String newName, Map<PsiElement, String> allRenames, AndroidFacet facet) {
LocalResourceManager manager = facet.getLocalResourceManager();
allRenames.remove(value);
String id = AndroidResourceUtil.getResourceNameByReferenceText(value.getValue());
assert id != null;
List<XmlAttributeValue> idDeclarations = manager.findIdDeclarations(id);
for (XmlAttributeValue idDeclaration : idDeclarations) {
// framework which looks related to elements getting modified multiple times.
if (!ATTR_ID.equals(((XmlAttribute) idDeclaration.getParent()).getLocalName())) {
continue;
}
allRenames.put(new ValueResourceElementWrapper(idDeclaration), newName);
}
String name = AndroidResourceUtil.getResourceNameByReferenceText(newName);
if (name != null) {
for (PsiField resField : AndroidResourceUtil.findIdFields(value)) {
allRenames.put(resField, AndroidResourceUtil.getFieldNameByResourceName(name));
}
}
}
Aggregations