public class ProjectRootManagerImpl extends ProjectRootManagerEx implements PersistentStateComponent<Element>
Modifier and Type | Class and Description |
---|---|
protected class |
ProjectRootManagerImpl.BatchSession |
ProjectRootManagerEx.ProjectJdkListener
Modifier and Type | Field and Description |
---|---|
protected boolean |
isFiringEvent |
protected ProjectRootManagerImpl.BatchSession |
myFileTypesChanged |
protected Project |
myProject |
protected ProjectRootManagerImpl.BatchSession |
myRootsChanged |
protected boolean |
myStartupActivityPerformed |
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
ProjectRootManagerImpl(Project project) |
Modifier and Type | Method and Description |
---|---|
void |
addProjectJdkListener(ProjectRootManagerEx.ProjectJdkListener listener) |
void |
assertListenersAreDisposed() |
protected void |
clearScopesCaches() |
void |
clearScopesCachesForModules() |
static java.lang.String |
extractLocalPath(java.lang.String url) |
protected void |
fireBeforeRootsChangeEvent(boolean fileTypes) |
protected void |
fireRootsChangedEvent(boolean fileTypes) |
protected java.lang.Runnable |
getActionToRunWhenProjectJdkChanges() |
protected ProjectRootManagerImpl.BatchSession |
getBatchSession(boolean fileTypes) |
VirtualFile [] |
getContentRoots()
Returns the list of content roots for all modules in the project.
|
VirtualFile [] |
getContentRootsFromAllModules()
Unlike getContentRoots(), this includes the project base dir.
|
java.util.List<java.lang.String> |
getContentRootUrls()
Returns the list of content root URLs for all modules in the project.
|
VirtualFile [] |
getContentSourceRoots()
Returns the list of source roots under the content roots for all modules in the project.
|
ProjectFileIndex |
getFileIndex()
Returns the file index for the project.
|
static ProjectRootManagerImpl |
getInstanceImpl(Project project) |
java.util.List<VirtualFile> |
getModuleSourceRoots(java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
Returns the list of source roots from all modules which types belong to the specified set
|
Project |
getProject() |
Sdk |
getProjectSdk() |
java.lang.String |
getProjectSdkName() |
java.lang.String |
getProjectSdkTypeName() |
VirtualFilePointerListener |
getRootsValidityChangedListener() |
Element |
getState() |
void |
loadState(Element element)
This method is called when new component state is loaded.
|
void |
makeRootsChange(java.lang.Runnable runnable,
boolean fileTypes,
boolean fireEvents) |
void |
markRootsForRefresh() |
void |
mergeRootsChangesDuring(java.lang.Runnable runnable) |
void |
noStateLoaded()
This method is called when the component is initialized, but no state is persisted.
|
OrderEnumerator |
orderEntries()
Creates new enumerator instance to process dependencies of all modules in the project.
|
OrderEnumerator |
orderEntries(java.util.Collection<? extends Module> modules)
Creates new enumerator instance to process dependencies of several modules in the project.
|
protected void |
projectJdkChanged() |
void |
removeProjectJdkListener(ProjectRootManagerEx.ProjectJdkListener listener) |
void |
setProjectSdk(Sdk sdk)
Sets the SDK to be used for the project.
|
void |
setProjectSdkName(java.lang.String name)
Deprecated.
|
void |
setProjectSdkName(java.lang.String name,
java.lang.String sdkTypeName)
Sets the name of the JDK to be used for the project
|
getInstanceEx
getInstance
getModificationCount, incModificationCount
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeComponent
protected final Project myProject
protected boolean myStartupActivityPerformed
protected final ProjectRootManagerImpl.BatchSession myRootsChanged
protected final ProjectRootManagerImpl.BatchSession myFileTypesChanged
protected boolean isFiringEvent
public ProjectRootManagerImpl(Project project)
public static ProjectRootManagerImpl getInstanceImpl(Project project)
public ProjectFileIndex getFileIndex()
ProjectRootManager
getFileIndex
in class ProjectRootManager
public java.util.List<java.lang.String> getContentRootUrls()
ProjectRootManager
getContentRootUrls
in class ProjectRootManager
public VirtualFile [] getContentRoots()
ProjectRootManager
getContentRoots
in class ProjectRootManager
public VirtualFile [] getContentSourceRoots()
ProjectRootManager
getContentSourceRoots
in class ProjectRootManager
public java.util.List<VirtualFile> getModuleSourceRoots(java.util.Set<? extends JpsModuleSourceRootType<?>> rootTypes)
ProjectRootManager
getModuleSourceRoots
in class ProjectRootManager
rootTypes
- types of source rootspublic OrderEnumerator orderEntries()
ProjectRootManager
OrderEnumerator.recursively()
option is ignored and OrderEnumerator.withoutDepModules()
option is forcedorderEntries
in class ProjectRootManager
public OrderEnumerator orderEntries(java.util.Collection<? extends Module> modules)
ProjectRootManager
orderEntries
in class ProjectRootManager
modules
- modules to processpublic VirtualFile [] getContentRootsFromAllModules()
ProjectRootManager
getContentRootsFromAllModules
in class ProjectRootManager
public Sdk getProjectSdk()
getProjectSdk
in class ProjectRootManager
public java.lang.String getProjectSdkName()
getProjectSdkName
in class ProjectRootManager
public java.lang.String getProjectSdkTypeName()
getProjectSdkTypeName
in class ProjectRootManager
SdkTypeId.getName()
of the current Project SDKpublic void setProjectSdk(Sdk sdk)
ProjectRootManager
setProjectSdk
in class ProjectRootManager
sdk
- the SDK instance.protected void projectJdkChanged()
protected java.lang.Runnable getActionToRunWhenProjectJdkChanges()
@Deprecated public void setProjectSdkName(java.lang.String name)
setProjectSdkName
in class ProjectRootManager
public void setProjectSdkName(java.lang.String name, java.lang.String sdkTypeName)
ProjectRootManager
setProjectSdkName
in class ProjectRootManager
sdkTypeName
- the SdkTypeId.getName()
of the SDK typepublic void addProjectJdkListener(ProjectRootManagerEx.ProjectJdkListener listener)
addProjectJdkListener
in class ProjectRootManagerEx
public void removeProjectJdkListener(ProjectRootManagerEx.ProjectJdkListener listener)
removeProjectJdkListener
in class ProjectRootManagerEx
public void loadState(Element element)
PersistentStateComponent
State object should be used directly, defensive copying is not required.
loadState
in interface PersistentStateComponent<Element>
element
- loaded component stateXmlSerializerUtil.copyBean(Object, Object)
public void noStateLoaded()
PersistentStateComponent
noStateLoaded
in interface PersistentStateComponent<Element>
public Element getState()
getState
in interface PersistentStateComponent<Element>
null
value indicates
that the returned state won't be stored, as a result previously stored state will be used.XmlSerializer
public void mergeRootsChangesDuring(java.lang.Runnable runnable)
mergeRootsChangesDuring
in class ProjectRootManagerEx
protected void clearScopesCaches()
public void clearScopesCachesForModules()
clearScopesCachesForModules
in class ProjectRootManagerEx
public void makeRootsChange(java.lang.Runnable runnable, boolean fileTypes, boolean fireEvents)
makeRootsChange
in class ProjectRootManagerEx
protected ProjectRootManagerImpl.BatchSession getBatchSession(boolean fileTypes)
protected void fireBeforeRootsChangeEvent(boolean fileTypes)
protected void fireRootsChangedEvent(boolean fileTypes)
public Project getProject()
public static java.lang.String extractLocalPath(java.lang.String url)
public void assertListenersAreDisposed()
assertListenersAreDisposed
in class ProjectRootManagerEx
public void markRootsForRefresh()
markRootsForRefresh
in class ProjectRootManagerEx
public VirtualFilePointerListener getRootsValidityChangedListener()