public abstract class ModuleManager extends SimpleModificationTracker
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
ModuleManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
disposeModule(Module module)
Disposes of the specified module and removes it from the project.
|
abstract Module |
findModuleByName(java.lang.String name)
Returns the project module with the specified name.
|
abstract java.util.Collection<ModuleDescription> |
getAllModuleDescriptions() |
static ModuleManager |
getInstance(Project project)
Returns the module manager instance for the current project.
|
abstract ModifiableModuleModel |
getModifiableModel()
Returns the model for the list of modules in the project, which can be used to add,
remove or modify modules.
|
abstract java.util.List<Module> |
getModuleDependentModules(Module module)
Returns the list of modules which directly depend on the specified module.
|
abstract ModuleGrouper |
getModuleGrouper(ModifiableModuleModel model) |
abstract java.lang.String [] |
getModuleGroupPath(Module module)
Returns the path to the group to which the specified module belongs, as an array of group names starting from the project root.
|
abstract Module [] |
getModules()
Returns the list of all modules in the project.
|
abstract Module [] |
getSortedModules()
Returns the list of modules sorted by dependency (the modules which do not depend
on anything are in the beginning of the list, a module which depends on another module
follows it in the list).
|
abstract UnloadedModuleDescription |
getUnloadedModuleDescription(java.lang.String moduleName) |
abstract java.util.Collection<UnloadedModuleDescription> |
getUnloadedModuleDescriptions() |
abstract boolean |
hasModuleGroups() |
abstract boolean |
isModuleDependent(Module module,
Module onModule)
Checks if one of the specified modules directly depends on the other module.
|
abstract Module |
loadModule(java.lang.String filePath)
Loads a module from an .iml file with the specified path and adds it to the project.
|
abstract java.util.Comparator<Module> |
moduleDependencyComparator()
Returns the module comparator which can be used for sorting modules by dependency
(the modules which do not depend on anything are in the beginning of the list,
a module which depends on another module follows it in the list).
|
abstract Graph<Module> |
moduleGraph()
Returns the graph of dependencies between modules in the project.
|
abstract Graph<Module> |
moduleGraph(boolean includeTests)
Returns the graph of dependencies between modules in the project.
|
abstract Module |
newModule(java.lang.String filePath,
java.lang.String moduleTypeId)
Creates a module of the specified type at the specified path and adds it to the project
to which the module manager is related.
|
Module |
newNonPersistentModule(java.lang.String moduleName,
java.lang.String id)
Creates a non-persistent module of the specified type and adds it to the project
to which the module manager is related.
|
void |
removeUnloadedModules(java.util.Collection<? extends UnloadedModuleDescription> unloadedModules) |
abstract void |
setUnloadedModules(java.util.List<java.lang.String> unloadedModuleNames)
Specify list of modules which will be unloaded from the project.
|
getModificationCount, incModificationCount
public static ModuleManager getInstance(Project project)
project
- the project for which the module manager is requested.public abstract Module newModule(java.lang.String filePath, java.lang.String moduleTypeId)
filePath
- path to an *.iml file where module configuration will be saved; name of the module will be equal to the file name without extension.moduleTypeId
- the ID of the module type to create.public Module newNonPersistentModule(java.lang.String moduleName, java.lang.String id)
#commit()
must be called to
bring the changes in effect.
In contrast with modules created by newModule(String, String)
,
non-persistent modules aren't stored on a filesystem and aren't being written
in a project XML file. When IDE closes, all non-persistent modules vanishes out.public abstract Module loadModule(java.lang.String filePath) throws java.io.IOException, JDOMException, ModuleWithNameAlreadyExists
filePath
- the path to load the module from.InvalidDataException
- if the data in the .iml file is semantically incorrect.java.io.IOException
- if an I/O error occurred when loading the module file.JDOMException
- if the file contains invalid XML data.ModuleWithNameAlreadyExists
- if a module with such a name already exists in the project.public abstract void disposeModule(Module module)
module
- the module to remove.public abstract Module [] getModules()
public abstract Module findModuleByName(java.lang.String name)
name
- the name of the module to find.public abstract Module [] getSortedModules()
public abstract java.util.Comparator<Module> moduleDependencyComparator()
public abstract java.util.List<Module> getModuleDependentModules(Module module)
module
- the module for which the list of dependent modules is requested.ModuleUtilCore.getAllDependentModules(Module)
public abstract boolean isModuleDependent(Module module, Module onModule)
module
- the module to check the dependency for.onModule
- the module on which module
may depend.module
directly depends on onModule
, false otherwise.public abstract Graph<Module> moduleGraph()
public abstract Graph<Module> moduleGraph(boolean includeTests)
includeTests
- whether test-only dependencies should be includedpublic abstract ModifiableModuleModel getModifiableModel()
public abstract java.lang.String [] getModuleGroupPath(Module module)
Use ModuleGrouper#getGroupPath(Module)
instead. Explicit module groups will be replaced
by automatical module grouping accordingly to qualified names of modules, see https://youtrack.jetbrains.com/issue/IDEA-166061 for details.
module
- the module for which the path is requested.public abstract boolean hasModuleGroups()
public abstract java.util.Collection<ModuleDescription> getAllModuleDescriptions()
public abstract java.util.Collection<UnloadedModuleDescription> getUnloadedModuleDescriptions()
public abstract UnloadedModuleDescription getUnloadedModuleDescription(java.lang.String moduleName)
public abstract ModuleGrouper getModuleGrouper(ModifiableModuleModel model)
public abstract void setUnloadedModules(java.util.List<java.lang.String> unloadedModuleNames)
UnloadedModuleDescription
public void removeUnloadedModules(java.util.Collection<? extends UnloadedModuleDescription> unloadedModules)