com.intellij.openapi.roots
Class ProjectRootManager

java.lang.Object
  extended by com.intellij.openapi.roots.ProjectRootManager
All Implemented Interfaces:
ModificationTracker

public abstract class ProjectRootManager
extends java.lang.Object
implements ModificationTracker

Allows to query and modify the list of root directories belonging to a project.


Field Summary
 
Fields inherited from interface com.intellij.openapi.util.ModificationTracker
EVER_CHANGED
 
Constructor Summary
ProjectRootManager()
           
 
Method Summary
abstract  void addModuleRootListener(ModuleRootListener listener)
          Adds a listener for receiving notifications about changes in project roots.
abstract  void checkCircularDependency(ModifiableRootModel[] rootModels, ModifiableModuleModel moduleModel)
          Checks if the specified project structure contains a circular dependency between modules, and throws an exception if it does.
abstract  void dispatchPendingEvent(ModuleRootListener listener)
          Deprecated. for IDEA internal use.
abstract  VirtualFile[] getContentRoots()
          Returns the list of content roots for all modules in the project.
abstract  VirtualFile[] getContentSourceRoots()
          Returns the list of source roots under the content roots for all modules in the project.
abstract  ProjectFileIndex getFileIndex()
          Returns the file index for the project.
abstract  VirtualFile[] getFullClassPath()
          Deprecated.  
static ProjectRootManager getInstance(Project project)
          Returns the project root manager instance for the specified project.
abstract  ProjectJdk getJdk()
          Deprecated.  
abstract  ProjectJdk getProjectJdk()
          Returns the instance of the JDK selected for the project.
abstract  java.lang.String getProjectJdkName()
          Returns the name of the JDK selected for the project.
abstract  VirtualFile[] getRootFiles(ProjectRootType type)
          Deprecated.  
abstract  void multiCommit(ModifiableModuleModel moduleModel, ModifiableRootModel[] rootModels)
          Commits the change to the list of modules and the lists of roots for the specified modules.
abstract  void multiCommit(ModifiableRootModel[] rootModels)
          Commits the change to the lists of roots for the specified modules.
abstract  void removeModuleRootListener(ModuleRootListener listener)
          Removes a listener for receiving notifications about changes in project roots.
abstract  void setProjectJdk(ProjectJdk jdk)
          Sets the JDK to be used for the project.
abstract  void setProjectJdkName(java.lang.String name)
          Sets the name of the JDK to be used for the project.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.intellij.openapi.util.ModificationTracker
getModificationCount
 

Constructor Detail

ProjectRootManager

public ProjectRootManager()
Method Detail

getInstance

public static ProjectRootManager getInstance(Project project)
Returns the project root manager instance for the specified project.

Parameters:
project - the project for which the instance is requested.
Returns:
the instance.

getFileIndex

@NotNull
public abstract ProjectFileIndex getFileIndex()
Returns the file index for the project.

Returns:
the file index instance.

addModuleRootListener

public abstract void addModuleRootListener(ModuleRootListener listener)
Adds a listener for receiving notifications about changes in project roots.

Parameters:
listener - the listener instance.

removeModuleRootListener

public abstract void removeModuleRootListener(ModuleRootListener listener)
Removes a listener for receiving notifications about changes in project roots.

Parameters:
listener - the listener instance.

dispatchPendingEvent

public abstract void dispatchPendingEvent(ModuleRootListener listener)
Deprecated. for IDEA internal use.


getRootFiles

public abstract VirtualFile[] getRootFiles(ProjectRootType type)
Deprecated. 


getContentRoots

@NotNull
public abstract VirtualFile[] getContentRoots()
Returns the list of content roots for all modules in the project.

Returns:
the list of content roots.

getContentSourceRoots

public abstract VirtualFile[] getContentSourceRoots()
Returns the list of source roots under the content roots for all modules in the project.

Returns:
the list of content source roots.

getFullClassPath

public abstract VirtualFile[] getFullClassPath()
Deprecated. 


getJdk

public abstract ProjectJdk getJdk()
Deprecated. 


getProjectJdk

@Nullable
public abstract ProjectJdk getProjectJdk()
Returns the instance of the JDK selected for the project.

Returns:
the JDK instance, or null if the name of the selected JDK does not correspond to any existing JDK instance.

getProjectJdkName

public abstract java.lang.String getProjectJdkName()
Returns the name of the JDK selected for the project.

Returns:
the JDK name.

setProjectJdk

public abstract void setProjectJdk(@Nullable
                                   ProjectJdk jdk)
Sets the JDK to be used for the project.

Parameters:
jdk - the JDK instance.

setProjectJdkName

public abstract void setProjectJdkName(java.lang.String name)
Sets the name of the JDK to be used for the project.

Parameters:
name - the name of the JDK.

multiCommit

public abstract void multiCommit(ModifiableRootModel[] rootModels)
Commits the change to the lists of roots for the specified modules.

Parameters:
rootModels - the root models ro commit.

multiCommit

public abstract void multiCommit(ModifiableModuleModel moduleModel,
                                 ModifiableRootModel[] rootModels)
Commits the change to the list of modules and the lists of roots for the specified modules.

Parameters:
moduleModel - the module model to commit.
rootModels - the root models to commit.

checkCircularDependency

public abstract void checkCircularDependency(ModifiableRootModel[] rootModels,
                                             ModifiableModuleModel moduleModel)
                                      throws ModuleCircularDependencyException
Checks if the specified project structure contains a circular dependency between modules, and throws an exception if it does.

Parameters:
rootModels - the list of root models for the modules in the project.
moduleModel - the list of modules in the project.
Throws:
ModuleCircularDependencyException - if there is a circular dependency between some of the modules.