void (VirtualFile f, String text) { Document document = FileDocumentManager.getInstance().getDocument(f); assertNotNull(f.getPath(), document); ApplicationManager.getApplication().runWriteAction(() -> document.setText(text)); }