public abstract class PsiManager extends UserDataHolderBase
Constructor and Description |
---|
PsiManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addPsiTreeChangeListener(PsiTreeChangeListener listener)
Adds a listener for receiving notifications about all changes in the PSI tree of the project.
|
abstract void |
addPsiTreeChangeListener(PsiTreeChangeListener listener,
Disposable parentDisposable)
Adds a listener for receiving notifications about all changes in the PSI tree of the project.
|
abstract boolean |
areElementsEquivalent(PsiElement element1,
PsiElement element2)
Checks if the specified two PSI elements (possibly invalid) represent the same source element
or can are considered equivalent for resolve purposes.
|
abstract void |
dropPsiCaches()
Clears all
CachedValue depending on PsiModificationTracker.MODIFICATION_COUNT and resolve caches. |
abstract void |
dropResolveCaches()
Clears the resolve caches of the PSI manager.
|
abstract PsiDirectory |
findDirectory(VirtualFile file)
Returns the PSI directory corresponding to the specified virtual file system directory.
|
abstract PsiFile |
findFile(VirtualFile file)
Returns the PSI file corresponding to the specified virtual file.
|
abstract FileViewProvider |
findViewProvider(VirtualFile file) |
abstract void |
finishBatchFilesProcessingMode()
Notifies the PSI manager that a batch operation sequentially processing multiple files
is finishing.
|
static PsiManager |
getInstance(Project project)
Returns the PSI manager instance for the specified project.
|
abstract PsiModificationTracker |
getModificationTracker()
Returns the modification tracker for the project, which can be used to get the PSI
modification count value.
|
abstract Project |
getProject()
Returns the project with which the PSI manager is associated.
|
abstract boolean |
isDisposed()
Checks if the PSI manager has been disposed and the PSI for this project can no
longer be used.
|
abstract boolean |
isInProject(PsiElement element)
Checks if the specified PSI element belongs to the sources of the project.
|
abstract void |
reloadFromDisk(PsiFile file)
Reloads the contents of the specified PSI file and its associated document (if any) from the disk.
|
abstract void |
removePsiTreeChangeListener(PsiTreeChangeListener listener)
Removes a listener for receiving notifications about all changes in the PSI tree of the project.
|
abstract void |
startBatchFilesProcessingMode()
Notifies the PSI manager that a batch operation sequentially processing multiple files
is starting.
|
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
public static PsiManager getInstance(Project project)
project
- the project for which the PSI manager is requested.public abstract Project getProject()
public abstract PsiFile findFile(VirtualFile file)
file
- the file for which the PSI is requested.null
if file
is a directory, an invalid virtual file,
or the current project is a dummy or default project.public abstract FileViewProvider findViewProvider(VirtualFile file)
public abstract PsiDirectory findDirectory(VirtualFile file)
file
- the directory for which the PSI is requested.null
if there is no PSI for the specified directory in this project.public abstract boolean areElementsEquivalent(PsiElement element1, PsiElement element2)
Can be used to match two versions of the PSI tree with each other after a reparse.
For example, Java classes with the same fully-qualified name are equivalent, which is useful when working
with both library source and class roots. Source and compiled classes are definitely different (equals()
returns false
),
but for reference resolve or inheritance checks, they're equivalent.
element1
- the first element to check for equivalenceelement2
- the second element to check for equivalencetrue
if the elements are equivalent, false
if the elements are different or
it was not possible to determine the equivalencepublic abstract void reloadFromDisk(PsiFile file)
file
- the PSI file to reload.public abstract void addPsiTreeChangeListener(PsiTreeChangeListener listener)
listener
- the listener instance.public abstract void addPsiTreeChangeListener(PsiTreeChangeListener listener, Disposable parentDisposable)
listener
- the listener instance.parentDisposable
- object, after whose disposing the listener should be removedpublic abstract void removePsiTreeChangeListener(PsiTreeChangeListener listener)
listener
- the listener instance.public abstract PsiModificationTracker getModificationTracker()
public abstract void startBatchFilesProcessingMode()
public abstract void finishBatchFilesProcessingMode()
public abstract boolean isDisposed()
true
if the PSI manager is disposed, false
otherwise.public abstract void dropResolveCaches()
public abstract void dropPsiCaches()
CachedValue
depending on PsiModificationTracker.MODIFICATION_COUNT
and resolve caches.
Can be used to reduce memory consumption in batch operations sequentially processing multiple files. Should be invoked on Swing thread.public abstract boolean isInProject(PsiElement element)
element
- the element to check.true
if the element belongs to the sources of the project, false
otherwise.