public static void configureFindModel(boolean replace, FindModel model, boolean firstSearch, @Nullable String selectedText) {
    boolean multiline = selectedText != null && selectedText.contains("\n");
    String stringToFind = firstSearch || model.getStringToFind().contains("\n") ? "" : model.getStringToFind();
    boolean isSelectionUsed = false;
    if (!StringUtil.isEmpty(selectedText)) {
      if (!multiline || !replace) {
        stringToFind = selectedText;
        isSelectionUsed = true;
      } else {
        stringToFind = "";
      }
    }
    model.setReplaceState(replace);
    boolean isGlobal = !multiline || !replace;
    model.setStringToFind(isSelectionUsed
                          && model.isRegularExpressions()
                          && Registry.is("ide.find.escape.selected.text.for.regex")
                          ? StringUtil.escapeToRegexp(stringToFind)
                          : stringToFind);
    model.setMultiline(false);
    model.setGlobal(isGlobal);
    model.setPromptOnReplace(false);
  }
public static void configureFindModel(boolean replace, FindModel model, boolean firstSearch, @Nullable String selectedText)