use of com.intellij.codeInspection.lang.RefManagerExtension in project intellij-community by JetBrains.
the class RefManagerImpl method removeReference.
void removeReference(@NotNull RefElement refElem) {
final PsiElement element = refElem.getElement();
final RefManagerExtension extension = element != null ? getExtension(element.getLanguage()) : null;
if (extension != null) {
extension.removeReference(refElem);
}
synchronized (myRefTableLock) {
mySortedRefs = null;
if (element != null && (usePsiAsKey() ? myPsiToRefTable.remove(element) : myRefTable.remove(createAnchor(element))) != null)
return;
//PsiElement may have been invalidated and new one returned by getElement() is different so we need to do this stuff.
if (usePsiAsKey()) {
for (Map.Entry<PsiElement, RefElement> entry : myPsiToRefTable.entrySet()) {
RefElement value = entry.getValue();
PsiElement anchor = entry.getKey();
if (value == refElem) {
myPsiToRefTable.remove(anchor);
break;
}
}
} else {
for (Map.Entry<PsiAnchor, RefElement> entry : myRefTable.entrySet()) {
RefElement value = entry.getValue();
PsiAnchor anchor = entry.getKey();
if (value == refElem) {
myRefTable.remove(anchor);
break;
}
}
}
}
}
Aggregations