boolean (@NotNull String classFQN, @NotNull Project project) { JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); PsiManager psiManager = PsiManager.getInstance(project); String qualifierText = StringUtil.getPackageName(classFQN); PsiClass outerClass = psiFacade.findClass(qualifierText, GlobalSearchScope.projectScope(project)); if (outerClass != null) { return psiManager.isInProject(outerClass); } for (; !StringUtil.isEmpty(qualifierText); qualifierText = StringUtil.getPackageName(qualifierText)) { PsiPackage psiPackage = psiFacade.findPackage(qualifierText); if (psiPackage != null) { return psiManager.isInProject(psiPackage); } } return false; }