public class ModuleFileIndexImpl extends java.lang.Object implements ModuleFileIndex
Constructor and Description |
---|
ModuleFileIndexImpl(Module module) |
Modifier and Type | Method and Description |
---|---|
static OrderEntry |
findOrderEntryWithOwnerModule(Module ownerModule,
java.util.List<? extends OrderEntry> orderEntries) |
DirectoryInfo |
getInfoForFileOrDirectory(VirtualFile file) |
java.util.List<OrderEntry> |
getOrderEntriesForFile(VirtualFile fileOrDir)
Returns the list of all order entries to which the specified file or directory
belongs.
|
OrderEntry |
getOrderEntryForFile(VirtualFile fileOrDir)
Returns the order entry to which the specified file or directory
belongs.
|
boolean |
isContentSourceFile(VirtualFile file) |
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. |
protected boolean |
isInContent(VirtualFile file,
DirectoryInfo info) |
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. |
protected boolean |
isScopeDisposed() |
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
FileIndex.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
FileIndex.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. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isContentSourceFile, iterateContent, iterateContentUnderDirectory, iterateContentUnderDirectory
public ModuleFileIndexImpl(Module module)
public boolean iterateContent(ContentIterator processor, VirtualFileFilter filter)
FileIndex
FileIndex.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.
iterateContent
in interface FileIndex
ContentIterator.processFile(VirtualFile)
returned false)public boolean isInContent(VirtualFile fileOrDir)
FileIndex
true
if fileOrDir
is a file or directory under a content root of this project or module and not excluded or
ignored.isInContent
in interface FileIndex
public boolean isInSourceContent(VirtualFile fileOrDir)
FileIndex
true
if fileOrDir
is a file or directory located under a sources, tests or resources root and not excluded or ignored.isInSourceContent
in interface FileIndex
public java.util.List<OrderEntry> getOrderEntriesForFile(VirtualFile fileOrDir)
ModuleFileIndex
getOrderEntriesForFile
in interface ModuleFileIndex
fileOrDir
- the file or directory to check.public OrderEntry getOrderEntryForFile(VirtualFile fileOrDir)
ModuleFileIndex
getOrderEntryForFile
in interface ModuleFileIndex
fileOrDir
- the file or directory to check.public boolean isInTestSourceContent(VirtualFile fileOrDir)
FileIndex
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 FileIndex.isInTestSourceContent(VirtualFile)
invocation.
isInTestSourceContent
in interface FileIndex
TestSourcesFilter.isTestSources(VirtualFile, Project)
public boolean isUnderSourceRootOfType(VirtualFile fileOrDir, java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
FileIndex
true
if fileOrDir
is a file or directory located under a source root of type from rootTypes
set and not excluded or ignoredisUnderSourceRootOfType
in interface FileIndex
protected boolean isScopeDisposed()
public static OrderEntry findOrderEntryWithOwnerModule(Module ownerModule, java.util.List<? extends OrderEntry> orderEntries)
protected boolean isInContent(VirtualFile file, DirectoryInfo info)
public boolean iterateContent(ContentIterator processor)
FileIndex
iterateContent
in interface FileIndex
ContentIterator.processFile(VirtualFile)
returned false)public boolean iterateContentUnderDirectory(VirtualFile dir, ContentIterator processor, VirtualFileFilter customFilter)
FileIndex
FileIndex.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.
iterateContentUnderDirectory
in interface FileIndex
public boolean iterateContentUnderDirectory(VirtualFile dir, ContentIterator processor)
FileIndex
dir
(including the directory itself) skipping excluded
and ignored files and directories. Does nothing if dir
is not in the content.iterateContentUnderDirectory
in interface FileIndex
ContentIterator.processFile(VirtualFile)
returned false)public DirectoryInfo getInfoForFileOrDirectory(VirtualFile file)
public boolean isContentSourceFile(VirtualFile file)
isContentSourceFile
in interface FileIndex