Icon (final ContentEntry entry, final VirtualFile file, Icon originalIcon) { if (ContentEntryEditor.isExcludedOrUnderExcludedDirectory(entry, myExcludedUrls, file)) { return AllIcons.Modules.ExcludeRoot; } final SourceFolder[] sourceFolders = entry.getSourceFolders(); for (SourceFolder sourceFolder : sourceFolders) { if (file.equals(sourceFolder.getFile())) { return SourceRootPresentation.getSourceRootIcon(sourceFolder); } } Icon icon = originalIcon; VirtualFile currentRoot = null; for (SourceFolder sourceFolder : sourceFolders) { final VirtualFile sourcePath = sourceFolder.getFile(); if (sourcePath != null && VfsUtilCore.isAncestor(sourcePath, file, true)) { if (currentRoot != null && VfsUtilCore.isAncestor(sourcePath, currentRoot, false)) { continue; } Icon folderIcon = getSourceFolderIcon(sourceFolder.getRootType()); if (folderIcon != null) { icon = folderIcon; } currentRoot = sourcePath; } } return icon; }