void (final String text) { if (myPreview == null) return; //already disposed ApplicationManager.getApplication().runWriteAction(() -> myPreview.getDocument().replaceString(0, myPreview.getDocument().getTextLength(), text)); }