• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PsiTreeChangeEventImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doActualPsiChange

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
void doActualPsiChange(@NotNull PsiFile file, @NotNull ASTDiffBuilder astDiffBuilder) {
  ASTNode child = myOldNode;
  ASTNode parent = myOldParent;

  PsiElement psiParent = parent.getPsi();
  PsiElement psiChild = file.isPhysical() ? child.getPsi() : null;

  if (psiParent != null && psiChild != null) {
    PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(file.getManager());
    event.setParent(psiParent);
    event.setChild(psiChild);
    event.setFile(file);
    ((PsiManagerEx)file.getManager()).beforeChildRemoval(event);
  }

  astDiffBuilder.nodeDeleted(parent, child);

  ((TreeElement)child).rawRemove();
  ((CompositeElement)parent).subtreeChanged();

  DebugUtil.checkTreeStructure(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DiffLog.java


示例2: sendAfterChildrenChangedEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
public static void sendAfterChildrenChangedEvent(@NotNull PsiManagerImpl manager,
                                                 @NotNull PsiFile scope,
                                                 int oldLength,
                                                 boolean isGenericChange) {
  if (!scope.isPhysical()) {
    manager.afterChange(false);
    return;
  }
  PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
  event.setParent(scope);
  event.setFile(scope);
  event.setOffset(0);
  event.setOldLength(oldLength);
  event.setGenericChange(isGenericChange);
  manager.childrenChanged(event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BlockSupportImpl.java


示例3: beforeRootsChange

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void beforeRootsChange(final ModuleRootEvent event) {
  if (!myFileManager.isInitialized()) return;
  if (event.isCausedByFileTypesChange()) return;
  ApplicationManager.getApplication().runWriteAction(
    new ExternalChangeAction() {
      @Override
      public void run() {
        depthCounter++;
        if (depthCounter > 1) return;

        PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
        treeEvent.setPropertyName(PsiTreeChangeEvent.PROP_ROOTS);
        final VirtualFile[] contentRoots = myProjectRootManager.getContentRoots();
        LOG.assertTrue(myOldContentRoots == null);
        myOldContentRoots = contentRoots;
        treeEvent.setOldValue(contentRoots);
        myManager.beforePropertyChange(treeEvent);
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PsiVFSListener.java


示例4: doActualPsiChange

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
void doActualPsiChange(@NotNull PsiFile file, @NotNull ASTDiffBuilder astDiffBuilder) {
  ASTNode child = myOldNode;
  ASTNode parent = myOldParent;

  PsiElement psiParent = parent.getPsi();
  PsiElement psiChild = file.isPhysical() ? child.getPsi() : null;

  if (psiParent != null && psiChild != null) {
    PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(file.getManager());
    event.setParent(psiParent);
    event.setChild(psiChild);
    event.setFile(file);
    ((PsiManagerEx)file.getManager()).beforeChildRemoval(event);
  }

  astDiffBuilder.nodeDeleted(parent, child);

  ((TreeElement)child).rawRemove();
  ((CompositeElement)parent).subtreeChanged();

  DebugUtil.checkTreeStructure(parent);

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:DiffLog.java


示例5: sendAfterChildrenChangedEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
public static void sendAfterChildrenChangedEvent(@NotNull PsiManagerImpl manager,
                                                 @NotNull PsiFileImpl scope,
                                                 int oldLength,
                                                 boolean isGenericChange) {
  if(!scope.isPhysical()) {
    manager.afterChange(false);
    return;
  }
  PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
  event.setParent(scope);
  event.setFile(scope);
  event.setOffset(0);
  event.setOldLength(oldLength);
  event.setGeneric(isGenericChange);
  manager.childrenChanged(event);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:BlockSupportImpl.java


示例6: fireEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
void fireEvent(int parentStart, PsiFile file, CompositeElement parent) {
  PsiTreeChangeEventImpl e = createEvent(file, myOffset + parentStart);

  if (myOldChild == myNewChild && myNewChild != null) {
    childrenChanged(e, myNewChild, myOldLength);
  }
  else if (myOldChild != null && myNewChild != null) {
    childReplaced(e, myOldChild, myNewChild, parent);
  }
  else if (myOldChild != null) {
    childRemoved(e, myOldChild, parent);
  }
  else if (myNewChild != null) {
    childAdded(e, myNewChild, parent);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ChangeInfoImpl.java


示例7: forceReload

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
public void forceReload(@Nonnull VirtualFile vFile) {
  LanguageSubstitutors.cancelReparsing(vFile);
  FileViewProvider viewProvider = findCachedViewProvider(vFile);
  if (viewProvider == null) {
    return;
  }
  ApplicationManager.getApplication().assertWriteAccessAllowed();

  VirtualFile dir = vFile.getParent();
  PsiDirectory parentDir = dir == null ? null : getCachedDirectory(dir);
  PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(myManager);
  if (parentDir == null) {
    event.setPropertyName(PsiTreeChangeEvent.PROP_UNLOADED_PSI);

    myManager.beforePropertyChange(event);
    setViewProvider(vFile, null);
    myManager.propertyChanged(event);
  } else {
    event.setParent(parentDir);

    myManager.beforeChildrenChange(event);
    setViewProvider(vFile, null);
    myManager.childrenChanged(event);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:FileManagerImpl.java


示例8: processFileTypesChanged

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
void processFileTypesChanged() {
  if (myProcessingFileTypesChange) return;
  myProcessingFileTypesChange = true;
  DebugUtil.performPsiModification(null, () -> {
    try {
      ApplicationManager.getApplication().runWriteAction(() -> {
        PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(myManager);
        event.setPropertyName(PsiTreeChangeEvent.PROP_FILE_TYPES);
        myManager.beforePropertyChange(event);

        invalidateAllPsi();

        myManager.propertyChanged(event);
      });
    }
    finally {
      myProcessingFileTypesChange = false;
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:FileManagerImpl.java


示例9: fileCreated

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void fileCreated(@Nonnull VirtualFileEvent event) {
  final VirtualFile vFile = event.getFile();

  ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> {
    VirtualFile parent = vFile.getParent();
    PsiDirectory parentDir = getCachedDirectory(parent);
    if (parentDir == null) {
      // parent directory was never accessed via PSI
      handleVfsChangeWithoutPsi(vFile);
      return;
    }
    PsiFileSystemItem item = vFile.isDirectory() ? myFileManager.findDirectory(vFile) : myFileManager.findFile(vFile);
    if (item != null && item.getProject() == myManager.getProject()) {
      PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
      treeEvent.setParent(parentDir);
      myManager.beforeChildAddition(treeEvent);
      treeEvent.setChild(item);
      myManager.childAdded(treeEvent);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:PsiVFSListener.java


示例10: beforeFileDeletion

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void beforeFileDeletion(@Nonnull VirtualFileEvent event) {
  final VirtualFile vFile = event.getFile();

  VirtualFile parent = vFile.getParent();
  final PsiDirectory parentDir = getCachedDirectory(parent);
  if (parentDir == null) return; // do not notify listeners if parent directory was never accessed via PSI

  ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> {
    PsiFileSystemItem item = vFile.isDirectory() ? myFileManager.findDirectory(vFile) : myFileManager.getCachedPsiFile(vFile);
    if (item != null) {
      PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
      treeEvent.setParent(parentDir);
      treeEvent.setChild(item);
      myManager.beforeChildRemoval(treeEvent);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:PsiVFSListener.java


示例11: beforeRootsChange

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void beforeRootsChange(final ModuleRootEvent event) {
  if (event.isCausedByFileTypesChange()) return;
  ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> {
    depthCounter++;
    if (depthCounter > 1) return;

    PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
    treeEvent.setPropertyName(PsiTreeChangeEvent.PROP_ROOTS);
    final VirtualFile[] contentRoots = myProjectRootManager.getContentRoots();
    LOG.assertTrue(myOldContentRoots == null);
    myOldContentRoots = contentRoots;
    treeEvent.setOldValue(contentRoots);
    myManager.beforePropertyChange(treeEvent);
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:PsiVFSListener.java


示例12: eventText

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
private static String eventText(PsiTreeChangeEvent event, PsiTreeChangeEventImpl.PsiEventType code) {
  PsiElement parent = event.getParent();
  PsiElement oldChild = event.getOldChild();
  if (oldChild == null) oldChild = event.getChild();
  PsiElement newChild = event.getNewChild();
  return code + ":" +
         (parent == null ? null : parent.getNode().getElementType()) + "/" +
         (oldChild == null ? null : oldChild.getNode().getElementType()) + "->" +
         (newChild == null ? null : newChild.getNode().getElementType()) +
         ";";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiEventsTest.java


示例13: assertBeforeEventFired

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
private void assertBeforeEventFired(PsiTreeChangeEvent afterEvent) {
  PsiTreeChangeEventImpl.PsiEventType code = ((PsiTreeChangeEventImpl)afterEvent).getCode();
  assertFalse(code.name(), code.name().startsWith("BEFORE_"));
  PsiTreeChangeEventImpl.PsiEventType beforeCode = PsiTreeChangeEventImpl.PsiEventType.values()[code.ordinal() - 1];
  assertTrue(beforeCode.name(), beforeCode.name().startsWith("BEFORE_"));
  String beforeText = eventText(afterEvent, beforeCode);
  int i = eventsFired.indexOf(beforeText);
  assertTrue("Event '" + beforeText + "' must be fired. Events so far: " + eventsFired, i >= 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiEventsTest.java


示例14: sendBeforeChildrenChangeEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
public static void sendBeforeChildrenChangeEvent(@NotNull PsiManagerImpl manager, @NotNull PsiElement scope, boolean isGenericChange) {
  if (!scope.isPhysical()) {
    manager.beforeChange(false);
    return;
  }
  PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
  event.setParent(scope);
  event.setFile(scope.getContainingFile());
  TextRange range = scope.getTextRange();
  event.setOffset(range == null ? 0 : range.getStartOffset());
  event.setOldLength(scope.getTextLength());
  // the "generic" event is being sent on every PSI change. It does not carry any specific info except the fact that "something has changed"
  event.setGenericChange(isGenericChange);
  manager.beforeChildrenChange(event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:BlockSupportImpl.java


示例15: childrenChanged

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void childrenChanged(@NotNull PsiTreeChangeEvent event) {
  if (((PsiTreeChangeEventImpl)event).isGenericChange()) {
    return;
  }
  queueElement(event.getParent(), true, event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiChangeHandler.java


示例16: handleVfsChangeWithoutPsi

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
private void handleVfsChangeWithoutPsi(@NotNull VirtualFile vFile) {
  if (!myReportedUnloadedPsiChange && isInRootModel(vFile)) {
    PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(myManager);
    myFileManager.firePropertyChangedForUnloadedPsi(event, vFile);
    myReportedUnloadedPsiChange = true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiVFSListener.java


示例17: registerIndexableSet

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void registerIndexableSet(@NotNull IndexableFileSet set, @Nullable Project project) {
  myIndexableSets.add(set);
  myIndexableSetToProjectMap.put(set, project);
  if (project != null) {
    ((PsiManagerImpl)PsiManager.getInstance(project)).addTreeChangePreprocessor(new PsiTreeChangePreprocessor() {
      @Override
      public void treeChanged(@NotNull PsiTreeChangeEventImpl event) {
        if (event.isGenericChange() &&
            event.getCode() == PsiTreeChangeEventImpl.PsiEventType.CHILDREN_CHANGED) {
          PsiFile file = event.getFile();
          if (file != null) {
            VirtualFile virtualFile = file.getVirtualFile();
            if (!clearUpToDateStateForPsiIndicesOfUnsavedDocuments(virtualFile)) {
              // change in persistent file
              if (virtualFile instanceof VirtualFileWithId) {
                int fileId = ((VirtualFileWithId)virtualFile).getId();
                boolean wasIndexed = false;
                for (ID<?, ?> psiBackedIndex : myPsiDependentIndices) {
                  if (IndexingStamp.isFileIndexedStateCurrent(fileId, psiBackedIndex)) {
                    IndexingStamp.setFileIndexedStateOutdated(fileId, psiBackedIndex);
                    wasIndexed = true;
                  }
                }
                if (wasIndexed) {
                  myChangedFilesCollector.scheduleForUpdate(virtualFile);
                  IndexingStamp.flushCache(fileId);
                }
              }
            }
          }
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:FileBasedIndexImpl.java


示例18: sendBeforeChildrenChangeEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
public static void sendBeforeChildrenChangeEvent(@NotNull PsiManagerImpl manager, @NotNull PsiElement scope, boolean isGenericChange) {
  if(!scope.isPhysical()) {
    manager.beforeChange(false);
    return;
  }
  PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
  event.setParent(scope);
  event.setFile(scope.getContainingFile());
  event.setOffset(scope.getTextRange().getStartOffset());
  event.setOldLength(scope.getTextLength());
    // the "generic" event is being sent on every PSI change. It does not carry any specific info except the fact that "something has changed"
  event.setGeneric(isGenericChange);
  manager.beforeChildrenChange(event);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:BlockSupportImpl.java


示例19: childrenChanged

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Override
public void childrenChanged(@NotNull PsiTreeChangeEvent event) {
  if (((PsiTreeChangeEventImpl)event).isGenericChildrenChange()) {
    return;
  }
  queueElement(event.getParent(), true, event);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:PsiChangeHandler.java


示例20: createEvent

import com.intellij.psi.impl.PsiTreeChangeEventImpl; //导入依赖的package包/类
@Nonnull
static PsiTreeChangeEventImpl createEvent(PsiFile file, int offset) {
  PsiTreeChangeEventImpl e = new PsiTreeChangeEventImpl(file.getManager());
  e.setFile(file);
  e.setOffset(offset);
  return e;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:ChangeInfoImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChangeDescriptor类代码示例发布时间:2022-05-23
下一篇:
Java AStarPathFinder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap