RefElement (@NotNull PsiElement element, @NotNull GlobalInspectionContext globalContext) { PsiFile elementFile = element.getContainingFile(); RefElement refElement = globalContext.getRefManager().getReference(elementFile); if (refElement == null) { PsiElement context = InjectedLanguageManager.getInstance(elementFile.getProject()).getInjectionHost(elementFile); if (context != null) refElement = globalContext.getRefManager().getReference(context.getContainingFile()); } return refElement; }