void (ExtractMethodInfoHelper helper, PsiClass owner) { final GrMethod method = ExtractUtil.createMethod(helper); PsiElement anchor = calculateAnchorToInsertBefore(owner, helper.getContext()); GrMethod newMethod = (GrMethod)owner.addBefore(method, anchor); renameParameterOccurrences(newMethod, helper); JavaCodeStyleManager.getInstance(newMethod.getProject()).shortenClassReferences(newMethod); PsiElement prev = newMethod.getPrevSibling(); if (!PsiUtil.isLineFeed(prev)) { newMethod.getParent().getNode().addLeaf(GroovyTokenTypes.mNLS, "\n", newMethod.getNode()); } }