Search in sources :

Example 1 with TreeAspectEvent

use of com.intellij.pom.tree.TreeAspectEvent in project intellij-community by JetBrains.

the class PomModelImpl method reparseFile.

@Nullable
private Runnable reparseFile(@NotNull final PsiFile file, @NotNull FileElement treeElement, @NotNull CharSequence newText) {
    TextRange changedPsiRange = DocumentCommitThread.getChangedPsiRange(file, treeElement, newText);
    if (changedPsiRange == null)
        return null;
    Runnable reparseLeaf = tryReparseOneLeaf(treeElement, newText, changedPsiRange);
    if (reparseLeaf != null)
        return reparseLeaf;
    final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, treeElement, changedPsiRange, newText, new EmptyProgressIndicator(), treeElement.getText());
    return () -> runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {

        @Nullable
        @Override
        public PomModelEvent runInner() throws IncorrectOperationException {
            return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
        }
    });
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) ThrowableRunnable(com.intellij.util.ThrowableRunnable) TextRange(com.intellij.openapi.util.TextRange) PomTransactionBase(com.intellij.pom.impl.PomTransactionBase) IncorrectOperationException(com.intellij.util.IncorrectOperationException) PomModelEvent(com.intellij.pom.event.PomModelEvent) TreeAspectEvent(com.intellij.pom.tree.TreeAspectEvent) DiffLog(com.intellij.psi.impl.source.text.DiffLog) Nullable(org.jetbrains.annotations.Nullable) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 TextRange (com.intellij.openapi.util.TextRange)1 PomModelEvent (com.intellij.pom.event.PomModelEvent)1 PomTransactionBase (com.intellij.pom.impl.PomTransactionBase)1 TreeAspectEvent (com.intellij.pom.tree.TreeAspectEvent)1 DiffLog (com.intellij.psi.impl.source.text.DiffLog)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1 ThrowableRunnable (com.intellij.util.ThrowableRunnable)1 Nullable (org.jetbrains.annotations.Nullable)1