@Override
  public String getStringToReplace(@NotNull Editor editor, @Nullable FindResult findResult) throws FindManager.MalformedReplacementStringException {
    if (findResult == null) {
      return null;
    }
    String foundString = editor.getDocument().getText(findResult);
    CharSequence documentText = editor.getDocument().getImmutableCharSequence();
    FindModel currentModel = mySearchResults.getFindModel();

    if (currentModel != null && currentModel.isReplaceState()) {
      FindManager findManager = FindManager.getInstance(mySearchResults.getProject());
      return findManager.getStringToReplace(foundString, currentModel, findResult.getStartOffset(), documentText);
    }
    return null;
  }
@Override
  public String getStringToReplace(@NotNull Editor editor, @Nullable FindResult findResult)