public interface ProjectFileIndex extends FileIndex
ProjectRootManager.getFileIndex()
Modifier and Type | Interface and Description |
---|---|
static class |
ProjectFileIndex.SERVICE |
Modifier and Type | Method and Description |
---|---|
VirtualFile |
getClassRootForFile(VirtualFile file)
Returns a classpath entry to which the specified file or directory belongs.
|
VirtualFile |
getContentRootForFile(VirtualFile file)
Returns the module content root to which the specified file or directory belongs or null if the file does not belong to content of any module.
|
VirtualFile |
getContentRootForFile(VirtualFile file,
boolean honorExclusion)
Returns the module content root to which the specified file or directory belongs or null if the file does not belong to content of any module.
|
static ProjectFileIndex |
getInstance(Project project) |
Module |
getModuleForFile(VirtualFile file)
Returns module to which content the specified file belongs or null if the file does not belong to content of any module.
|
Module |
getModuleForFile(VirtualFile file,
boolean honorExclusion)
Returns module to which content the specified file belongs or null if the file does not belong to content of any module.
|
java.util.List<OrderEntry> |
getOrderEntriesForFile(VirtualFile file)
Returns the order entries which contain the specified file (either in CLASSES or SOURCES).
|
java.lang.String |
getPackageNameByDirectory(VirtualFile dir)
Returns the name of the package corresponding to the specified directory.
|
default SourceFolder |
getSourceFolder(VirtualFile fileOrDir) |
VirtualFile |
getSourceRootForFile(VirtualFile file)
Returns the module source root or library source root to which the specified file or directory belongs.
|
boolean |
isExcluded(VirtualFile file)
Checks if the specified file or directory is located under project roots but the file itself or one of its parent directories is
either excluded from the project or ignored by
FileTypeRegistry.isFileIgnored(VirtualFile) ). |
boolean |
isIgnored(VirtualFile file)
Deprecated.
name of this method may be confusing. If you want to check if the file is excluded or ignored use
isExcluded(VirtualFile) .
If you want to check if the file is ignored use FileTypeRegistry.isFileIgnored(VirtualFile) .
If you want to check if the file or one of its parents is ignored use isUnderIgnored(VirtualFile) . |
boolean |
isInLibrary(VirtualFile fileOrDir) |
boolean |
isInLibraryClasses(VirtualFile fileOrDir)
Returns true if
fileOrDir belongs to classes of some library which is included into dependencies of some module. |
boolean |
isInLibrarySource(VirtualFile fileOrDir)
Returns true if
fileOrDir is a file or directory from sources of some library which is included into dependencies
of some module. |
boolean |
isInSource(VirtualFile fileOrDir)
Returns true if
fileOrDir is a file or directory from production/test sources of some module or sources of some library which is included into dependencies
of some module. |
boolean |
isLibraryClassFile(VirtualFile file)
Returns true if
file is a file which belongs to the classes (not sources) of some library which is included into dependencies
of some module. |
boolean |
isUnderIgnored(VirtualFile file)
Checks if the specified file or directory is located under project roots but the file itself or one of its parent directories is ignored
by
FileTypeRegistry.isFileIgnored(VirtualFile) ). |
isContentSourceFile, isInContent, isInSourceContent, isInTestSourceContent, isUnderSourceRootOfType, iterateContent, iterateContent, iterateContentUnderDirectory, iterateContentUnderDirectory
static ProjectFileIndex getInstance(Project project)
Module getModuleForFile(VirtualFile file)
Module getModuleForFile(VirtualFile file, boolean honorExclusion)
honorExclusion
- if false
the containing module will be returned even if the file is located under a folder marked as excludedjava.util.List<OrderEntry> getOrderEntriesForFile(VirtualFile file)
VirtualFile getClassRootForFile(VirtualFile file)
VirtualFile getSourceRootForFile(VirtualFile file)
VirtualFile getContentRootForFile(VirtualFile file)
VirtualFile getContentRootForFile(VirtualFile file, boolean honorExclusion)
honorExclusion
- if false
the containing content root will be returned even if the file is located under a folder marked as excludedjava.lang.String getPackageNameByDirectory(VirtualFile dir)
boolean isLibraryClassFile(VirtualFile file)
file
is a file which belongs to the classes (not sources) of some library which is included into dependencies
of some module.boolean isInSource(VirtualFile fileOrDir)
fileOrDir
is a file or directory from production/test sources of some module or sources of some library which is included into dependencies
of some module.boolean isInLibraryClasses(VirtualFile fileOrDir)
fileOrDir
belongs to classes of some library which is included into dependencies of some module.boolean isInLibrary(VirtualFile fileOrDir)
boolean isInLibrarySource(VirtualFile fileOrDir)
fileOrDir
is a file or directory from sources of some library which is included into dependencies
of some module.@Deprecated boolean isIgnored(VirtualFile file)
isExcluded(VirtualFile)
.
If you want to check if the file is ignored use FileTypeRegistry.isFileIgnored(VirtualFile)
.
If you want to check if the file or one of its parents is ignored use isUnderIgnored(VirtualFile)
.boolean isExcluded(VirtualFile file)
FileTypeRegistry.isFileIgnored(VirtualFile)
).file
is excluded or ignored, false otherwise.boolean isUnderIgnored(VirtualFile file)
FileTypeRegistry.isFileIgnored(VirtualFile)
).file
is ignored, false otherwise.default SourceFolder getSourceFolder(VirtualFile fileOrDir)