Java 类com.intellij.psi.search.PsiTodoSearchHelper 实例源码

项目:intellij-ce-playground    文件:GeneralHighlightingPass.java   
static void highlightTodos(@NotNull PsiFile file,
                           @NotNull CharSequence text,
                           int startOffset,
                           int endOffset,
                           @NotNull ProgressIndicator progress,
                           @NotNull ProperTextRange priorityRange,
                           @NotNull Collection<HighlightInfo> insideResult,
                           @NotNull Collection<HighlightInfo> outsideResult) {
  PsiTodoSearchHelper helper = PsiTodoSearchHelper.SERVICE.getInstance(file.getProject());
  if (helper == null) return;
  TodoItem[] todoItems = helper.findTodoItems(file, startOffset, endOffset);
  if (todoItems.length == 0) return;

  for (TodoItem todoItem : todoItems) {
    progress.checkCanceled();
    TextRange range = todoItem.getTextRange();
    String description = text.subSequence(range.getStartOffset(), range.getEndOffset()).toString();
    TextAttributes attributes = todoItem.getPattern().getAttributes().getTextAttributes();
    HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(HighlightInfoType.TODO).range(range);
    builder.textAttributes(attributes);
    builder.descriptionAndTooltip(description);
    HighlightInfo info = builder.createUnconditionally();
    (priorityRange.containsRange(info.getStartOffset(), info.getEndOffset()) ? insideResult : outsideResult).add(info);
  }
}
项目:intellij-ce-playground    文件:TodoCommentInspection.java   
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
  final TodoItem[] todoItems = PsiTodoSearchHelper.SERVICE.getInstance(file.getProject()).findTodoItems(file);

  final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>();
  final THashSet<PsiComment> comments = new THashSet<PsiComment>();
  for (TodoItem todoItem : todoItems) {
    final PsiComment comment =
      PsiTreeUtil.getParentOfType(file.findElementAt(todoItem.getTextRange().getStartOffset()), PsiComment.class, false);
    if (comment != null && comments.add(comment)) {
      result.add(manager.createProblemDescriptor(comment, InspectionsBundle.message("todo.comment.problem.descriptor"), isOnTheFly,
                                                 null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
    }
  }
  return result.toArray(new ProblemDescriptor[result.size()]);
}
项目:intellij-ce-playground    文件:TodoFileNode.java   
public static TodoItem[] findAllTodos(final PsiFile psiFile, final PsiTodoSearchHelper helper) {
  final List<TodoItem> todoItems = new ArrayList<TodoItem>(Arrays.asList(helper.findTodoItems(psiFile)));

  psiFile.accept(new PsiRecursiveElementWalkingVisitor() {
    @Override
    public void visitElement(PsiElement element) {
      if (element instanceof PsiLanguageInjectionHost) {
        InjectedLanguageUtil.enumerate(element, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
          @Override
          public void visit(@NotNull PsiFile injectedPsi, @NotNull List<PsiLanguageInjectionHost.Shred> places) {
            if (places.size() == 1) {
              Document document = PsiDocumentManager.getInstance(injectedPsi.getProject()).getCachedDocument(injectedPsi);
              if (!(document instanceof DocumentWindow)) return;
              for (TodoItem item : helper.findTodoItems(injectedPsi)) {
                TextRange rangeInHost = ((DocumentWindow)document).injectedToHost(item.getTextRange());
                todoItems.add(new TodoItemImpl(psiFile, rangeInHost.getStartOffset(), rangeInHost.getEndOffset(), item.getPattern()));
              }
            }
          }
        });
      }
      super.visitElement(element);
    }
  });
  return todoItems.toArray(new TodoItem[todoItems.size()]);
}
项目:intellij-ce-playground    文件:TodoTreeBuilder.java   
TodoTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
  super(tree, treeModel, null, MyComparator.ourInstance, false);
  myProject = project;

  myFileTree = new FileTree();
  myDirtyFileSet = new HashSet<VirtualFile>();

  myFile2Highlighter = new HashMap<VirtualFile, EditorHighlighter>();

  PsiManager psiManager = PsiManager.getInstance(myProject);
  mySearchHelper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);
  psiManager.addPsiTreeChangeListener(new MyPsiTreeChangeListener());

  myFileStatusListener = new MyFileStatusListener();

  setCanYieldUpdate(true);
}
项目:tools-idea    文件:TodoFileNode.java   
public static TodoItem[] findAllTodos(final PsiFile psiFile, final PsiTodoSearchHelper helper) {
  final List<TodoItem> todoItems = new ArrayList<TodoItem>(Arrays.asList(helper.findTodoItems(psiFile)));

  psiFile.accept(new PsiRecursiveElementWalkingVisitor() {
    @Override
    public void visitElement(PsiElement element) {
      if (element instanceof PsiLanguageInjectionHost) {
        InjectedLanguageUtil.enumerate(element, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
          @Override
          public void visit(@NotNull PsiFile injectedPsi, @NotNull List<PsiLanguageInjectionHost.Shred> places) {
            if (places.size() == 1) {
              Document document = PsiDocumentManager.getInstance(injectedPsi.getProject()).getCachedDocument(injectedPsi);
              if (!(document instanceof DocumentWindow)) return;
              for (TodoItem item : helper.findTodoItems(injectedPsi)) {
                TextRange rangeInHost = ((DocumentWindow)document).injectedToHost(item.getTextRange());
                todoItems.add(new TodoItemImpl(psiFile, rangeInHost.getStartOffset(), rangeInHost.getEndOffset(), item.getPattern()));
              }
            }
          }
        });
      }
      super.visitElement(element);
    }
  });
  return todoItems.toArray(new TodoItem[todoItems.size()]);
}
项目:tools-idea    文件:TodoTreeBuilder.java   
TodoTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
  super(tree, treeModel, null, MyComparator.ourInstance, false);
  myProject = project;

  myFileTree = new FileTree();
  myDirtyFileSet = new HashSet<VirtualFile>();

  myFile2Highlighter = new HashMap<VirtualFile, EditorHighlighter>();

  PsiManager psiManager = PsiManager.getInstance(myProject);
  mySearchHelper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);
  psiManager.addPsiTreeChangeListener(new MyPsiTreeChangeListener());

  myFileStatusListener = new MyFileStatusListener();

  setCanYieldUpdate(true);
}
项目:consulo    文件:GeneralHighlightingPass.java   
static void highlightTodos(@Nonnull PsiFile file,
                           @Nonnull CharSequence text,
                           int startOffset,
                           int endOffset,
                           @Nonnull ProgressIndicator progress,
                           @Nonnull ProperTextRange priorityRange,
                           @Nonnull Collection<HighlightInfo> insideResult,
                           @Nonnull Collection<HighlightInfo> outsideResult) {
  PsiTodoSearchHelper helper = PsiTodoSearchHelper.getInstance(file.getProject());
  if (helper == null || !shouldHighlightTodos(helper, file)) return;
  TodoItem[] todoItems = helper.findTodoItems(file, startOffset, endOffset);
  if (todoItems.length == 0) return;

  for (TodoItem todoItem : todoItems) {
    ProgressManager.checkCanceled();
    TextRange range = todoItem.getTextRange();
    TextAttributes attributes = todoItem.getPattern().getAttributes().getTextAttributes();
    HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(HighlightInfoType.TODO).range(range);
    builder.textAttributes(attributes);
    String description = text.subSequence(range.getStartOffset(), range.getEndOffset()).toString();
    builder.description(description);
    builder.unescapedToolTip(StringUtil.shortenPathWithEllipsis(description, 1024));
    HighlightInfo info = builder.createUnconditionally();
    (priorityRange.containsRange(info.getStartOffset(), info.getEndOffset()) ? insideResult : outsideResult).add(info);
  }
}
项目:consulo    文件:TodoForExistingFile.java   
@Override
protected TodoItemData[] getTodoItems() {
  return ApplicationManager.getApplication().runReadAction(new Computable<TodoItemData[]>() {
    @Override
    public TodoItemData[] compute() {
      final PsiTodoSearchHelper helper = PsiTodoSearchHelper.getInstance(myProject);

      PsiFile psiFile = myFile == null ? null : PsiManager.getInstance(myProject).findFile(myFile);
      if (psiFile != null) {
        return TodoForBaseRevision.convertTodo(helper.findTodoItems(psiFile));
      }

      return TodoForBaseRevision.convertTodo(getTodoForText(helper));
    }
  });
}
项目:consulo    文件:TodoFileNode.java   
public static TodoItem[] findAllTodos(final PsiFile psiFile, final PsiTodoSearchHelper helper) {
  final List<TodoItem> todoItems = new ArrayList<TodoItem>(Arrays.asList(helper.findTodoItems(psiFile)));

  psiFile.accept(new PsiRecursiveElementWalkingVisitor() {
    @Override
    public void visitElement(PsiElement element) {
      if (element instanceof PsiLanguageInjectionHost) {
        InjectedLanguageUtil.enumerate(element, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
          @Override
          public void visit(@Nonnull PsiFile injectedPsi, @Nonnull List<PsiLanguageInjectionHost.Shred> places) {
            if (places.size() == 1) {
              Document document = PsiDocumentManager.getInstance(injectedPsi.getProject()).getCachedDocument(injectedPsi);
              if (!(document instanceof DocumentWindow)) return;
              for (TodoItem item : helper.findTodoItems(injectedPsi)) {
                TextRange rangeInHost = ((DocumentWindow)document).injectedToHost(item.getTextRange());
                todoItems.add(new TodoItemImpl(psiFile, rangeInHost.getStartOffset(), rangeInHost.getEndOffset(), item.getPattern()));
              }
            }
          }
        });
      }
      super.visitElement(element);
    }
  });
  return todoItems.toArray(new TodoItem[todoItems.size()]);
}
项目:consulo    文件:TodoTreeBuilder.java   
TodoTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
  super(tree, treeModel, null, MyComparator.ourInstance, false);
  myProject = project;

  myFileTree = new FileTree();
  myDirtyFileSet = new HashSet<>();

  myFile2Highlighter = new HashMap<>();

  PsiManager psiManager = PsiManager.getInstance(myProject);
  mySearchHelper = PsiTodoSearchHelper.getInstance(myProject);
  psiManager.addPsiTreeChangeListener(new MyPsiTreeChangeListener());

  myFileStatusListener = new MyFileStatusListener();

  setCanYieldUpdate(true);
}
项目:intellij-ce-playground    文件:TodoFilter.java   
/**
 * @return <code>true</code> if and only if specified <code>psiFile</code> has
 * <code>TodoItem</code>s accepted by the filter.
 */
public boolean accept(PsiTodoSearchHelper searchHelper,PsiFile psiFile){
  for(Iterator<TodoPattern> i=iterator();i.hasNext();){
    TodoPattern todoPattern= i.next();
    if(searchHelper.getTodoItemsCount(psiFile,todoPattern)>0){
      return true;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:TodoForExistingFile.java   
protected TodoItemData[] getTodoItems() {
  return ApplicationManager.getApplication().runReadAction(new Computable<TodoItemData[]>() {
    @Override
    public TodoItemData[] compute() {
      final PsiTodoSearchHelper helper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);

      PsiFile psiFile = myFile == null ? null : PsiManager.getInstance(myProject).findFile(myFile);
      if (psiFile != null) {
        return TodoForBaseRevision.convertTodo(helper.findTodoItems(psiFile));
      }

      return TodoForBaseRevision.convertTodo(getTodoForText(helper));
    }
  });
}
项目:intellij-ce-playground    文件:TodoForBaseRevision.java   
@Override
protected TodoItemData[] getTodoItems() {
  final TodoItemData[] items = (TodoItemData[])myGetter.get();
  if (items != null) return items;
  final TodoItem[] todoItems = getTodoForText(PsiTodoSearchHelper.SERVICE.getInstance(myProject));
  if (todoItems != null) {
    final TodoItemData[] arr = convertTodo(todoItems);
    mySaver.consume(arr);
    return arr;
  }
  return null;
}
项目:intellij-ce-playground    文件:TodoForRanges.java   
protected TodoItem[] getTodoForText(PsiTodoSearchHelper helper) {
  final PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
    @Override
    public PsiFile compute() {
      return PsiFileFactory.getInstance(myProject).createFileFromText((myOldRevision ? "old" : "") + myFileName, myFileType, myText);
    }
  });
  return helper.findTodoItemsLight(psiFile);
}
项目:intellij-ce-playground    文件:TodoCheckinHandlerWorker.java   
public TodoCheckinHandlerWorker(final Project project, final Collection<Change> changes, final TodoFilter todoFilter,
                                final boolean includePattern) {
  this.changes = changes;
  myTodoFilter = todoFilter;
  myIncludePattern = includePattern;
  myPsiManager = PsiManager.getInstance(project);
  mySearchHelper = PsiTodoSearchHelper.SERVICE.getInstance(project);
  myAddedOrEditedTodos = new ArrayList<TodoItem>();
  myInChangedTodos = new ArrayList<TodoItem>();
  mySkipped = new SmartList<Pair<FilePath,String>>();
  myEditedFileProcessor = new MyEditedFileProcessor(project, new Acceptor() {
    @Override
    public void skipped(Pair<FilePath, String> pair) {
      mySkipped.add(pair);
    }

    @Override
    public void addedOrEdited(TodoItem todoItem) {
      myAddedOrEditedTodos.add(todoItem);
    }

    @Override
    public void inChanged(TodoItem todoItem) {
      myInChangedTodos.add(todoItem);
    }
  }, myTodoFilter);
}
项目:tools-idea    文件:TodoForExistingFile.java   
protected TodoItemData[] getTodoItems() {
  return ApplicationManager.getApplication().runReadAction(new Computable<TodoItemData[]>() {
    @Override
    public TodoItemData[] compute() {
      final PsiTodoSearchHelper helper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);

      PsiFile psiFile = myFile == null ? null : PsiManager.getInstance(myProject).findFile(myFile);
      if (psiFile != null) {
        return TodoForBaseRevision.convertTodo(helper.findTodoItems(psiFile));
      }

      return TodoForBaseRevision.convertTodo(getTodoForText(helper));
    }
  });
}
项目:tools-idea    文件:TodoForBaseRevision.java   
@Override
protected TodoItemData[] getTodoItems() {
  final TodoItemData[] items = (TodoItemData[])myGetter.get();
  if (items != null) return items;
  final TodoItem[] todoItems = getTodoForText(PsiTodoSearchHelper.SERVICE.getInstance(myProject));
  if (todoItems != null) {
    final TodoItemData[] arr = convertTodo(todoItems);
    mySaver.consume(arr);
    return arr;
  }
  return null;
}
项目:tools-idea    文件:TodoForRanges.java   
protected TodoItem[] getTodoForText(PsiTodoSearchHelper helper) {
  final PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
    @Override
    public PsiFile compute() {
      return PsiFileFactory.getInstance(myProject).createFileFromText((myOldRevision ? "old" : "") + myFileName, myFileType, myText);
    }
  });
  return helper.findTodoItemsLight(psiFile);
}
项目:tools-idea    文件:GeneralHighlightingPass.java   
private static void highlightTodos(@NotNull PsiFile file,
                                   @NotNull CharSequence text,
                                   int startOffset,
                                   int endOffset,
                                   @NotNull ProgressIndicator progress,
                                   @NotNull ProperTextRange priorityRange,
                                   @NotNull Collection<HighlightInfo> result,
                                   @NotNull Collection<HighlightInfo> outsideResult) {
  PsiTodoSearchHelper helper = PsiTodoSearchHelper.SERVICE.getInstance(file.getProject());
  TodoItem[] todoItems = helper.findTodoItems(file, startOffset, endOffset);
  if (todoItems.length == 0) return;

  for (TodoItem todoItem : todoItems) {
    progress.checkCanceled();
    TextRange range = todoItem.getTextRange();
    String description = text.subSequence(range.getStartOffset(), range.getEndOffset()).toString();
    TextAttributes attributes = todoItem.getPattern().getAttributes().getTextAttributes();
    HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(HighlightInfoType.TODO).range(range);
    if (attributes != null) {
      builder.textAttributes(attributes);
    }
    builder.descriptionAndTooltip(description);
    HighlightInfo info = builder.createUnconditionally();
    if (priorityRange.containsRange(info.getStartOffset(), info.getEndOffset())) {
      result.add(info);
    }
    else {
      outsideResult.add(info);
    }
  }
}
项目:tools-idea    文件:TodoCheckinHandlerWorker.java   
public TodoCheckinHandlerWorker(final Project project, final Collection<Change> changes, final TodoFilter todoFilter,
                                final boolean includePattern) {
  this.changes = changes;
  myTodoFilter = todoFilter;
  myIncludePattern = includePattern;
  myPsiManager = PsiManager.getInstance(project);
  mySearchHelper = PsiTodoSearchHelper.SERVICE.getInstance(project);
  myAddedOrEditedTodos = new ArrayList<TodoItem>();
  myInChangedTodos = new ArrayList<TodoItem>();
  mySkipped = new SmartList<Pair<FilePath,String>>();
  myEditedFileProcessor = new MyEditedFileProcessor(project, new Acceptor() {
    @Override
    public void skipped(Pair<FilePath, String> pair) {
      mySkipped.add(pair);
    }

    @Override
    public void addedOrEdited(TodoItem todoItem) {
      myAddedOrEditedTodos.add(todoItem);
    }

    @Override
    public void inChanged(TodoItem todoItem) {
      myInChangedTodos.add(todoItem);
    }
  }, myTodoFilter);
}
项目:tools-idea    文件:TodoFilter.java   
/**
 * @return <code>true</code> if and only if specified <code>psiFile</code> has
 * <code>TodoItem</code>s accepted by the filter.
 */
public boolean accept(PsiTodoSearchHelper searchHelper,PsiFile psiFile){
  for(Iterator<TodoPattern> i=iterator();i.hasNext();){
    TodoPattern todoPattern= i.next();
    if(searchHelper.getTodoItemsCount(psiFile,todoPattern)>0){
      return true;
    }
  }
  return false;
}
项目:tools-idea    文件:TodoUtil.java   
public static boolean isTodoComment(PsiComment comment) {
  final PsiFile file = comment.getContainingFile();
  final PsiTodoSearchHelper searchHelper = PsiTodoSearchHelper.SERVICE.getInstance(comment.getProject());
  final TodoItem[] todoItems = searchHelper.findTodoItems(file);
  for (final TodoItem todoItem : todoItems) {
    final TextRange commentTextRange = comment.getTextRange();
    final TextRange todoTextRange = todoItem.getTextRange();
    if (commentTextRange.contains(todoTextRange)) {
      return true;
    }
  }
  return false;
}
项目:consulo    文件:GeneralHighlightingPass.java   
private static boolean shouldHighlightTodos(PsiTodoSearchHelper helper, PsiFile file) {
  if (helper instanceof PsiTodoSearchHelperImpl) {
    PsiTodoSearchHelperImpl helperImpl = (PsiTodoSearchHelperImpl) helper;
    return helperImpl.shouldHighlightInEditor(file);
  } else {
    return false;
  }
}
项目:consulo    文件:TodoFilter.java   
/**
 * @return <code>true</code> if and only if specified <code>psiFile</code> has
 * <code>TodoItem</code>s accepted by the filter.
 */
public boolean accept(PsiTodoSearchHelper searchHelper,PsiFile psiFile){
  for(Iterator<TodoPattern> i=iterator();i.hasNext();){
    TodoPattern todoPattern= i.next();
    if(searchHelper.getTodoItemsCount(psiFile,todoPattern)>0){
      return true;
    }
  }
  return false;
}
项目:consulo    文件:TodoForBaseRevision.java   
@Override
protected TodoItemData[] getTodoItems() {
  final TodoItemData[] items = (TodoItemData[])myGetter.get();
  if (items != null) return items;
  final TodoItem[] todoItems = getTodoForText(PsiTodoSearchHelper.getInstance(myProject));
  if (todoItems != null) {
    final TodoItemData[] arr = convertTodo(todoItems);
    mySaver.consume(arr);
    return arr;
  }
  return null;
}
项目:consulo    文件:TodoForRanges.java   
protected TodoItem[] getTodoForText(PsiTodoSearchHelper helper) {
  final PsiFile psiFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
    @Override
    public PsiFile compute() {
      return PsiFileFactory.getInstance(myProject).createFileFromText((myOldRevision ? "old" : "") + myFileName, myFileType, myText);
    }
  });
  return helper.findTodoItemsLight(psiFile);
}
项目:consulo    文件:TodoCheckinHandlerWorker.java   
public TodoCheckinHandlerWorker(final Project project, final Collection<Change> changes, final TodoFilter todoFilter,
                                final boolean includePattern) {
  this.changes = changes;
  myTodoFilter = todoFilter;
  myIncludePattern = includePattern;
  myPsiManager = PsiManager.getInstance(project);
  mySearchHelper = PsiTodoSearchHelper.getInstance(project);
  myAddedOrEditedTodos = new ArrayList<TodoItem>();
  myInChangedTodos = new ArrayList<TodoItem>();
  mySkipped = new SmartList<Pair<FilePath,String>>();
  myEditedFileProcessor = new MyEditedFileProcessor(project, new Acceptor() {
    @Override
    public void skipped(Pair<FilePath, String> pair) {
      mySkipped.add(pair);
    }

    @Override
    public void addedOrEdited(TodoItem todoItem) {
      myAddedOrEditedTodos.add(todoItem);
    }

    @Override
    public void inChanged(TodoItem todoItem) {
      myInChangedTodos.add(todoItem);
    }
  }, myTodoFilter);
}
项目:consulo    文件:TodoTreeStructure.java   
@RequiredReadAction
public TodoTreeStructure(Project project) {
  super(project);
  myArePackagesShown = PsiPackageSupportProviders.isPackageSupported(project);
  mySummaryElement = new ToDoSummary();
  mySearchHelper = PsiTodoSearchHelper.getInstance(project);
}
项目:consulo-java    文件:TodoUtil.java   
public static boolean isTodoComment(PsiComment comment) {
  final PsiFile file = comment.getContainingFile();
  final PsiTodoSearchHelper searchHelper = PsiTodoSearchHelper.getInstance(comment.getProject());
  final TodoItem[] todoItems = searchHelper.findTodoItems(file);
  for (final TodoItem todoItem : todoItems) {
    final TextRange commentTextRange = comment.getTextRange();
    final TextRange todoTextRange = todoItem.getTextRange();
    if (commentTextRange.contains(todoTextRange)) {
      return true;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:CustomChangelistTodoTreeStructure.java   
public CustomChangelistTodoTreeStructure(Project project, PsiTodoSearchHelper searchHelper) {
  super(project);
  mySearchHelper = searchHelper;
}
项目:intellij-ce-playground    文件:CustomChangelistTodoTreeStructure.java   
@Override
public PsiTodoSearchHelper getSearchHelper() {
  return mySearchHelper;
}
项目:intellij-ce-playground    文件:TodoTreeStructure.java   
public TodoTreeStructure(Project project){
  super(project);
  myArePackagesShown=true;
  mySummaryElement=new ToDoSummary();
  mySearchHelper= PsiTodoSearchHelper.SERVICE.getInstance(project);
}
项目:intellij-ce-playground    文件:TodoTreeStructure.java   
public PsiTodoSearchHelper getSearchHelper() {
  return mySearchHelper;
}
项目:tools-idea    文件:CustomChangelistTodoTreeStructure.java   
public CustomChangelistTodoTreeStructure(Project project, PsiTodoSearchHelper searchHelper) {
  super(project);
  mySearchHelper = searchHelper;
}
项目:tools-idea    文件:CustomChangelistTodoTreeStructure.java   
@Override
public PsiTodoSearchHelper getSearchHelper() {
  return mySearchHelper;
}
项目:tools-idea    文件:TodoTreeStructure.java   
public TodoTreeStructure(Project project){
  super(project);
  myArePackagesShown=true;
  mySummaryElement=new ToDoSummary();
  mySearchHelper= PsiTodoSearchHelper.SERVICE.getInstance(project);
}
项目:tools-idea    文件:TodoTreeStructure.java   
public PsiTodoSearchHelper getSearchHelper() {
  return mySearchHelper;
}
项目:pomodoro-todo-comments    文件:PomodoroCommentVSFListener.java   
public void projectOpened() {
    TimerEventsSourceAppComponent timerEventsSource = ApplicationManager.getApplication().getComponent(TimerEventsSourceAppComponent.class);
    listener = new TimerEventsSourceAppComponent.Listener() {
        @Override
        public void onTimerEvent() {
            if (!status.equals(PomodoroStatus.IDLE)) {
                remainingSeconds--;
                if (remainingSeconds <= 0) {
                    switch (status) {
                        case RESTING:
                            remainingSeconds = POMODORO_LENGTH;
                            status = PomodoroStatus.IDLE;
                            //TODO show message
                            break;
                        case RUNNING:
                            remainingSeconds = REST_LENGTH;
                            status = PomodoroStatus.RESTING;
                            //TODO increase todo pomodoro # in comment, and remove *
                            break;
                    }
                }
                System.out.println(status + " " + formatTime(remainingSeconds));
            }
        }
    };
    timerEventsSource.addListener(listener);


    VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() {
        @Override
        public void contentsChanged(VirtualFileEvent event) {
            PsiTodoSearchHelper todoHelper = PsiTodoSearchHelper.SERVICE.getInstance(myProject);
            PsiFile psiFile = PsiManager.getInstance(myProject).findFile(event.getFile());

            TodoItem[] todoItems = getTodoItems(todoHelper, psiFile);
            String activePomodoroText = extractTodoTextOnly(getTodoItemText(activeTodoItem));
            for (TodoItem todoItem : todoItems) {
                String todoText = getTodoItemText(todoItem);
                String pomodoroText = extractTodoTextOnly(todoText);
                if (matchActivePattern(todoText)) {
                    if (!pomodoroText.equals(activePomodoroText)) {
                        setActivePomodoro(todoItem, myProject);
                    }
                    break;
                } else {
                    if (matchInactivePattern(todoText) && pomodoroText.equals(activePomodoroText)) {
                        setInactivePomodoro(todoText, myProject);
                    }
                }

            }
        }
    }, myProject);
}
项目:pomodoro-todo-comments    文件:PomodoroCommentVSFListener.java   
private TodoItem[] getTodoItems(PsiTodoSearchHelper todoHelper, PsiFile psiFile) {
    return todoHelper.findTodoItems(psiFile);
}
项目:consulo    文件:CustomChangelistTodoTreeStructure.java   
public CustomChangelistTodoTreeStructure(Project project, PsiTodoSearchHelper searchHelper) {
  super(project);
  mySearchHelper = searchHelper;
}