@NotNull
  ActionCallback updateThreadSafe(@NotNull FindModel findModel, boolean toChangeSelection, @Nullable TextRange next, int stamp) {
    if (myDisposed) return ActionCallback.DONE;

    ActionCallback result = new ActionCallback();
    Editor editor = getEditor();

    updatePreviousFindModel(findModel);
    SearchArea searchArea = getSearchArea(editor, findModel);

    List<FindResult> results = new ArrayList<>();
    ApplicationManager.getApplication().runReadAction(() -> {
      Project project = getProject();
      if (myDisposed || project.isDisposed()) return;

      int[] starts = searchArea.startOffsets;
      int[] ends = searchArea.endOffsets;
      for (int i = 0; i < starts.length; ++i) {
        findInRange(new TextRange(starts[i], ends[i]), editor, findModel, results);
      }

      long documentTimeStamp = editor.getDocument().getModificationStamp();

      UIUtil.invokeLaterIfNeeded(() -> {
        if (editor.getDocument().getModificationStamp() == documentTimeStamp) {
          searchCompleted(results, editor, findModel, toChangeSelection, next, stamp);
          result.setDone();
        }
        else {
          result.setRejected();
        }
      });
    });
    return result;
  }
@NotNull
  ActionCallback updateThreadSafe(@NotNull FindModel findModel, boolean toChangeSelection, @Nullable TextRange next, int stamp)