void (InsertionContext context, @Nullable final 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(); } } }); } }