void (final String text) { ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { myDocument.replaceString(0, myDocument.getTextLength(), text); if (myEditorField != null && myEditorField.getEditor() != null) { myEditorField.getCaretModel().moveToOffset(myDocument.getTextLength()); } }, null, myDocument)); }