boolean (@NotNull PsiElement element, @NotNull Collection<? extends PsiReference> array) { assert ready; if (!(element instanceof PsiClass)) return false; Set<PsiImportStatementBase> imports = new HashSet<>(); for (PsiReference classReference : array) { PsiImportStatementBase importStmt = PsiTreeUtil.getParentOfType(classReference.getElement(), PsiImportStatementBase.class); if (importStmt == null) return false; imports.add(importStmt); } return ContainerUtil.all(imports, importStmt -> { PsiElement importedMember = importStmt.resolve(); if (importedMember != null && PsiTreeUtil.isAncestor(element, importedMember, false)) { for (PsiReference memberReference : myLocalRefsMap.get(importedMember)) { if (!PsiTreeUtil.isAncestor(element, memberReference.getElement(), false)) { return false; } } return true; } return false; }); }