@RequiresEdt
    private void replaceString(@NotNull Document document,
                               int startOffset,
                               int endOffset,
                               @NotNull CharSequence newText) {
      try {
        myDuringModification = true;
        document.replaceString(startOffset, endOffset, newText);
      }
      finally {
        myDuringModification = false;
      }
    }
@RequiresEdt
    private void replaceString(@NotNull Document document,
                               int startOffset,
                               int endOffset,
                               @NotNull CharSequence newText)