public class ModuleRootManagerImpl extends ModuleRootManagerEx implements Disposable
Modifier and Type | Class and Description |
---|---|
static class |
ModuleRootManagerImpl.ModuleRootManagerState |
Disposable.Parent
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
protected SimpleModificationTracker |
myModificationTracker |
protected RootModelImpl |
myRootModel |
Constructor and Description |
---|
ModuleRootManagerImpl(Module module) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
dropCaches() |
static OrderRootsEnumerator |
getCachingEnumeratorForType(OrderRootType type,
Module module) |
ContentEntry [] |
getContentEntries()
Use this method to obtain all content entries of a module.
|
VirtualFile [] |
getContentRoots()
Returns an array of content roots from all content entries.
|
java.lang.String [] |
getContentRootUrls()
Returns an array of content root urls from all content entries.
|
Module [] |
getDependencies()
Returns the list of modules on which the current module directly depends.
|
Module [] |
getDependencies(boolean includeTests)
Returns the list of modules on which the current module directly depends.
|
java.lang.String [] |
getDependencyModuleNames()
Returns list of module names this module depends on.
|
VirtualFile [] |
getExcludeRoots()
Returns an array of exclude roots from all content entries.
|
java.lang.String [] |
getExcludeRootUrls()
Returns an array of exclude root urls from all content entries.
|
ProjectModelExternalSource |
getExternalSource()
Return non-null value if this element was automatically created by the IDE during importing from some external project system rather
than created by user manually via UI.
|
ModuleFileIndex |
getFileIndex()
Returns the file index for the current module.
|
ModifiableRootModel |
getModifiableModel()
Returns the interface for modifying the set of roots for this module.
|
ModifiableRootModel |
getModifiableModel(RootConfigurationAccessor accessor) |
long |
getModificationCountForTests() |
Module |
getModule()
Returns the module to which the model belongs.
|
Module [] |
getModuleDependencies() |
Module [] |
getModuleDependencies(boolean includeTests) |
<T> T |
getModuleExtension(java.lang.Class<T> klass) |
OrderEntry [] |
getOrderEntries()
Use this method to obtain order of roots of a module.
|
RootModelImpl |
getRootModel() |
Sdk |
getSdk()
Returns the SDK used by the module.
|
VirtualFile [] |
getSourceRoots()
Returns an array of source roots from all content entries.
|
VirtualFile [] |
getSourceRoots(boolean includingTests)
Returns an array of source roots from all content entries.
|
java.util.List<VirtualFile> |
getSourceRoots(JpsModuleSourceRootType<?> rootType)
Return a list of source roots of the specified type.
|
java.util.List<VirtualFile> |
getSourceRoots(java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
Return a list of source roots which types belong to the specified set.
|
java.lang.String [] |
getSourceRootUrls()
Returns an array of source root urls from all content entries.
|
java.lang.String [] |
getSourceRootUrls(boolean includingTests)
Returns an array of source root urls from all content entries.
|
ModuleRootManagerImpl.ModuleRootManagerState |
getState() |
boolean |
isDependsOn(Module module)
Checks if the current module directly depends on the specified module.
|
boolean |
isSdkInherited()
Returns
true if SDK for this module is inherited from a project. |
void |
loadState(ModuleRootManagerImpl.ModuleRootManagerState object) |
protected void |
loadState(ModuleRootManagerImpl.ModuleRootManagerState object,
boolean throwEvent) |
OrderEnumerator |
orderEntries()
Returns
OrderEnumerator instance which can be used to process order entries of the module (with or without dependencies) and
collect classes or source roots. |
<R> R |
processOrder(RootPolicy<R> policy,
R initialValue)
Passes all order entries in the module to the specified visitor.
|
void |
stateChanged() |
getInstanceEx
getInstance
protected static final Logger LOG
protected RootModelImpl myRootModel
protected final SimpleModificationTracker myModificationTracker
public ModuleRootManagerImpl(Module module)
public Module getModule()
ModuleRootModel
getModule
in interface ModuleRootModel
public ModuleFileIndex getFileIndex()
ModuleRootManager
getFileIndex
in class ModuleRootManager
public void dispose()
Disposable
dispose
in interface Disposable
public ModifiableRootModel getModifiableModel()
ModuleRootManager
ModifiableRootModel.commit()
or disposed ModifiableRootModel.dispose()
getModifiableModel
in class ModuleRootManager
public ModifiableRootModel getModifiableModel(RootConfigurationAccessor accessor)
getModifiableModel
in class ModuleRootManagerEx
public long getModificationCountForTests()
getModificationCountForTests
in class ModuleRootManagerEx
public RootModelImpl getRootModel()
public ContentEntry [] getContentEntries()
ModuleRootModel
getContentEntries
in interface ModuleRootModel
ContentEntry
public OrderEntry [] getOrderEntries()
ModuleRootModel
getOrderEntries
in interface ModuleRootModel
public Sdk getSdk()
ModuleRootModel
getSdk
in interface ModuleRootModel
ModuleRootModel.isSdkInherited()
public boolean isSdkInherited()
ModuleRootModel
true
if SDK for this module is inherited from a project.isSdkInherited
in interface ModuleRootModel
ProjectRootManager.getProjectSdk()
,
ProjectRootManager.setProjectSdk(Sdk)
public Module [] getDependencies()
ModuleRootManager
getDependencies
in class ModuleRootManager
public Module [] getDependencies(boolean includeTests)
ModuleRootManager
getDependencies
in class ModuleRootManager
includeTests
- whether test-only dependencies should be includedpublic Module [] getModuleDependencies()
getModuleDependencies
in interface ModuleRootModel
public Module [] getModuleDependencies(boolean includeTests)
getModuleDependencies
in interface ModuleRootModel
public boolean isDependsOn(Module module)
ModuleRootManager
isDependsOn
in class ModuleRootManager
module
- the module to check.module
is contained in the list of dependencies for the current module, false otherwise.public java.lang.String [] getDependencyModuleNames()
ModuleRootModel
getDependencyModuleNames
in interface ModuleRootModel
public <T> T getModuleExtension(java.lang.Class<T> klass)
getModuleExtension
in interface ModuleRootModel
public <R> R processOrder(RootPolicy<R> policy, R initialValue)
ModuleRootModel
processOrder
in interface ModuleRootModel
policy
- the visitor to accept.initialValue
- the default value to be returned by the visit process.OrderEntry.accept(RootPolicy, Object)
public OrderEnumerator orderEntries()
ModuleRootModel
OrderEnumerator
instance which can be used to process order entries of the module (with or without dependencies) and
collect classes or source roots.orderEntries
in interface ModuleRootModel
OrderEnumerator
instancepublic static OrderRootsEnumerator getCachingEnumeratorForType(OrderRootType type, Module module)
public VirtualFile [] getContentRoots()
ModuleRootModel
getContentRoots
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
public java.lang.String [] getContentRootUrls()
ModuleRootModel
getContentRootUrls
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
public java.lang.String [] getExcludeRootUrls()
ModuleRootModel
getExcludeRootUrls
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
public VirtualFile [] getExcludeRoots()
ModuleRootModel
getExcludeRoots
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
public java.lang.String [] getSourceRootUrls()
ModuleRootModel
getSourceRootUrls
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
,
ModuleRootModel.getSourceRootUrls(boolean)
public java.lang.String [] getSourceRootUrls(boolean includingTests)
ModuleRootModel
getSourceRootUrls
in interface ModuleRootModel
includingTests
- determines whether test source root urls should be included in the resultModuleRootModel.getContentEntries()
public VirtualFile [] getSourceRoots()
ModuleRootModel
getSourceRoots
in interface ModuleRootModel
ModuleRootModel.getContentEntries()
,
ModuleRootModel.getSourceRoots(boolean)
public VirtualFile [] getSourceRoots(boolean includingTests)
ModuleRootModel
getSourceRoots
in interface ModuleRootModel
includingTests
- determines whether test source roots should be included in the resultModuleRootModel.getContentEntries()
public java.util.List<VirtualFile> getSourceRoots(JpsModuleSourceRootType<?> rootType)
ModuleRootModel
getSourceRoots
in interface ModuleRootModel
rootType
- type of source rootspublic java.util.List<VirtualFile> getSourceRoots(java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
ModuleRootModel
getSourceRoots
in interface ModuleRootModel
rootTypes
- types of source rootspublic void dropCaches()
dropCaches
in class ModuleRootManagerEx
public ModuleRootManagerImpl.ModuleRootManagerState getState()
public void loadState(ModuleRootManagerImpl.ModuleRootManagerState object)
protected void loadState(ModuleRootManagerImpl.ModuleRootManagerState object, boolean throwEvent)
public void stateChanged()
public ProjectModelExternalSource getExternalSource()
ProjectModelElement
getExternalSource
in interface ProjectModelElement