Search in sources :

Example 1 with IndexPatternOccurrence

use of com.intellij.psi.search.IndexPatternOccurrence in project intellij-community by JetBrains.

the class PsiTodoSearchHelperImpl method processTodoOccurences.

@NotNull
private static TodoItem[] processTodoOccurences(int startOffset, int endOffset, Collection<IndexPatternOccurrence> occurrences) {
    List<TodoItem> items = new ArrayList<>(occurrences.size());
    TextRange textRange = new TextRange(startOffset, endOffset);
    final TodoItemsCreator todoItemsCreator = new TodoItemsCreator();
    for (IndexPatternOccurrence occurrence : occurrences) {
        TextRange occurrenceRange = occurrence.getTextRange();
        if (textRange.contains(occurrenceRange)) {
            items.add(todoItemsCreator.createTodo(occurrence));
        }
    }
    return items.toArray(new TodoItem[items.size()]);
}
Also used : TodoItem(com.intellij.psi.search.TodoItem) ArrayList(java.util.ArrayList) TextRange(com.intellij.openapi.util.TextRange) IndexPatternOccurrence(com.intellij.psi.search.IndexPatternOccurrence) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TextRange (com.intellij.openapi.util.TextRange)1 IndexPatternOccurrence (com.intellij.psi.search.IndexPatternOccurrence)1 TodoItem (com.intellij.psi.search.TodoItem)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1