boolean (@Nullable Project project, @NotNull Document document, @Nullable @NlsContexts.Command String commandName, @Nullable String commandGroupId, @NotNull UndoConfirmationPolicy confirmationPolicy, boolean underBulkUpdate, boolean shouldRecordCommandForActiveDocument, @NotNull Runnable task) { if (!makeWritable(project, document)) { VirtualFile file = FileDocumentManager.getInstance().getFile(document); LOG.warn("Document is read-only" + (file != null ? ": " + file.getPresentableName() : "")); return false; } ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(project, () -> { if (underBulkUpdate) { DocumentUtil.executeInBulk(document, task); } else { task.run(); } }, commandName, commandGroupId, confirmationPolicy, shouldRecordCommandForActiveDocument, document)); return true; }