public interface FileIndex
| Modifier and Type | Method and Description |
|---|---|
boolean |
isContentSourceFile(VirtualFile file)
Deprecated.
name of this method is unclear, use
isInSourceContent(VirtualFile) instead and add !file.isDirectory() check
if you want to accept files only. |
boolean |
isInContent(VirtualFile fileOrDir)
Returns
true if fileOrDir is a file or directory under a content root of this project or module and not excluded or
ignored. |
boolean |
isInSourceContent(VirtualFile fileOrDir)
Returns
true if fileOrDir is a file or directory located under a sources, tests or resources root and not excluded or ignored. |
boolean |
isInTestSourceContent(VirtualFile fileOrDir)
Returns true if
fileOrDir is a file or directory located under a test sources or resources root and not excluded or ignored. |
boolean |
isUnderSourceRootOfType(VirtualFile fileOrDir,
java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
Returns
true if fileOrDir is a file or directory located under a source root of type from rootTypes set and not excluded or ignored |
boolean |
iterateContent(ContentIterator processor)
Processes all files and directories under content roots skipping excluded and ignored files and directories.
|
boolean |
iterateContent(ContentIterator processor,
VirtualFileFilter filter)
Same as
iterateContent(ContentIterator) but allows to pass filter to
provide filtering in condition for directories. |
boolean |
iterateContentUnderDirectory(VirtualFile dir,
ContentIterator processor)
Processes all files and directories in the content under directory
dir (including the directory itself) skipping excluded
and ignored files and directories. |
boolean |
iterateContentUnderDirectory(VirtualFile dir,
ContentIterator processor,
VirtualFileFilter customFilter)
Same as
iterateContentUnderDirectory(VirtualFile, ContentIterator) but allows to pass additional customFilter to
the iterator, in case you need to skip some file system branches using your own logic. |
boolean iterateContent(ContentIterator processor)
ContentIterator.processFile(VirtualFile) returned false)boolean iterateContent(ContentIterator processor, VirtualFileFilter filter)
iterateContent(ContentIterator) but allows to pass filter to
provide filtering in condition for directories.
If filter returns false on a directory, the directory won't be processed, but iteration will go on.
null filter means that all directories should be processed.
ContentIterator.processFile(VirtualFile) returned false)boolean iterateContentUnderDirectory(VirtualFile dir, ContentIterator processor)
dir (including the directory itself) skipping excluded
and ignored files and directories. Does nothing if dir is not in the content.ContentIterator.processFile(VirtualFile) returned false)boolean iterateContentUnderDirectory(VirtualFile dir, ContentIterator processor, VirtualFileFilter customFilter)
iterateContentUnderDirectory(VirtualFile, ContentIterator) but allows to pass additional customFilter to
the iterator, in case you need to skip some file system branches using your own logic. If customFilter returns false on
a directory, it won't be processed, but iteration will go on.
null filter means that all directories should be processed.
boolean isInContent(VirtualFile fileOrDir)
true if fileOrDir is a file or directory under a content root of this project or module and not excluded or
ignored.@Deprecated boolean isContentSourceFile(VirtualFile file)
isInSourceContent(VirtualFile) instead and add !file.isDirectory() check
if you want to accept files only.boolean isInSourceContent(VirtualFile fileOrDir)
true if fileOrDir is a file or directory located under a sources, tests or resources root and not excluded or ignored.boolean isInTestSourceContent(VirtualFile fileOrDir)
fileOrDir is a file or directory located under a test sources or resources root and not excluded or ignored.
Use this method when you really need to check whether the file is under test roots according to project configuration.
If you want to determine whether file should be considered as test (e.g. for implementing SearchScope)
you'd better use TestSourcesFilter.isTestSources(VirtualFile, Project) instead
which includes isInTestSourceContent(VirtualFile) invocation.
boolean isUnderSourceRootOfType(VirtualFile fileOrDir, java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
true if fileOrDir is a file or directory located under a source root of type from rootTypes set and not excluded or ignored