void (final int startOffset, final int endOffset, final @NotNull CharSequence s) { final Document document = myTextComponent.getDocument(); try { document.remove(startOffset, endOffset-startOffset); document.insertString(startOffset, s.toString(), null); } catch (BadLocationException e) { throw new RuntimeException(e); } }