void (final String content) { ApplicationManager.getApplication().invokeLater(() -> { if (mySceneBuilder != null) { if (!myDocument.isWritable() && ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(Collections.singletonList(myFile)).hasReadonlyFiles()) { return; } try { myChangeListener.setRunState(false); // XXX: strange behavior with undo/redo ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance() .executeCommand(myProject, () -> myDocument.setText(content), JavaFXBundle.message("javafx.scene.builder.editor.scene.builder.edit.operation"), null)); } finally { myChangeListener.setRunState(true); } } }); }