boolean (PsiElement fileContext, PsiClass psiClass) { if (isImported(fileContext)) { return ((PsiImportStatementBase)fileContext).isOnDemand(); } String fqn = psiClass.getQualifiedName(); if (fqn == null) return false; PsiFile file = myPlace == null ? null : FileContextUtil.getContextFile(myContainingFile); String[] defaultPackages = file instanceof PsiJavaFile ? ((PsiJavaFile)file).getImplicitlyImportedPackages() : DEFAULT_PACKAGES; String packageName = StringUtil.getPackageName(fqn); if (ArrayUtil.contains(packageName, defaultPackages)) { return true; } // class from my package imported implicitly return file instanceof PsiJavaFile && ((PsiJavaFile)file).getPackageName().equals(packageName); }