Fix WrongIdFormat exception on Android XML widgets with non-@+id/ format

This commit is contained in:
Yan Zhulanow
2015-03-10 22:01:03 +03:00
parent 07381b765f
commit be954f2c27
7 changed files with 51 additions and 7 deletions
@@ -129,7 +129,9 @@ public class AndroidRenameProcessor : RenamePsiElementProcessor() {
if (element == null) return
val oldPropName = AndroidResourceUtil.getResourceNameByReferenceText(attribute.getValue())
val newPropName = idToName(newName)
renameSyntheticProperties(allRenames, newPropName, oldPropName, processor)
if (oldPropName != null && newPropName != null) {
renameSyntheticProperties(allRenames, newPropName, oldPropName, processor)
}
}
private fun renameSyntheticProperties(
@@ -45,7 +45,8 @@ class AndroidXmlVisitor(
val attributeValue = attribute.getValue()
if (attributeValue != null) {
val classNameAttr = tag?.getAttribute(AndroidConst.CLASS_ATTRIBUTE_NO_NAMESPACE)?.getValue() ?: tag?.getLocalName()
elementCallback(idToName(attributeValue), classNameAttr!!, attribute)
val name = idToName(attributeValue)
if (name != null) elementCallback(name, classNameAttr!!, attribute)
}
}
tag?.acceptChildren(this)