public class ProjectImpl extends ComponentManagerImpl implements ProjectEx
ProjectEx.ProjectSaved
Disposable.Parent
Modifier and Type | Field and Description |
---|---|
static Key<java.lang.Long> |
CREATION_TIME |
static Key<java.lang.String> |
CREATION_TRACE |
static java.lang.String |
LIGHT_PROJECT_NAME |
DIRECTORY_STORE_FOLDER
Modifier | Constructor and Description |
---|---|
protected |
ProjectImpl(java.nio.file.Path filePath,
java.lang.String projectName) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
activityNamePrefix() |
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
disposeEarlyDisposable() |
VirtualFile |
getBaseDir()
Returns a project base directory - a parent directory of a
.ipr file or .idea directory.Returns null for default project. |
@SystemIndependent java.lang.String |
getBasePath()
Returns a path to a project base directory (see Project.getBaseDir()).
Returns null for default project. |
IComponentStore |
getComponentStore() |
protected ContainerDescriptor |
getContainerDescriptor(IdeaPluginDescriptorImpl pluginDescriptor) |
java.lang.String |
getCreationTrace() |
Disposable |
getEarlyDisposable()
Disposable that will be disposed right after container started to be disposed. |
java.lang.String |
getLocationHash() |
java.lang.String |
getName()
Returns a name ot the project.
|
@SystemDependent java.lang.String |
getPresentableUrl()
Returns presentable project path:
Project.getProjectFilePath() for file-based projects, Project.getBasePath() for directory-based ones.
Returns null for default project. |
VirtualFile |
getProjectFile()
Returns project descriptor file:
path/to/project/project.ipr - for file-based projects
path/to/project/.idea/misc.xml - for directory-based projects
Returns null for default project. |
@SystemIndependent java.lang.String |
getProjectFilePath() |
IProjectStore |
getStateStore() |
VirtualFile |
getWorkspaceFile()
Returns a workspace file:
path/to/project/project.iws - for file-based projects
path/to/project/.idea/workspace.xml - for directory-based ones
Returns null for default project. |
void |
init(ProgressIndicator indicator) |
boolean |
isDefault() |
boolean |
isDisposed() |
boolean |
isInitialized() |
boolean |
isLight() |
boolean |
isOpen() |
void |
save() |
protected void |
setProgressDuringInit(ProgressIndicator indicator) |
void |
setProjectName(java.lang.String projectName) |
void |
setProjectStoreFactory(ProjectStoreFactory projectStoreFactory)
This method is temporary introduced to allow overriding project store class for a specific project.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createError, createError, getComponent, getComponent, getComponent, getComponentInstancesOfType, getComponentInstancesOfType, getComponents, getDisposed, getExtensionArea, getExtensions, getMessageBus, getPicoContainer, getService, getService, getServiceIfCreated, hasComponent, instantiateClass, instantiateClassWithConstructorInjection, instantiateExtensionWithPicoContainerOnlyIfNeeded, isDisposedOrDisposeInProgress, logError
getUserData, putUserData
public static final Key<java.lang.Long> CREATION_TIME
public static final Key<java.lang.String> CREATION_TRACE
public static final java.lang.String LIGHT_PROJECT_NAME
protected ProjectImpl(java.nio.file.Path filePath, java.lang.String projectName)
public final boolean isDisposed()
isDisposed
in interface ComponentManager
dispose()
was called but not completed yet)
public void setProjectStoreFactory(ProjectStoreFactory projectStoreFactory)
public void setProjectName(java.lang.String projectName)
setProjectName
in interface ProjectEx
public final IProjectStore getStateStore()
public IComponentStore getComponentStore()
public boolean isInitialized()
isInitialized
in interface Project
protected ContainerDescriptor getContainerDescriptor(IdeaPluginDescriptorImpl pluginDescriptor)
public @SystemIndependent java.lang.String getProjectFilePath()
getProjectFilePath
in interface Project
null
for default project.public VirtualFile getProjectFile()
Project
path/to/project/project.ipr
- for file-based projectspath/to/project/.idea/misc.xml
- for directory-based projectsnull
for default project.getProjectFile
in interface Project
public VirtualFile getBaseDir()
Project
.ipr
file or .idea
directory.null
for default project.getBaseDir
in interface Project
com.intellij.openapi.project.ProjectUtil#guessProjectDir
,
Project.getBasePath()
public @SystemIndependent java.lang.String getBasePath()
Project
null
for default project.getBasePath
in interface Project
com.intellij.openapi.project.ProjectUtil#guessProjectDir
public java.lang.String getName()
Project
public @SystemDependent java.lang.String getPresentableUrl()
Project
null
for default project.
Note: the word "presentable" here implies file system presentation, not a UI one.getPresentableUrl
in interface Project
public java.lang.String getLocationHash()
getLocationHash
in interface Project
public VirtualFile getWorkspaceFile()
Project
Returns a workspace file:
path/to/project/project.iws
- for file-based projectspath/to/project/.idea/workspace.xml
- for directory-based onesnull
for default project.getWorkspaceFile
in interface Project
public void init(ProgressIndicator indicator)
protected void setProgressDuringInit(ProgressIndicator indicator)
public void dispose()
Disposable
dispose
in interface Disposable
public java.lang.String toString()
public java.lang.String getCreationTrace()
public java.lang.String activityNamePrefix()
public final Disposable getEarlyDisposable()
ProjectEx
Disposable
that will be disposed right after container started to be disposed.
Use it to dispose something that need to be disposed very early, e.g. Alarm
.
Or, only and only in unit test mode, if you need to publish something to message bus during dispose.
In unit test mode light project is not disposed, but this disposable is disposed for each test.
So, you don't need to have another disposable and can use this one instead.
Dependent Disposable.dispose()
may be called in any thread.
Implementation of Disposable.dispose()
must be self-contained and isolated (getting services is forbidden, publishing to message bus is allowed only in tests).getEarlyDisposable
in interface ProjectEx
public final void disposeEarlyDisposable()