Search in sources :

Example 1 with PsiToDocumentSynchronizer

use of com.intellij.psi.impl.PsiToDocumentSynchronizer in project intellij-community by JetBrains.

the class FormattingDocumentModelImpl method getDocumentToBeUsedFor.

@Nullable
public static Document getDocumentToBeUsedFor(final PsiFile file) {
    final Project project = file.getProject();
    final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
    if (document == null)
        return null;
    if (PsiDocumentManager.getInstance(project).isUncommited(document))
        return null;
    PsiToDocumentSynchronizer synchronizer = ((PsiDocumentManagerImpl) PsiDocumentManager.getInstance(project)).getSynchronizer();
    if (synchronizer.isDocumentAffectedByTransactions(document))
        return null;
    return document;
}
Also used : Project(com.intellij.openapi.project.Project) PsiToDocumentSynchronizer(com.intellij.psi.impl.PsiToDocumentSynchronizer) PsiDocumentManagerImpl(com.intellij.psi.impl.PsiDocumentManagerImpl) Document(com.intellij.openapi.editor.Document) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Document (com.intellij.openapi.editor.Document)1 Project (com.intellij.openapi.project.Project)1 PsiDocumentManagerImpl (com.intellij.psi.impl.PsiDocumentManagerImpl)1 PsiToDocumentSynchronizer (com.intellij.psi.impl.PsiToDocumentSynchronizer)1 Nullable (org.jetbrains.annotations.Nullable)1