void (Project project, PsiMethod method, GrMethod resultMethod, FileTemplate template, PsiSubstitutor substitutor) { final PsiType returnType = substitutor.substitute(getSuperReturnType(method)); String returnTypeText = ""; if (returnType != null) { returnTypeText = returnType.getPresentableText(); } Properties properties = FileTemplateManager.getInstance(project).getDefaultProperties(); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnTypeText); properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, PsiTypesUtil.getDefaultValueOfType(returnType)); properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, callSuper(method, resultMethod)); JavaTemplateUtil.setClassAndMethodNameProperties(properties, method.getContainingClass(), resultMethod); try { String bodyText = StringUtil.replace(template.getText(properties), ";", ""); GroovyFile file = GroovyPsiElementFactory.getInstance(project).createGroovyFile("\n " + bodyText + "\n", false, null); GrOpenBlock block = resultMethod.getBlock(); block.getNode().addChildren(file.getFirstChild().getNode(), null, block.getRBrace().getNode()); } catch (IOException e) { LOG.error(e); } }