use of com.intellij.psi.targets.AliasingPsiTargetMapper in project intellij-community by JetBrains.
the class RenameAliasingPomTargetProcessor method prepareRenaming.
@Override
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames) {
PomTarget target = null;
if (element instanceof PomTargetPsiElement) {
target = ((PomTargetPsiElement) element).getTarget();
} else if (element instanceof PomTarget) {
target = (PomTarget) element;
}
if (target != null) {
for (AliasingPsiTargetMapper mapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
for (AliasingPsiTarget psiTarget : mapper.getTargets(target)) {
PsiElement psiElement = PomService.convertToPsi(psiTarget);
String name = psiTarget.getNameAlias(newName);
String definedName = allRenames.put(psiElement, name);
if (definedName != null) {
LOG.assertTrue(definedName.equals(name), "target: " + psiTarget + "; " + "defined name: " + definedName + "; " + "name: " + name + "; " + "mapper: " + mapper);
} else {
prepareRenaming(psiElement, name, allRenames);
}
}
}
}
}
Aggregations