com.intellij.openapi.module
Interface ModifiableModuleModel


public interface ModifiableModuleModel

Represents the model for the list of modules in a project, or a temporary copy of that model displayed in the configuration UI.

See Also:
ModuleManager.getModifiableModel()

Method Summary
 void commit()
          Commits changes made in this model to the actual project structure.
 void commitAssertingNoCircularDependency()
          Deprecated. use commit() instead.
 void dispose()
          Disposes of all modules in the project.
 void disposeModule(Module module)
          Disposes of the specified module and removes it from the project.
 Module findModuleByName(java.lang.String name)
          Returns the project module with the specified name.
 Module[] getModules()
          Returns the list of all modules in the project.
 Module getModuleToBeRenamed(java.lang.String newName)
          Returns the project module which has been renamed to the specified name.
 java.lang.String getNewName(Module module)
          Returns the name to which the specified module has been renamed.
 boolean isChanged()
          Checks if there are any uncommitted changes to the model.
 Module loadModule(java.lang.String filePath)
          Loads a module from an .iml file with the specified path and adds it to the project.
 Module newModule(java.lang.String filePath)
          Creates a Java module at the specified path and adds it to the project to which the module manager is related.
 Module newModule(java.lang.String filePath, ModuleType moduleType)
          Creates a module of the specified type at the specified path and adds it to the project to which the module manager is related.
 void renameModule(Module module, java.lang.String newName)
          Schedules the rename of a module to be performed when the model is committed.
 

Method Detail

getModules

@NotNull
Module[] getModules()
Returns the list of all modules in the project. Same as ModuleManager.getModules().

Returns:
the array of modules.

newModule

@NotNull
Module newModule(@NotNull
                         java.lang.String filePath)
                 throws LoadCancelledException
Creates a Java module at the specified path and adds it to the project to which the module manager is related. commit() must be called to bring the changes in effect.

Parameters:
filePath - the path at which the module is created.
Returns:
the module instance.
Throws:
LoadCancelledException - in case of internal error while creating the module.

newModule

@NotNull
Module newModule(@NotNull
                         java.lang.String filePath,
                         @NotNull
                         ModuleType moduleType)
                 throws LoadCancelledException
Creates a module of the specified type at the specified path and adds it to the project to which the module manager is related. commit() must be called to bring the changes in effect.

Parameters:
filePath - the path at which the module is created.
moduleType - the type of the module to create.
Returns:
the module instance.
Throws:
LoadCancelledException - in case of internal error while creating the module.

loadModule

@NotNull
Module loadModule(@NotNull
                          java.lang.String filePath)
                  throws InvalidDataException,
                         java.io.IOException,
                         org.jdom.JDOMException,
                         ModuleWithNameAlreadyExists,
                         LoadCancelledException
Loads a module from an .iml file with the specified path and adds it to the project. commit() must be called to bring the changes in effect.

Parameters:
filePath - the path to load the module from.
Returns:
the module instance.
Throws:
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.
org.jdom.JDOMException - if the file contains invalid XML data.
ModuleWithNameAlreadyExists - if a module with such a name already exists in the project.
LoadCancelledException - if loading the module was cancelled by some of the components.

disposeModule

void disposeModule(@NotNull
                   Module module)
Disposes of the specified module and removes it from the project. commit() must be called to bring the changes in effect.

Parameters:
module - the module to remove.

findModuleByName

@Nullable
Module findModuleByName(@NotNull
                                 java.lang.String name)
Returns the project module with the specified name.

Parameters:
name - the name of the module to find.
Returns:
the module instance, or null if no module with such name exists.

dispose

void dispose()
Disposes of all modules in the project.


isChanged

boolean isChanged()
Checks if there are any uncommitted changes to the model.

Returns:
true if there are uncommitted changes, false otherwise

commit

void commit()
            throws ModuleCircularDependencyException
Commits changes made in this model to the actual project structure.

Throws:
ModuleCircularDependencyException - never actually thrown (circular module dependency is not an error).

commitAssertingNoCircularDependency

void commitAssertingNoCircularDependency()
Deprecated. use commit() instead.


renameModule

void renameModule(@NotNull
                  Module module,
                  @NotNull
                  java.lang.String newName)
                  throws ModuleWithNameAlreadyExists
Schedules the rename of a module to be performed when the model is committed.

Parameters:
module - the module to rename.
newName - the new name to rename the module to.
Throws:
ModuleWithNameAlreadyExists - if a module with such a name already exists in the project.

getModuleToBeRenamed

@Nullable
Module getModuleToBeRenamed(@NotNull
                                     java.lang.String newName)
Returns the project module which has been renamed to the specified name.

Parameters:
newName - the name of the renamed module to find.
Returns:
the module instance, or null if no module has been renamed to such a name.

getNewName

@Nullable
java.lang.String getNewName(@NotNull
                                     Module module)
Returns the name to which the specified module has been renamed.

Parameters:
module - the module for which the new name is requested.
Returns:
the new name, or null if the module has not been renamed.