void (@NotNull final Editor editor, final Template template, @NotNull final Project project, final TemplateEditingListener listener, final @NlsContexts.Command String commandName) { Runnable runnable = () -> TemplateManager.getInstance(project).startTemplate(editor, template, listener); if (!ApplicationManager.getApplication().isWriteIntentLockAcquired() || IntentionPreviewUtils.isIntentionPreviewActive()) { runnable.run(); } else { CommandProcessor.getInstance().executeCommand(project, runnable, commandName, commandName); } }