use of com.intellij.util.containers.Queue in project intellij-community by JetBrains.
the class RenameXmlAttributeProcessor method renameAll.
private static void renameAll(PsiElement originalElement, UsageInfo[] infos, String newName, String originalName) throws IncorrectOperationException {
if (newName.equals(originalName))
return;
Queue<PsiReference> queue = new Queue<>(infos.length);
for (UsageInfo info : infos) {
if (info.getElement() == null)
continue;
PsiReference ref = info.getReference();
if (ref == null)
continue;
queue.addLast(ref);
}
while (!queue.isEmpty()) {
final PsiReference reference = queue.pullFirst();
final PsiElement oldElement = reference.getElement();
if (!oldElement.isValid() || oldElement == originalElement)
continue;
final PsiElement newElement = reference.handleElementRename(newName);
if (!oldElement.isValid()) {
for (PsiReference psiReference : ReferencesSearch.search(originalElement, new LocalSearchScope(newElement), false)) {
queue.addLast(psiReference);
}
}
}
}
Aggregations