public final class PsiManagerImpl extends PsiManagerEx implements Disposable
Disposable.Parent| Modifier and Type | Field and Description |
|---|---|
static Topic<AnyPsiChangeListener> |
ANY_PSI_CHANGE_TOPIC |
| Constructor and Description |
|---|
PsiManagerImpl(Project project) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPsiTreeChangeListener(PsiTreeChangeListener listener)
Adds a listener for receiving notifications about all changes in the PSI tree of the project.
|
void |
addPsiTreeChangeListener(PsiTreeChangeListener listener,
Disposable parentDisposable)
Adds a listener for receiving notifications about all changes in the PSI tree of the project.
|
void |
addTreeChangePreprocessor(PsiTreeChangePreprocessor preprocessor) |
void |
afterChange(boolean isPhysical) |
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.
|
void |
beforeChange(boolean isPhysical) |
void |
beforeChildAddition(PsiTreeChangeEventImpl event) |
void |
beforeChildMovement(PsiTreeChangeEventImpl event) |
void |
beforeChildRemoval(PsiTreeChangeEventImpl event) |
void |
beforeChildrenChange(PsiTreeChangeEventImpl event) |
void |
beforeChildReplacement(PsiTreeChangeEventImpl event) |
void |
beforePropertyChange(PsiTreeChangeEventImpl event) |
void |
childAdded(PsiTreeChangeEventImpl event) |
void |
childMoved(PsiTreeChangeEventImpl event) |
void |
childRemoved(PsiTreeChangeEventImpl event) |
void |
childrenChanged(PsiTreeChangeEventImpl event) |
void |
childReplaced(PsiTreeChangeEventImpl event) |
void |
cleanupForNextTest() |
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
dropPsiCaches()
Clears all
CachedValue depending on PsiModificationTracker.MODIFICATION_COUNT and resolve caches. |
void |
dropResolveCacheRegularly(ProgressIndicator indicator) |
void |
dropResolveCaches()
Clears the resolve caches of the PSI manager.
|
PsiDirectory |
findDirectory(VirtualFile file)
Returns the PSI directory corresponding to the specified virtual file system directory.
|
PsiFile |
findFile(VirtualFile file)
Returns the PSI file corresponding to the specified virtual file.
|
FileViewProvider |
findViewProvider(VirtualFile file) |
void |
finishBatchFilesProcessingMode()
Notifies the PSI manager that a batch operation sequentially processing multiple files
is finishing.
|
FileManager |
getFileManager() |
PsiModificationTracker |
getModificationTracker()
Returns the modification tracker for the project, which can be used to get the PSI
modification count value.
|
Project |
getProject()
Returns the project with which the PSI manager is associated.
|
boolean |
isAssertOnFileLoading(VirtualFile file) |
boolean |
isBatchFilesProcessingMode() |
boolean |
isDisposed()
Checks if the PSI manager has been disposed and the PSI for this project can no
longer be used.
|
boolean |
isInProject(PsiElement element)
Checks if the specified PSI element belongs to the sources of the project.
|
void |
propertyChanged(PsiTreeChangeEventImpl event) |
void |
registerRunnableToRunAfterAnyChange(java.lang.Runnable runnable) |
void |
registerRunnableToRunOnAnyChange(java.lang.Runnable runnable) |
void |
registerRunnableToRunOnChange(java.lang.Runnable runnable) |
void |
reloadFromDisk(PsiFile file)
Reloads the contents of the specified PSI file and its associated document (if any) from the disk.
|
void |
removePsiTreeChangeListener(PsiTreeChangeListener listener)
Removes a listener for receiving notifications about all changes in the PSI tree of the project.
|
void |
removeTreeChangePreprocessor(PsiTreeChangePreprocessor preprocessor) |
void |
setAssertOnFileLoadingFilter(VirtualFileFilter filter,
Disposable parentDisposable) |
void |
startBatchFilesProcessingMode()
Notifies the PSI manager that a batch operation sequentially processing multiple files
is starting.
|
getInstanceExgetInstancechangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMappublic static final Topic<AnyPsiChangeListener> ANY_PSI_CHANGE_TOPIC
public PsiManagerImpl(Project project)
public void dispose()
Disposabledispose in interface Disposablepublic boolean isDisposed()
PsiManagerisDisposed in class PsiManagertrue if the PSI manager is disposed, false otherwise.public void dropResolveCaches()
PsiManagerdropResolveCaches in class PsiManagerpublic void dropPsiCaches()
PsiManagerCachedValue 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.dropPsiCaches in class PsiManagerpublic boolean isInProject(PsiElement element)
PsiManagerisInProject in class PsiManagerelement - the element to check.true if the element belongs to the sources of the project, false otherwise.public void setAssertOnFileLoadingFilter(VirtualFileFilter filter, Disposable parentDisposable)
setAssertOnFileLoadingFilter in class PsiManagerExpublic boolean isAssertOnFileLoading(VirtualFile file)
isAssertOnFileLoading in class PsiManagerExpublic Project getProject()
PsiManagergetProject in class PsiManagerpublic FileManager getFileManager()
getFileManager in class PsiManagerExpublic boolean areElementsEquivalent(PsiElement element1, PsiElement element2)
PsiManagerCan 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.
areElementsEquivalent in class PsiManagerelement1 - 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 PsiFile findFile(VirtualFile file)
PsiManagerfindFile in class PsiManagerfile - 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 FileViewProvider findViewProvider(VirtualFile file)
findViewProvider in class PsiManagerpublic PsiDirectory findDirectory(VirtualFile file)
PsiManagerfindDirectory in class PsiManagerfile - the directory for which the PSI is requested.null if there is no PSI for the specified directory in this project.public void reloadFromDisk(PsiFile file)
PsiManagerreloadFromDisk in class PsiManagerfile - the PSI file to reload.public void addPsiTreeChangeListener(PsiTreeChangeListener listener)
PsiManageraddPsiTreeChangeListener in class PsiManagerlistener - the listener instance.public void addPsiTreeChangeListener(PsiTreeChangeListener listener, Disposable parentDisposable)
PsiManageraddPsiTreeChangeListener in class PsiManagerlistener - the listener instance.parentDisposable - object, after whose disposing the listener should be removedpublic void removePsiTreeChangeListener(PsiTreeChangeListener listener)
PsiManagerremovePsiTreeChangeListener in class PsiManagerlistener - the listener instance.public void beforeChildAddition(PsiTreeChangeEventImpl event)
beforeChildAddition in class PsiManagerExpublic void beforeChildRemoval(PsiTreeChangeEventImpl event)
beforeChildRemoval in class PsiManagerExpublic void beforeChildReplacement(PsiTreeChangeEventImpl event)
beforeChildReplacement in class PsiManagerExpublic void beforeChildrenChange(PsiTreeChangeEventImpl event)
public void beforeChildMovement(PsiTreeChangeEventImpl event)
public void beforePropertyChange(PsiTreeChangeEventImpl event)
public void childAdded(PsiTreeChangeEventImpl event)
public void childRemoved(PsiTreeChangeEventImpl event)
public void childReplaced(PsiTreeChangeEventImpl event)
public void childMoved(PsiTreeChangeEventImpl event)
public void childrenChanged(PsiTreeChangeEventImpl event)
public void propertyChanged(PsiTreeChangeEventImpl event)
public void addTreeChangePreprocessor(PsiTreeChangePreprocessor preprocessor)
public void removeTreeChangePreprocessor(PsiTreeChangePreprocessor preprocessor)
public void registerRunnableToRunOnChange(java.lang.Runnable runnable)
registerRunnableToRunOnChange in class PsiManagerExrunnable - to be run before physical PSI changepublic void registerRunnableToRunOnAnyChange(java.lang.Runnable runnable)
registerRunnableToRunOnAnyChange in class PsiManagerExrunnable - to be run before physical or non-physical PSI changepublic void registerRunnableToRunAfterAnyChange(java.lang.Runnable runnable)
registerRunnableToRunAfterAnyChange in class PsiManagerExpublic void beforeChange(boolean isPhysical)
beforeChange in class PsiManagerExpublic void afterChange(boolean isPhysical)
afterChange in class PsiManagerExpublic PsiModificationTracker getModificationTracker()
PsiManagergetModificationTracker in class PsiManagerpublic void startBatchFilesProcessingMode()
PsiManagerstartBatchFilesProcessingMode in class PsiManagerpublic void finishBatchFilesProcessingMode()
PsiManagerfinishBatchFilesProcessingMode in class PsiManagerpublic boolean isBatchFilesProcessingMode()
isBatchFilesProcessingMode in class PsiManagerExpublic void cleanupForNextTest()
public void dropResolveCacheRegularly(ProgressIndicator indicator)