当前位置: 首页>>代码示例>>Java>>正文


Java TreeAspectEvent类代码示例

本文整理汇总了Java中com.intellij.pom.tree.TreeAspectEvent的典型用法代码示例。如果您正苦于以下问题:Java TreeAspectEvent类的具体用法?Java TreeAspectEvent怎么用?Java TreeAspectEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeAspectEvent类属于com.intellij.pom.tree包,在下文中一共展示了TreeAspectEvent类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reparseFile

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
private void reparseFile(final PsiFile file, FileElement treeElement, CharSequence newText) {
  PsiToDocumentSynchronizer synchronizer =((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).getSynchronizer();
  TextRange changedPsiRange = DocumentCommitProcessor.getChangedPsiRange(file, treeElement, newText);
  if (changedPsiRange == null) return;

  final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, changedPsiRange, newText, new EmptyProgressIndicator(),
                                                                       treeElement.getText());
  synchronizer.setIgnorePsiEvents(true);
  try {
    CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
      @Override
      public void run() {
        runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
          @Nullable
          @Override
          public PomModelEvent runInner() throws IncorrectOperationException {
            return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
          }
        });
      }
    });
  }
  finally {
    synchronizer.setIgnorePsiEvents(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PomModelImpl.java

示例2: reparseFile

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
@Nullable
private Runnable reparseFile(@Nonnull final PsiFile file, @Nonnull FileElement treeElement, @Nonnull CharSequence newText) {
  TextRange changedPsiRange = ChangedPsiRangeUtil.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)) {
    @Override
    public PomModelEvent runInner() throws IncorrectOperationException {
      return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:PomModelImpl.java

示例3: doActualPsiChange

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public void doActualPsiChange(@Nonnull PsiFile file) {
  CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled((Runnable)() -> {
    FileViewProvider viewProvider = file.getViewProvider();
    synchronized (((AbstractFileViewProvider)viewProvider).getFilePsiLock()) {
      viewProvider.beforeContentsSynchronized();

      final Document document = viewProvider.getDocument();
      PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
      PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);

      if (transaction == null) {
        final PomModel model = PomManager.getModel(file.getProject());

        model.runTransaction(new PomTransactionBase(file, model.getModelAspect(TreeAspect.class)) {
          @Override
          public PomModelEvent runInner() {
            return new TreeAspectEvent(model, performActualPsiChange(file));
          }
        });
      }
      else {
        performActualPsiChange(file);
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:DiffLog.java

示例4: doActualPsiChange

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {
  CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
    @Override
    public void run() {
      synchronized (PsiLock.LOCK) {
        file.getViewProvider().beforeContentsSynchronized();

        final Document document = file.getViewProvider().getDocument();
        PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
        PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);

        final PsiFileImpl fileImpl = (PsiFileImpl)file;

        if (transaction == null) {
          final PomModel model = PomManager.getModel(fileImpl.getProject());

          model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
            @Override
            public PomModelEvent runInner() {
              return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
            }
          });
        }
        else {
          diffLog.performActualPsiChange(file);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:DocumentCommitProcessor.java

示例5: reparseFile

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
private void reparseFile(final PsiFile file, String newText, String oldText) {
  if (oldText.equals(newText)) return;

  PsiToDocumentSynchronizer synchronizer =((PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject)).getSynchronizer();
  int changeStart = StringUtil.commonPrefixLength(oldText, newText);
  int changeEnd = oldText.length() - StringUtil.commonSuffixLength(oldText, newText);
  TextRange changedPsiRange = DocumentCommitProcessor.getChangedPsiRange(file, changeStart, changeEnd, newText.length());
  final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, changedPsiRange, newText, new EmptyProgressIndicator());
  synchronizer.setIgnorePsiEvents(true);
  try {
    CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
      @Override
      public void run() {
        runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {
          @Nullable
          @Override
          public PomModelEvent runInner() throws IncorrectOperationException {
            return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
          }
        });
      }
    });
  }
  finally {
    synchronizer.setIgnorePsiEvents(false);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:PomModelImpl.java

示例6: doActualPsiChange

import com.intellij.pom.tree.TreeAspectEvent; //导入依赖的package包/类
public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {
  file.getViewProvider().beforeContentsSynchronized();

  try {
    final Document document = file.getViewProvider().getDocument();
    PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
    PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);

    final PsiFileImpl fileImpl = (PsiFileImpl)file;

    if (transaction == null) {
      final PomModel model = PomManager.getModel(fileImpl.getProject());

      model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
        @Override
        public PomModelEvent runInner() {
          return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
        }
      });
    }
    else {
      diffLog.performActualPsiChange(file);
    }
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:DocumentCommitProcessor.java


注:本文中的com.intellij.pom.tree.TreeAspectEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。