private static void implementMethodsWhenTemplateIsFinished(InsertionContext context, final @Nullable OffsetKey insideBraces) {
    TemplateState state = TemplateManagerImpl.getTemplateState(context.getEditor());
    if (state != null && insideBraces != null) {
      state.addTemplateStateListener(new TemplateEditingAdapter() {
        @Override
        public void templateFinished(@NotNull Template template, boolean brokenOff) {
          if (!brokenOff) {
            context.getEditor().getCaretModel().moveToOffset(context.getOffset(insideBraces));
            createOverrideRunnable(context.getEditor(), context.getFile(), context.getProject()).run();
          }
        }
      });
    }
  }
private static void implementMethodsWhenTemplateIsFinished(InsertionContext context, final @Nullable OffsetKey insideBraces)