mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
follow IDEA-CR-22799
This commit is contained in:
+33
-29
@@ -466,41 +466,45 @@ public class RefManagerImpl extends RefManager {
|
||||
extension.visitElement(element);
|
||||
}
|
||||
else if (processJVMClasses) {
|
||||
PsiFile containingFile = element.getContainingFile();
|
||||
if (containingFile instanceof PsiClassOwner) {
|
||||
RefElement refFile = getReference(containingFile);
|
||||
LOG.assertTrue(refFile != null, containingFile);
|
||||
for (PsiReference reference : element.getReferences()) {
|
||||
PsiElement resolve = reference.resolve();
|
||||
if (resolve != null) {
|
||||
fireNodeMarkedReferenced(resolve, containingFile);
|
||||
RefElement refWhat = getReference(resolve);
|
||||
if (refWhat == null) {
|
||||
PsiFile targetContainingFile = resolve.getContainingFile();
|
||||
//no logic to distinguish different elements in the file anyway
|
||||
if (containingFile == targetContainingFile) continue;
|
||||
refWhat = getReference(targetContainingFile);
|
||||
}
|
||||
|
||||
if (refWhat != null) {
|
||||
((RefElementImpl)refWhat).addInReference(refFile);
|
||||
((RefElementImpl)refFile).addOutReference(refWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element instanceof PsiFile) {
|
||||
VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
|
||||
if (virtualFile instanceof VirtualFileWithId) {
|
||||
registerUnprocessed((VirtualFileWithId)virtualFile);
|
||||
}
|
||||
}
|
||||
processElementNoExtension(element);
|
||||
}
|
||||
for (PsiElement aChildren : element.getChildren()) {
|
||||
aChildren.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void processElementNoExtension(PsiElement element) {
|
||||
PsiFile containingFile = element.getContainingFile();
|
||||
if (containingFile instanceof PsiClassOwner) {
|
||||
RefElement refFile = getReference(containingFile);
|
||||
LOG.assertTrue(refFile != null, containingFile);
|
||||
for (PsiReference reference : element.getReferences()) {
|
||||
PsiElement resolve = reference.resolve();
|
||||
if (resolve != null) {
|
||||
fireNodeMarkedReferenced(resolve, containingFile);
|
||||
RefElement refWhat = getReference(resolve);
|
||||
if (refWhat == null) {
|
||||
PsiFile targetContainingFile = resolve.getContainingFile();
|
||||
//no logic to distinguish different elements in the file anyway
|
||||
if (containingFile == targetContainingFile) continue;
|
||||
refWhat = getReference(targetContainingFile);
|
||||
}
|
||||
|
||||
if (refWhat != null) {
|
||||
((RefElementImpl)refWhat).addInReference(refFile);
|
||||
((RefElementImpl)refFile).addOutReference(refWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element instanceof PsiFile) {
|
||||
VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
|
||||
if (virtualFile instanceof VirtualFileWithId) {
|
||||
registerUnprocessed((VirtualFileWithId)virtualFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFile(PsiFile file) {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
|
||||
Reference in New Issue
Block a user