List<PsiJavaCodeReferenceElement> (@NotNull PsiJavaFile file, @NotNull String packageName) { PsiClass[] refs = file.getSingleClassImports(true); List<PsiJavaCodeReferenceElement> array = new ArrayList<>(refs.length); for (PsiClass ref1 : refs) { String className = ref1.getQualifiedName(); if (getPackageOrClassName(className).equals(packageName)) { PsiJavaCodeReferenceElement ref = file.findImportReferenceTo(ref1); if (ref != null) { array.add(ref); } } } return array; }