public static EditorWriteActionHandler createExpandTemplateHandler(final char shortcutChar) {
    return new EditorWriteActionHandler.ForEachCaret() {
      @Override
      public void executeWriteAction(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
        Project project = editor.getProject();
        assert project != null;
        TemplateManager.getInstance(project).startTemplate(editor, shortcutChar);
      }

      @Override
      protected boolean isEnabledForCaret(@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) {
        Project project = editor.getProject();
        return project != null &&
               ((TemplateManagerImpl)TemplateManager.getInstance(project)).prepareTemplate(editor, shortcutChar, null) != null;
      }
    };
  }
public static EditorWriteActionHandler createExpandTemplateHandler(final char shortcutChar)