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

项目:intellij-ce-playground    文件:IndexPatternSearcher.java   
@Override
public boolean execute(@NotNull final IndexPatternSearch.SearchParameters queryParameters,
                       @NotNull final Processor<IndexPatternOccurrence> consumer) {
  final PsiFile file = queryParameters.getFile();
  VirtualFile virtualFile = file.getVirtualFile();
  if (file instanceof PsiBinaryFile || file instanceof PsiCompiledElement || virtualFile == null) {
    return true;
  }

  final TodoCacheManager cacheManager = TodoCacheManager.SERVICE.getInstance(file.getProject());
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  int count = patternProvider != null
              ? cacheManager.getTodoCount(virtualFile, patternProvider)
              : cacheManager.getTodoCount(virtualFile, queryParameters.getPattern());
  return count == 0 || executeImpl(queryParameters, consumer);
}
项目:tools-idea    文件:IndexPatternSearcher.java   
@Override
public boolean execute(@NotNull final IndexPatternSearch.SearchParameters queryParameters,
                       @NotNull final Processor<IndexPatternOccurrence> consumer) {
  final PsiFile file = queryParameters.getFile();
  VirtualFile virtualFile = file.getVirtualFile();
  if (file instanceof PsiBinaryFile || file instanceof PsiCompiledElement || virtualFile == null) {
    return true;
  }

  final TodoCacheManager cacheManager = TodoCacheManager.SERVICE.getInstance(file.getProject());
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  int count = patternProvider != null
              ? cacheManager.getTodoCount(virtualFile, patternProvider)
              : cacheManager.getTodoCount(virtualFile, queryParameters.getPattern());
  return count == 0 || executeImpl(queryParameters, consumer);
}
项目:consulo    文件:IndexPatternSearcher.java   
@Override
public boolean execute(@Nonnull final IndexPatternSearch.SearchParameters queryParameters,
                       @Nonnull final Processor<IndexPatternOccurrence> consumer) {
  final PsiFile file = queryParameters.getFile();
  VirtualFile virtualFile = file.getVirtualFile();
  if (file instanceof PsiBinaryFile || file instanceof PsiCompiledElement || virtualFile == null) {
    return true;
  }

  final TodoCacheManager cacheManager = TodoCacheManager.getInstance(file.getProject());
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  int count = patternProvider != null
              ? cacheManager.getTodoCount(virtualFile, patternProvider)
              : cacheManager.getTodoCount(virtualFile, queryParameters.getPattern());
  return count == 0 || executeImpl(queryParameters, consumer);
}
项目:intellij-ce-playground    文件:IndexPatternSearcher.java   
protected static boolean executeImpl(IndexPatternSearch.SearchParameters queryParameters,
                                     Processor<IndexPatternOccurrence> consumer) {
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  final PsiFile file = queryParameters.getFile();
  TIntArrayList commentStarts = new TIntArrayList();
  TIntArrayList commentEnds = new TIntArrayList();

  final CharSequence chars = file.getViewProvider().getContents();
  findCommentTokenRanges(file, chars, queryParameters.getRange(), commentStarts, commentEnds);
  TIntArrayList occurrences = new TIntArrayList(1);
  IndexPattern[] patterns = patternProvider != null ? patternProvider.getIndexPatterns() : null;

  for (int i = 0; i < commentStarts.size(); i++) {
    int commentStart = commentStarts.get(i);
    int commentEnd = commentEnds.get(i);
    occurrences.resetQuick();

    if (patternProvider != null) {
      for (int j = patterns.length - 1; j >=0; --j) {
        if (!collectPatternMatches(patterns[j], chars, commentStart, commentEnd, file, queryParameters.getRange(), consumer, occurrences)) {
          return false;
        }
      }
    }
    else {
      if (!collectPatternMatches(queryParameters.getPattern(), chars, commentStart, commentEnd, file, queryParameters.getRange(),
                                 consumer, occurrences)) {
        return false;
      }
    }
  }

  return true;
}
项目:intellij-ce-playground    文件:IndexPatternSearcher.java   
private static boolean collectPatternMatches(IndexPattern indexPattern,
                                             CharSequence chars,
                                             int commentStart,
                                             int commentEnd,
                                             PsiFile file,
                                             TextRange range,
                                             Processor<IndexPatternOccurrence> consumer,
                                             TIntArrayList matches
                                             ) {
  Pattern pattern = indexPattern.getPattern();
  if (pattern != null) {
    ProgressManager.checkCanceled();

    CharSequence input = new CharSequenceSubSequence(chars, commentStart, commentEnd);
    Matcher matcher = pattern.matcher(input);
    while (true) {
      //long time1 = System.currentTimeMillis();
      boolean found = matcher.find();
      //long time2 = System.currentTimeMillis();
      //System.out.println("scanned text of length " + (lexer.getTokenEnd() - lexer.getTokenStart() + " in " + (time2 - time1) + " ms"));

      if (!found) break;
      int start = matcher.start() + commentStart;
      int end = matcher.end() + commentStart;
      if (start != end) {
        if ((range == null || range.getStartOffset() <= start && end <= range.getEndOffset()) && matches.indexOf(start) == -1) {
          matches.add(start);
          if (!consumer.process(new IndexPatternOccurrenceImpl(file, start, end, indexPattern))) {
            return false;
          }
        }
      }

      ProgressManager.checkCanceled();
    }
  }
  return true;
}
项目:intellij-ce-playground    文件:PsiTodoSearchHelperImpl.java   
@Override
@NotNull
public TodoItem[] findTodoItems(@NotNull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences = IndexPatternSearch.search(file, TodoIndexPatternProvider.getInstance()).findAll();
  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:intellij-ce-playground    文件:PsiTodoSearchHelperImpl.java   
@NotNull
private static TodoItem[] processTodoOccurences(int startOffset, int endOffset, Collection<IndexPatternOccurrence> occurrences) {
  List<TodoItem> items = new ArrayList<TodoItem>(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()]);
}
项目:intellij-ce-playground    文件:PsiTodoSearchHelperImpl.java   
@NotNull
@Override
public TodoItem[] findTodoItemsLight(@NotNull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences =
    LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(file, TodoIndexPatternProvider.getInstance())).findAll();

  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:tools-idea    文件:IndexPatternSearcher.java   
protected static boolean executeImpl(IndexPatternSearch.SearchParameters queryParameters,
                                     Processor<IndexPatternOccurrence> consumer) {
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  final PsiFile file = queryParameters.getFile();
  TIntArrayList commentStarts = new TIntArrayList();
  TIntArrayList commentEnds = new TIntArrayList();

  final CharSequence chars = file.getViewProvider().getContents();
  findCommentTokenRanges(file, chars, queryParameters.getRange(), commentStarts, commentEnds);

  for (int i = 0; i < commentStarts.size(); i++) {
    int commentStart = commentStarts.get(i);
    int commentEnd = commentEnds.get(i);

    if (patternProvider != null) {
      for (final IndexPattern pattern : patternProvider.getIndexPatterns()) {
        if (!collectPatternMatches(pattern, chars, commentStart, commentEnd, file, queryParameters.getRange(), consumer)) {
          return false;
        }
      }
    }
    else {
      if (!collectPatternMatches(queryParameters.getPattern(), chars, commentStart, commentEnd, file, queryParameters.getRange(),
                                 consumer)) {
        return false;
      }
    }
  }

  return true;
}
项目:tools-idea    文件:IndexPatternSearcher.java   
private static boolean collectPatternMatches(IndexPattern indexPattern,
                                             CharSequence chars,
                                             int commentStart,
                                             int commentEnd,
                                             PsiFile file,
                                             TextRange range,
                                             Processor<IndexPatternOccurrence> consumer) {
  Pattern pattern = indexPattern.getPattern();
  if (pattern != null) {
    ProgressManager.checkCanceled();

    CharSequence input = new CharSequenceSubSequence(chars, commentStart, commentEnd);
    Matcher matcher = pattern.matcher(input);
    while (true) {
      //long time1 = System.currentTimeMillis();
      boolean found = matcher.find();
      //long time2 = System.currentTimeMillis();
      //System.out.println("scanned text of length " + (lexer.getTokenEnd() - lexer.getTokenStart() + " in " + (time2 - time1) + " ms"));

      if (!found) break;
      int start = matcher.start() + commentStart;
      int end = matcher.end() + commentStart;
      if (start != end) {
        if (range == null || range.getStartOffset() <= start && end <= range.getEndOffset()) {
          if (!consumer.process(new IndexPatternOccurrenceImpl(file, start, end, indexPattern))) {
            return false;
          }
        }
      }

      ProgressManager.checkCanceled();
    }
  }
  return true;
}
项目:tools-idea    文件:PsiTodoSearchHelperImpl.java   
@Override
@NotNull
public TodoItem[] findTodoItems(@NotNull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences = IndexPatternSearch.search(file, TodoIndexPatternProvider.getInstance()).findAll();
  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:tools-idea    文件:PsiTodoSearchHelperImpl.java   
private TodoItem[] processTodoOccurences(int startOffset, int endOffset, Collection<IndexPatternOccurrence> occurrences) {
  List<TodoItem> items = new ArrayList<TodoItem>(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()]);
}
项目:tools-idea    文件:PsiTodoSearchHelperImpl.java   
@NotNull
@Override
public TodoItem[] findTodoItemsLight(@NotNull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences =
    LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(file, TodoIndexPatternProvider.getInstance())).findAll();

  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:consulo    文件:IndexPatternSearcher.java   
protected static boolean executeImpl(IndexPatternSearch.SearchParameters queryParameters,
                                     Processor<IndexPatternOccurrence> consumer) {
  final IndexPatternProvider patternProvider = queryParameters.getPatternProvider();
  final PsiFile file = queryParameters.getFile();
  TIntArrayList commentStarts = new TIntArrayList();
  TIntArrayList commentEnds = new TIntArrayList();

  final CharSequence chars = file.getViewProvider().getContents();
  findCommentTokenRanges(file, chars, queryParameters.getRange(), commentStarts, commentEnds);

  for (int i = 0; i < commentStarts.size(); i++) {
    int commentStart = commentStarts.get(i);
    int commentEnd = commentEnds.get(i);

    if (patternProvider != null) {
      for (final IndexPattern pattern : patternProvider.getIndexPatterns()) {
        if (!collectPatternMatches(pattern, chars, commentStart, commentEnd, file, queryParameters.getRange(), consumer)) {
          return false;
        }
      }
    }
    else {
      if (!collectPatternMatches(queryParameters.getPattern(), chars, commentStart, commentEnd, file, queryParameters.getRange(),
                                 consumer)) {
        return false;
      }
    }
  }

  return true;
}
项目:consulo    文件:IndexPatternSearcher.java   
private static boolean collectPatternMatches(IndexPattern indexPattern,
                                             CharSequence chars,
                                             int commentStart,
                                             int commentEnd,
                                             PsiFile file,
                                             TextRange range,
                                             Processor<IndexPatternOccurrence> consumer) {
  Pattern pattern = indexPattern.getPattern();
  if (pattern != null) {
    ProgressManager.checkCanceled();

    CharSequence input = new CharSequenceSubSequence(chars, commentStart, commentEnd);
    Matcher matcher = pattern.matcher(input);
    while (true) {
      //long time1 = System.currentTimeMillis();
      boolean found = matcher.find();
      //long time2 = System.currentTimeMillis();
      //System.out.println("scanned text of length " + (lexer.getTokenEnd() - lexer.getTokenStart() + " in " + (time2 - time1) + " ms"));

      if (!found) break;
      int start = matcher.start() + commentStart;
      int end = matcher.end() + commentStart;
      if (start != end) {
        if (range == null || range.getStartOffset() <= start && end <= range.getEndOffset()) {
          if (!consumer.process(new IndexPatternOccurrenceImpl(file, start, end, indexPattern))) {
            return false;
          }
        }
      }

      ProgressManager.checkCanceled();
    }
  }
  return true;
}
项目:consulo    文件:PsiTodoSearchHelperImpl.java   
@Override
@Nonnull
public TodoItem[] findTodoItems(@Nonnull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences = IndexPatternSearch.search(file, TodoIndexPatternProvider.getInstance()).findAll();
  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:consulo    文件:PsiTodoSearchHelperImpl.java   
@Nonnull
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()]);
}
项目:consulo    文件:PsiTodoSearchHelperImpl.java   
@Nonnull
@Override
public TodoItem[] findTodoItemsLight(@Nonnull PsiFile file, int startOffset, int endOffset) {
  final Collection<IndexPatternOccurrence> occurrences =
          LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(file, TodoIndexPatternProvider.getInstance())).findAll();

  if (occurrences.isEmpty()) {
    return EMPTY_TODO_ITEMS;
  }

  return processTodoOccurences(startOffset, endOffset, occurrences);
}
项目:intellij-ce-playground    文件:LightIndexPatternSearcher.java   
@Override
public boolean execute(@NotNull IndexPatternSearch.SearchParameters queryParameters,
                       @NotNull Processor<IndexPatternOccurrence> consumer) {
  return executeImpl(queryParameters, consumer);
}
项目:intellij-ce-playground    文件:TodoItemsCreator.java   
public TodoItem createTodo(IndexPatternOccurrence occurrence) {
  final TextRange occurrenceRange = occurrence.getTextRange();
  return new TodoItemImpl(occurrence.getFile(), occurrenceRange.getStartOffset(), occurrenceRange.getEndOffset(),
                               mapPattern(occurrence.getPattern()));
}
项目:intellij-ce-playground    文件:TodoCheckinHandlerWorker.java   
private void checkEditedFragment(TodoItem newTodoItem) {
  if (myBeforeFile == null) {
    myBeforeFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
      @Override
      public PsiFile compute() {
        return myPsiFileFactory.createFileFromText("old" + myAfterFile.getName(), myAfterFile.getFileType(), myBeforeContent);
      }
    });
  }
  if (myOldItems == null)  {
    final Collection<IndexPatternOccurrence> all =
      LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(myBeforeFile, TodoIndexPatternProvider
        .getInstance())).findAll();

    final TodoItemsCreator todoItemsCreator = new TodoItemsCreator();
    myOldItems = new ArrayList<TodoItem>();
    if (all.isEmpty()) {
      myAcceptor.addedOrEdited(newTodoItem);
      return;
    }
    for (IndexPatternOccurrence occurrence : all) {
      myOldItems.add(todoItemsCreator.createTodo(occurrence));
    }
    applyFilterAndRemoveDuplicates(myOldItems, myTodoFilter);
  }
  if (myOldTodoTexts == null) {
    final StepIntersection<LineFragment, TodoItem> intersection = new StepIntersection<LineFragment, TodoItem>(
      LineFragmentConvertor.getInstance(), TodoItemConvertor.getInstance(), myOldItems, new Getter<String>() {
      @Override
      public String get() {
        return myBeforeContent;
      }
    });
    myOldTodoTexts = new HashSet<String>();
    intersection.process(Collections.singletonList(myCurrentLineFragment), new PairConsumer<LineFragment, TodoItem>() {
      @Override
      public void consume(LineFragment lineFragment, TodoItem todoItem) {
        myOldTodoTexts.add(getTodoText(todoItem, myBeforeContent));
      }
    });
  }
  final String text = getTodoText(newTodoItem, myAfterContent);
  if (! myOldTodoTexts.contains(text)) {
    myAcceptor.addedOrEdited(newTodoItem);
  } else {
    myAcceptor.inChanged(newTodoItem);
  }
}
项目:tools-idea    文件:TodoCheckinHandlerWorker.java   
private void checkEditedFragment(TodoItem newTodoItem) {
  if (myBeforeFile == null) {
    myBeforeFile = myPsiFileFactory.createFileFromText("old" + myAfterFile.getName(), myAfterFile.getFileType(), myBeforeContent);
  }
  if (myOldItems == null)  {
    final Collection<IndexPatternOccurrence> all =
      LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(myBeforeFile, TodoIndexPatternProvider
        .getInstance())).findAll();

    final TodoItemsCreator todoItemsCreator = new TodoItemsCreator();
    myOldItems = new ArrayList<TodoItem>();
    if (all.isEmpty()) {
      myAcceptor.addedOrEdited(newTodoItem);
      return;
    }
    for (IndexPatternOccurrence occurrence : all) {
      myOldItems.add(todoItemsCreator.createTodo(occurrence));
    }
    applyFilterAndRemoveDuplicates(myOldItems, myTodoFilter);
  }
  if (myOldTodoTexts == null) {
    final StepIntersection<LineFragment, TodoItem> intersection = new StepIntersection<LineFragment, TodoItem>(
      LineFragmentConvertor.getInstance(), TodoItemConvertor.getInstance(), myOldItems, new Getter<String>() {
      @Override
      public String get() {
        return myBeforeContent;
      }
    });
    myOldTodoTexts = new HashSet<String>();
    intersection.process(Collections.singletonList(myCurrentLineFragment), new PairConsumer<LineFragment, TodoItem>() {
      @Override
      public void consume(LineFragment lineFragment, TodoItem todoItem) {
        myOldTodoTexts.add(getTodoText(todoItem, myBeforeContent));
      }
    });
  }
  final String text = getTodoText(newTodoItem, myAfterContent);
  if (! myOldTodoTexts.contains(text)) {
    myAcceptor.addedOrEdited(newTodoItem);
  } else {
    myAcceptor.inChanged(newTodoItem);
  }
}
项目:tools-idea    文件:LightIndexPatternSearcher.java   
@Override
public boolean execute(@NotNull IndexPatternSearch.SearchParameters queryParameters,
                       @NotNull Processor<IndexPatternOccurrence> consumer) {
  return executeImpl(queryParameters, consumer);
}
项目:tools-idea    文件:TodoItemsCreator.java   
public TodoItem createTodo(IndexPatternOccurrence occurrence) {
  final TextRange occurrenceRange = occurrence.getTextRange();
  return new TodoItemImpl(occurrence.getFile(), occurrenceRange.getStartOffset(), occurrenceRange.getEndOffset(),
                               mapPattern(occurrence.getPattern()));
}
项目:consulo    文件:LightIndexPatternSearcher.java   
@Override
public boolean execute(@Nonnull IndexPatternSearch.SearchParameters queryParameters,
                       @Nonnull Processor<IndexPatternOccurrence> consumer) {
  return executeImpl(queryParameters, consumer);
}
项目:consulo    文件:TodoItemsCreator.java   
public TodoItem createTodo(IndexPatternOccurrence occurrence) {
  final TextRange occurrenceRange = occurrence.getTextRange();
  return new TodoItemImpl(occurrence.getFile(), occurrenceRange.getStartOffset(), occurrenceRange.getEndOffset(),
                               mapPattern(occurrence.getPattern()));
}
项目:consulo    文件:TodoCheckinHandlerWorker.java   
private void checkEditedFragment(TodoItem newTodoItem) {
  if (myBeforeFile == null) {
    myBeforeFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
      @Override
      public PsiFile compute() {
        return myPsiFileFactory.createFileFromText("old" + myAfterFile.getName(), myAfterFile.getFileType(), myBeforeContent);
      }
    });
  }
  if (myOldItems == null)  {
    final Collection<IndexPatternOccurrence> all =
            LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(myBeforeFile, TodoIndexPatternProvider
                    .getInstance())).findAll();

    final TodoItemsCreator todoItemsCreator = new TodoItemsCreator();
    myOldItems = new ArrayList<TodoItem>();
    if (all.isEmpty()) {
      myAcceptor.addedOrEdited(newTodoItem);
      return;
    }
    for (IndexPatternOccurrence occurrence : all) {
      myOldItems.add(todoItemsCreator.createTodo(occurrence));
    }
    applyFilterAndRemoveDuplicates(myOldItems, myTodoFilter);
  }
  if (myOldTodoTexts == null) {
    final StepIntersection<LineFragment, TodoItem> intersection = new StepIntersection<LineFragment, TodoItem>(
            LineFragmentConvertor.getInstance(), TodoItemConvertor.getInstance(), myOldItems, new Getter<String>() {
      @Override
      public String get() {
        return myBeforeContent;
      }
    });
    myOldTodoTexts = new HashSet<String>();
    intersection.process(Collections.singletonList(myCurrentLineFragment), new PairConsumer<LineFragment, TodoItem>() {
      @Override
      public void consume(LineFragment lineFragment, TodoItem todoItem) {
        myOldTodoTexts.add(getTodoText(todoItem, myBeforeContent));
      }
    });
  }
  final String text = getTodoText(newTodoItem, myAfterContent);
  if (! myOldTodoTexts.contains(text)) {
    myAcceptor.addedOrEdited(newTodoItem);
  } else {
    myAcceptor.inChanged(newTodoItem);
  }
}
项目:consulo-apache-velocity    文件:VtlActionsTest.java   
public void testTodo() throws Throwable
{
    configureByFile();
    final IndexPattern indexPattern = new IndexPattern("TODO", true);
    assertEquals(2, IndexPatternSearch.search(myFixture.getFile(), indexPattern).toArray(new IndexPatternOccurrence[0]).length);
}
项目:intellij-ce-playground    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified text range. The query is executed by parsing the contents of the file.
 *
 * @param file        the file in which occurrences should be searched.
 * @param pattern     the pattern to search for.
 * @param startOffset the start offset of the range to search.
 * @param endOffset   the end offset of the range to search.
 * @return the query instance.
 */
@NotNull
public static Query<IndexPatternOccurrence> search(@NotNull PsiFile file,
                                                   @NotNull IndexPattern pattern,
                                                   int startOffset,
                                                   int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, pattern, new TextRange(startOffset, endOffset));
  return Holder.INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:intellij-ce-playground    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified text range. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @param startOffset     the start offset of the range to search.
 * @param endOffset       the end offset of the range to search.
 * @return the query instance.
 */
@NotNull
public static Query<IndexPatternOccurrence> search(@NotNull PsiFile file, @NotNull IndexPatternProvider patternProvider,
                                                   int startOffset, int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider, new TextRange(startOffset, endOffset));
  return Holder.INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:tools-idea    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified text range. The query is executed by parsing the contents of the file.
 *
 * @param file        the file in which occurrences should be searched.
 * @param pattern     the pattern to search for.
 * @param startOffset the start offset of the range to search.
 * @param endOffset   the end offset of the range to search.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPattern pattern,
                                                   int startOffset, int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, pattern);
  parameters.setRange(new TextRange(startOffset, endOffset));
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:tools-idea    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified text range. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @param startOffset     the start offset of the range to search.
 * @param endOffset       the end offset of the range to search.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPatternProvider patternProvider,
                                                   int startOffset, int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider);
  parameters.setRange(new TextRange(startOffset, endOffset));
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:consulo    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified text range. The query is executed by parsing the contents of the file.
 *
 * @param file        the file in which occurrences should be searched.
 * @param pattern     the pattern to search for.
 * @param startOffset the start offset of the range to search.
 * @param endOffset   the end offset of the range to search.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPattern pattern,
                                                   int startOffset, int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, pattern);
  parameters.setRange(new TextRange(startOffset, endOffset));
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:consulo    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified text range. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @param startOffset     the start offset of the range to search.
 * @param endOffset       the end offset of the range to search.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPatternProvider patternProvider,
                                                   int startOffset, int endOffset) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider);
  parameters.setRange(new TextRange(startOffset, endOffset));
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:intellij-ce-playground    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified file. The query is executed by parsing the contents of the file.
 *
 * @param file    the file in which occurrences should be searched.
 * @param pattern the pattern to search for.
 * @return the query instance.
 */
@NotNull
public static Query<IndexPatternOccurrence> search(@NotNull PsiFile file, @NotNull IndexPattern pattern) {
  final SearchParameters parameters = new SearchParameters(file, pattern);
  return Holder.INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:intellij-ce-playground    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified file. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @return the query instance.
 */
@NotNull
public static Query<IndexPatternOccurrence> search(@NotNull PsiFile file, @NotNull IndexPatternProvider patternProvider) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider);
  return Holder.INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:tools-idea    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified file. The query is executed by parsing the contents of the file.
 *
 * @param file    the file in which occurrences should be searched.
 * @param pattern the pattern to search for.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPattern pattern) {
  final SearchParameters parameters = new SearchParameters(file, pattern);
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:tools-idea    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified file. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPatternProvider patternProvider) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider);
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:consulo    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of the specified pattern
 * in the specified file. The query is executed by parsing the contents of the file.
 *
 * @param file    the file in which occurrences should be searched.
 * @param pattern the pattern to search for.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPattern pattern) {
  final SearchParameters parameters = new SearchParameters(file, pattern);
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}
项目:consulo    文件:IndexPatternSearch.java   
/**
 * Returns a query which can be used to process occurrences of any pattern from the
 * specified provider in the specified file. The query is executed by parsing the
 * contents of the file.
 *
 * @param file            the file in which occurrences should be searched.
 * @param patternProvider the provider the patterns from which are searched.
 * @return the query instance.
 */
public static Query<IndexPatternOccurrence> search(PsiFile file, IndexPatternProvider patternProvider) {
  final SearchParameters parameters = new SearchParameters(file, patternProvider);
  return INDEX_PATTERN_SEARCH_INSTANCE.createQuery(parameters);
}