void (final String text) { final Document document = myRangeMarker.getDocument(); document.replaceString(myRangeMarker.getStartOffset(), myRangeMarker.getEndOffset(), text); PsiDocumentManager.getInstance(myFile.getProject()).commitDocument(document); }