public abstract class PsiDocumentManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
PsiDocumentManager.Listener
|
Constructor and Description |
---|
PsiDocumentManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addListener(PsiDocumentManager.Listener listener)
Deprecated.
Use message bus
Listener#TOPIC . |
abstract void |
commitAllDocuments()
Commits (updates the PSI tree for) all modified but not committed documents.
|
abstract boolean |
commitAllDocumentsUnderProgress()
Commits all modified but not committed documents under modal dialog (see
commitAllDocuments()
Should be called in UI thread and outside of write-action |
abstract <T> T |
commitAndRunReadAction(Computable<T> computation)
Commits the documents and runs the specified operation, which returns a value, in a read action.
|
abstract void |
commitAndRunReadAction(java.lang.Runnable runnable)
Commits the documents and runs the specified operation, which does not return a value, in a read action.
|
abstract void |
commitDocument(Document document)
Updates the PSI tree for the specified document.
|
abstract void |
doPostponedOperationsAndUnblockDocument(Document doc)
Applies pending changes made through the PSI to the specified document.
|
abstract Document |
getCachedDocument(PsiFile file)
Returns the cached document for the specified PSI file.
|
abstract PsiFile |
getCachedPsiFile(Document document)
Returns the cached PSI file for the specified document.
|
abstract Document |
getDocument(PsiFile file)
Returns the document for the specified PSI file.
|
static PsiDocumentManager |
getInstance(Project project)
Returns the document manager instance for the specified project.
|
abstract Document |
getLastCommittedDocument(PsiFile file)
Returns the document for specified PsiFile intended to be used when working with committed PSI, e.g.
|
abstract long |
getLastCommittedStamp(Document document) |
abstract java.lang.CharSequence |
getLastCommittedText(Document document) |
abstract PsiFile |
getPsiFile(Document document)
Returns the PSI file for the specified document.
|
abstract Document [] |
getUncommittedDocuments()
Returns the list of documents which have been modified but not committed.
|
abstract boolean |
hasUncommitedDocuments()
Checks if any modified documents have not been committed.
|
abstract boolean |
isCommitted(Document document)
Checks if the PSI tree for the specified document is up to date (its state reflects the latest changes made
to the document content).
|
abstract boolean |
isDocumentBlockedByPsi(Document doc)
Checks if the PSI tree corresponding to the specified document has been modified and the changes have not
yet been applied to the document.
|
abstract boolean |
isUncommited(Document document)
Checks if the specified document has been committed.
|
abstract void |
performForCommittedDocument(Document document,
java.lang.Runnable action)
If the document is committed, runs action synchronously, otherwise schedules to execute it right after it has been committed.
|
abstract void |
performLaterWhenAllCommitted(java.lang.Runnable runnable)
|
abstract void |
performLaterWhenAllCommitted(java.lang.Runnable runnable,
ModalityState modalityState)
Schedule the runnable to be executed on Swing thread when all the documents with event-system-enabled PSI
are committed at some later moment in a given modality state.
|
abstract boolean |
performWhenAllCommitted(java.lang.Runnable action)
Defer action until all documents with event-system-enabled PSI are committed.
|
abstract void |
removeListener(PsiDocumentManager.Listener listener)
Deprecated.
Use message bus
Listener#TOPIC . |
abstract void |
reparseFiles(java.util.Collection<? extends VirtualFile> files,
boolean includeOpenFiles)
Reparses the specified set of files after an external configuration change that would cause them to be parsed differently
(for example, a language level change in the settings).
|
public abstract boolean isCommitted(Document document)
document
- the document to check.public static PsiDocumentManager getInstance(Project project)
project
- the project for which the document manager is requested.public abstract PsiFile getPsiFile(Document document)
document
- the document for which the PSI file is requested.public abstract PsiFile getCachedPsiFile(Document document)
document
- the document for which the PSI file is requested.null
if there is currently no cached PSI tree for the file.public abstract Document getDocument(PsiFile file)
file
- the file for which the document is requested.null
if the file is binary or has no associated document.public abstract Document getCachedDocument(PsiFile file)
file
- the file for which the document is requested.null
if there is currently no cached document for the file.public abstract void commitAllDocuments()
TransactionGuard
)public abstract boolean commitAllDocumentsUnderProgress()
commitAllDocuments()
Should be called in UI thread and outside of write-actionpublic abstract void performForCommittedDocument(Document document, java.lang.Runnable action)
public abstract void commitDocument(Document document)
FileViewProvider.isEventSystemEnabled()
), should be called in UI thread in a write-safe context (see TransactionGuard
).
For other documents, can be called in background thread with read access. It's the responsibility of the caller to properly synchronize
that PSI and ensure no other threads are reading or modifying it concurrently.document
- the document to commit.public abstract java.lang.CharSequence getLastCommittedText(Document document)
ImmutableCharSequence
public abstract long getLastCommittedStamp(Document document)
Document.getModificationStamp()
,
FileViewProvider.getModificationStamp()
public abstract Document getLastCommittedDocument(PsiFile file)
file
- the file for which the document is requested.getDocument(PsiFile)
. For uncommitted documents, the text is getLastCommittedText(Document)
and
the modification stamp is getLastCommittedStamp(Document)
.public abstract Document [] getUncommittedDocuments()
commitDocument(Document)
public abstract boolean isUncommited(Document document)
document
- the document to check.commitDocument(Document)
public abstract boolean hasUncommitedDocuments()
public abstract void commitAndRunReadAction(java.lang.Runnable runnable)
runnable
- the operation to execute.public abstract <T> T commitAndRunReadAction(Computable<T> computation)
computation
- the operation to execute.public abstract void reparseFiles(java.util.Collection<? extends VirtualFile> files, boolean includeOpenFiles)
files
- the files to reparse.includeOpenFiles
- if true, the files opened in editor tabs will also be reparsed.@Deprecated public abstract void addListener(PsiDocumentManager.Listener listener)
Listener#TOPIC
.@Deprecated public abstract void removeListener(PsiDocumentManager.Listener listener)
Listener#TOPIC
.public abstract boolean isDocumentBlockedByPsi(Document doc)
doPostponedOperationsAndUnblockDocument(com.intellij.openapi.editor.Document)
.doc
- the document to check.public abstract void doPostponedOperationsAndUnblockDocument(Document doc)
doc
- the document to apply the changes to.public abstract boolean performWhenAllCommitted(java.lang.Runnable action)
action
- to run when all documents committedpublic abstract void performLaterWhenAllCommitted(java.lang.Runnable runnable)
public abstract void performLaterWhenAllCommitted(java.lang.Runnable runnable, ModalityState modalityState)