void (@NotNull Template template, boolean brokenOff) { ApplicationManager.getApplication().runWriteAction(() -> { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); PsiFile psi = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); PsiElement el = PsiTreeUtil.findElementOfClassAtOffset(psi, editor.getCaretModel().getOffset() - 1, PsiMethod.class, false); if (el != null) { PsiMethod method1 = PsiTreeUtil.getParentOfType(el, PsiMethod.class, false); if (method1 != null) { if (method1.findDeepestSuperMethods().length > 0) { GenerateMembersUtil.setupGeneratedMethod(method1); } CreateFromUsageUtils.setupEditor(method1, editor); } } }); }