void (PsiJavaCodeReferenceElement reference) { if (reference.isQualified()) { return; } final PsiElement target = reference.resolve(); if (!(target instanceof PsiMethod) && !(target instanceof PsiClass) && !(target instanceof PsiField)) { return; } final PsiMember member = (PsiMember)target; if (!member.hasModifierProperty(PsiModifier.STATIC)) { return; } for (JavaResolveResult importTarget : importTargets) { final PsiElement targetElement = importTarget.getElement(); if (targetElement instanceof PsiMethod || targetElement instanceof PsiField) { if (member.equals(targetElement)) { addReference(reference); } } else if (targetElement instanceof PsiClass) { if (onDemand) { final PsiClass containingClass = member.getContainingClass(); if (InheritanceUtil.isInheritorOrSelf((PsiClass)targetElement, containingClass, true)) { addReference(reference); } } else { if (targetElement.equals(member)) { addReference(reference); } } } } }