void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiMethod method = canInsertSuper(editor, file); LOG.assertTrue(method != null); PsiMethod template = (PsiMethod)method.copy(); OverrideImplementUtil.setupMethodBody(template, findNonAbstractSuper(method), method.getContainingClass()); PsiCodeBlock templateBody = template.getBody(); LOG.assertTrue(templateBody != null, template); PsiStatement superCall = templateBody.getStatements()[0]; PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); PsiCodeBlock codeBlock = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class); LOG.assertTrue(codeBlock != null); PsiElement toGo; if (codeBlock.getLBrace() == null) { toGo = codeBlock.addBefore(superCall, null); } else { if (element.getParent() == codeBlock) { toGo = codeBlock.addBefore(superCall, element); } else { toGo = codeBlock.addAfter(superCall, codeBlock.getLBrace()); } } toGo = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(toGo); editor.getCaretModel().moveToOffset(toGo.getTextOffset()); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); }