public static void startTemplate(final @NotNull Editor editor,
                                   final Template template,
                                   final @NotNull 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);
    }
  }
public static void startTemplate(final @NotNull Editor editor,
                                   final Template template,
                                   final @NotNull Project project,
                                   final TemplateEditingListener listener,
                                   final @NlsContexts.Command String commandName)