Set<String> (@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) { Set<String> names = null; FileIndexFacade facade = FileIndexFacade.getInstance(myProject); for (PsiDirectory dir : psiPackage.getDirectories(scope)) { for (PsiFile file : dir.getFiles()) { if (file instanceof PsiClassOwner && file.getViewProvider().getLanguages().size() == 1) { VirtualFile vFile = file.getVirtualFile(); if (vFile != null && !(file instanceof PsiCompiledElement) && !facade.isInSourceContent(vFile) && (!scope.isForceSearchingInLibrarySources() || !StubTreeLoader.getInstance().canHaveStub(vFile))) { continue; } Set<String> inFile = file instanceof PsiClassOwnerEx ? ((PsiClassOwnerEx)file).getClassNames() : getClassNames(((PsiClassOwner)file).getClasses()); if (inFile.isEmpty()) continue; if (names == null) names = new HashSet<>(); names.addAll(inFile); } } } return names == null ? Collections.emptySet() : names; }