Icon (@NotNull PsiDirectory directory) { VirtualFile file = directory.getVirtualFile(); Project project = directory.getProject(); ProjectFileIndex projectFileIndex = ProjectFileIndex.getInstance(project); VirtualFile sourceRoot = projectFileIndex.getSourceRootForFile(file); if (sourceRoot != null) { return IconUtil.getIcon(sourceRoot, 0, project); } return IconUtil.getIcon(file, 0, project); }