void (@NotNull Template template, boolean brokenOff) { if (index + 1 < templates.size()){ ApplicationManager.getApplication().invokeLater(() -> WriteCommandAction.runWriteCommandAction(myProject, ()-> runTemplates(myProject, editor, templates, index + 1) )); } }