Search in sources :

Example 41 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class InjectedPsiCachedValueProvider method compute.

@Override
public CachedValueProvider.Result<MultiHostRegistrarImpl> compute(PsiElement element) {
    PsiFile hostPsiFile = element.getContainingFile();
    if (hostPsiFile == null)
        return null;
    FileViewProvider viewProvider = hostPsiFile.getViewProvider();
    final DocumentEx hostDocument = (DocumentEx) viewProvider.getDocument();
    if (hostDocument == null)
        return null;
    PsiManager psiManager = viewProvider.getManager();
    final Project project = psiManager.getProject();
    InjectedLanguageManagerImpl injectedManager = InjectedLanguageManagerImpl.getInstanceImpl(project);
    final MultiHostRegistrarImpl result = doCompute(element, injectedManager, project, hostPsiFile);
    return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT, hostDocument);
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) Project(com.intellij.openapi.project.Project) FileViewProvider(com.intellij.psi.FileViewProvider) PsiManager(com.intellij.psi.PsiManager) PsiFile(com.intellij.psi.PsiFile)

Example 42 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class PersistentRangeHighlighterImpl method translatedViaDiff.

private boolean translatedViaDiff(DocumentEvent e, DocumentEventImpl event) {
    try {
        myLine = event.translateLineViaDiff(myLine);
    } catch (FilesTooBigForDiffException ignored) {
        return false;
    }
    if (myLine < 0 || myLine >= getDocument().getLineCount()) {
        invalidate(e);
    } else {
        DocumentEx document = getDocument();
        setIntervalStart(document.getLineStartOffset(myLine));
        setIntervalEnd(document.getLineEndOffset(myLine));
    }
    return true;
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) FilesTooBigForDiffException(com.intellij.util.diff.FilesTooBigForDiffException)

Example 43 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class EditorFactoryImpl method createDocument.

@NotNull
public Document createDocument(@NotNull CharSequence text, boolean acceptsSlashR, boolean allowUpdatesWithoutWriteAction) {
    DocumentEx document = new DocumentImpl(text, acceptsSlashR, allowUpdatesWithoutWriteAction);
    myEditorEventMulticaster.registerDocument(document);
    return document;
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) NotNull(org.jetbrains.annotations.NotNull)

Example 44 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class EditorFactoryImpl method createDocument.

@NotNull
public Document createDocument(boolean allowUpdatesWithoutWriteAction) {
    DocumentEx document = new DocumentImpl("", allowUpdatesWithoutWriteAction);
    myEditorEventMulticaster.registerDocument(document);
    return document;
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) NotNull(org.jetbrains.annotations.NotNull)

Example 45 with DocumentEx

use of com.intellij.openapi.editor.ex.DocumentEx in project intellij-community by JetBrains.

the class EditorFactoryImpl method createDocument.

@Override
@NotNull
public Document createDocument(@NotNull CharSequence text) {
    DocumentEx document = new DocumentImpl(text);
    myEditorEventMulticaster.registerDocument(document);
    return document;
}
Also used : DocumentEx(com.intellij.openapi.editor.ex.DocumentEx) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DocumentEx (com.intellij.openapi.editor.ex.DocumentEx)87 Document (com.intellij.openapi.editor.Document)12 NotNull (org.jetbrains.annotations.NotNull)8 RangeMarkerEx (com.intellij.openapi.editor.ex.RangeMarkerEx)7 Project (com.intellij.openapi.project.Project)7 TextRange (com.intellij.openapi.util.TextRange)7 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)7 PsiFile (com.intellij.psi.PsiFile)6 Nullable (org.jetbrains.annotations.Nullable)5 EditorEx (com.intellij.openapi.editor.ex.EditorEx)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 MockVirtualFile (com.intellij.mock.MockVirtualFile)3 FoldRegion (com.intellij.openapi.editor.FoldRegion)3 PsiDocumentManager (com.intellij.psi.PsiDocumentManager)3 DocumentWindow (com.intellij.injected.editor.DocumentWindow)2 DocumentBulkUpdateListener (com.intellij.openapi.editor.ex.DocumentBulkUpdateListener)2 DocumentImpl (com.intellij.openapi.editor.impl.DocumentImpl)2 DocumentMarkupModel (com.intellij.openapi.editor.impl.DocumentMarkupModel)2 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)2 FileDocumentManagerAdapter (com.intellij.openapi.fileEditor.FileDocumentManagerAdapter)2