boolean (PsiElement resolved) { if (PsiSearchScopeUtil.isInScope(resolveScope, resolved)) { return true; } if (!resolved.getManager().isInProject(resolved)) { if (resolved instanceof PsiMember) { final PsiClass containingClass = ((PsiMember)resolved).getContainingClass(); if (containingClass != null) { final String fqn = containingClass.getQualifiedName(); if (fqn != null) { final PsiClass classFromTarget = JavaPsiFacade.getInstance(project).findClass(fqn, resolveScope); if (classFromTarget != null) { if (resolved instanceof PsiMethod) { return classFromTarget.findMethodsBySignature((PsiMethod)resolved, true).length > 0; } if (resolved instanceof PsiField) { return classFromTarget.findFieldByName(((PsiField)resolved).getName(), false) != null; } if (resolved instanceof PsiClass) { return classFromTarget.findInnerClassByName(((PsiClass)resolved).getName(), false) != null; } } } } } if (resolved instanceof PsiClass) { final String fqn = ((PsiClass)resolved).getQualifiedName(); return fqn != null && JavaPsiFacade.getInstance(project).findClass(fqn, resolveScope) != null; } } return false; }