public static void findWordAtCaret(Project project, @NotNull Editor editor, @NotNull SearchResults.Direction direction) {
    String s = getWordAtCaret(editor, false);
    if (s == null) {
      return;
    }
    FindManager findManager = FindManager.getInstance(project);
    FindInProjectSettings findInProjectSettings = FindInProjectSettings.getInstance(project);
    findInProjectSettings.addStringToFind(s);
    findManager.getFindInFileModel().setStringToFind(s);
    findManager.setFindWasPerformed();
    findManager.clearFindingNextUsageInFile();
    FindModel model = new FindModel();
    model.setForward(direction == SearchResults.Direction.DOWN);
    model.setStringToFind(s);
    model.setCaseSensitive(true);
    model.setWholeWordsOnly(false);

    EditorSearchSession searchSession = EditorSearchSession.get(editor);
    if (searchSession != null) {
      searchSession.setTextInField(model.getStringToFind());
    }

    findManager.setFindNextModel(model);
    doSearch(project, editor, editor.getCaretModel().getOffset(), true, model, true);
  }
public static void findWordAtCaret(Project project, @NotNull Editor editor, @NotNull SearchResults.Direction direction)