Java 类com.intellij.psi.impl.cache.impl.todo.TodoIndex 实例源码

项目:tools-idea    文件:IdCacheTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
  FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);

  String root = JavaTestUtil.getJavaTestDataPath()+ "/psi/impl/cache/";

  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  myRootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);

  myCacheFile = FileUtil.createTempFile("cache", "");
  myCacheFile.delete();
  myFilesToDelete.add(myCacheFile);
}
项目:consulo    文件:IndexTodoCacheManagerImpl.java   
@Override
@Nonnull
public PsiFile[] getFilesWithTodoItems() {
  if (myProject.isDefault()) {
    return PsiFile.EMPTY_ARRAY;
  }
  final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
  final Set<PsiFile> allFiles = new HashSet<>();
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
    final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
            TodoIndex.NAME,
            new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
    ApplicationManager.getApplication().runReadAction(() -> {
      for (VirtualFile file : files) {
        if (projectFileIndex.isInContent(file)) {
          final PsiFile psiFile = myPsiManager.findFile(file);
          if (psiFile != null) {
            allFiles.add(psiFile);
          }
        }
      }
    });
  }
  return allFiles.isEmpty() ? PsiFile.EMPTY_ARRAY : PsiUtilCore.toPsiFileArray(allFiles);
}
项目:consulo-java    文件:IdCacheTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
  FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);

  String root = JavaTestUtil.getJavaTestDataPath()+ "/psi/impl/cache/";

  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  myRootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);

  myCacheFile = FileUtil.createTempFile("cache", "");
  myCacheFile.delete();
  myFilesToDelete.add(myCacheFile);
}
项目:intellij-ce-playground    文件:IndexTodoCacheManagerImpl.java   
@Override
@NotNull
public PsiFile[] getFilesWithTodoItems() {
  if (myProject.isDefault()) {
    return PsiFile.EMPTY_ARRAY;
  }
  final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
  final Set<PsiFile> allFiles = new HashSet<PsiFile>();
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
    final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
      TodoIndex.NAME,
      new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      @Override
      public void run() {
        for (VirtualFile file : files) {
          if (projectFileIndex.isInContent(file)) {
            final PsiFile psiFile = myPsiManager.findFile(file);
            if (psiFile != null) {
              allFiles.add(psiFile);
            }
          }
        }
      }
    });
  }
  return allFiles.isEmpty() ? PsiFile.EMPTY_ARRAY : PsiUtilCore.toPsiFileArray(allFiles);
}
项目:tools-idea    文件:UpdateCacheTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
  FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);
}
项目:tools-idea    文件:IndexTodoCacheManagerImpl.java   
@Override
@NotNull
public PsiFile[] getFilesWithTodoItems() {
  if (myProject.isDefault()) {
    return PsiFile.EMPTY_ARRAY;
  }
  final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
  final Set<PsiFile> allFiles = new HashSet<PsiFile>();
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (IndexPattern indexPattern : IndexPatternUtil.getIndexPatterns()) {
    final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
      TodoIndex.NAME,
      new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      @Override
      public void run() {
        for (VirtualFile file : files) {
          if (projectFileIndex.isInContent(file)) {
            final PsiFile psiFile = myPsiManager.findFile(file);
            if (psiFile != null) {
              allFiles.add(psiFile);
            }
          }
        }
      }
    });
  }
  return allFiles.isEmpty() ? PsiFile.EMPTY_ARRAY : PsiUtilCore.toPsiFileArray(allFiles);
}
项目:consulo    文件:IndexTodoCacheManagerImpl.java   
private int fetchCount(@Nonnull FileBasedIndex fileBasedIndex, @Nonnull VirtualFile file, @Nonnull IndexPattern indexPattern) {
  final int[] count = {0};
  fileBasedIndex.processValues(
          TodoIndex.NAME, new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), file,
          (file1, value) -> {
            count[0] += value.intValue();
            return true;
          }, GlobalSearchScope.fileScope(myProject, file));
  return count[0];
}
项目:consulo-java    文件:UpdateCacheTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  FileBasedIndex.getInstance().requestRebuild(IdIndex.NAME);
  FileBasedIndex.getInstance().requestRebuild(TodoIndex.NAME);
}
项目:intellij-ce-playground    文件:CodeInsightTestFixtureImpl.java   
public static void ensureIndexesUpToDate(@NotNull Project project) {
  if (!DumbService.isDumb(project)) {
    FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
    FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
  }
}
项目:tools-idea    文件:CodeInsightTestFixtureImpl.java   
public static void ensureIndexesUpToDate(Project project) {
  if (!DumbService.isDumb(project)) {
    FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
    FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
  }
}
项目:consulo    文件:CodeInsightTestFixtureImpl.java   
public static void ensureIndexesUpToDate(Project project) {
  if (!DumbService.isDumb(project)) {
    FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
    FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
  }
}