private static boolean processElement(@NotNull PsiElement element,
                                        @NotNull Processor<? super TextRange> processor,
                                        @NotNull CharSequence text,
                                        int cursorOffset,
                                        @NotNull Editor editor) {
    ExtendWordSelectionHandler[] extendWordSelectionHandlers = ExtendWordSelectionHandler.EP_NAME.getExtensions();
    int minimalTextRangeLength = 0;
    List<ExtendWordSelectionHandler> availableSelectioners = new LinkedList<>();
    for (ExtendWordSelectionHandler selectioner : extendWordSelectionHandlers) {
      if (selectioner.canSelect(element)) {
        int selectionerMinimalTextRange = selectioner instanceof ExtendWordSelectionHandlerBase
          ? ((ExtendWordSelectionHandlerBase)selectioner).getMinimalTextRangeLength(element, text, cursorOffset)
          : 0;
        minimalTextRangeLength = Math.max(minimalTextRangeLength, selectionerMinimalTextRange);
        availableSelectioners.add(selectioner);
      }
    }
    boolean stop = false;
    for (ExtendWordSelectionHandler selectioner : availableSelectioners) {
      List<TextRange> ranges = askSelectioner(element, text, cursorOffset, editor, selectioner);
      if (ranges == null) continue;

      for (TextRange range : ranges) {
        if (range == null || range.getLength() < minimalTextRangeLength) continue;

        stop |= processor.process(range);
      }
    }

    return stop;
  }
private static boolean processElement(@NotNull PsiElement element,
                                        @NotNull Processor<? super TextRange> processor,
                                        @NotNull CharSequence text,
                                        int cursorOffset,
                                        @NotNull Editor editor)