@Override
  public PsiElement findInsertionAnchor(@NotNull PsiClass aClass, @NotNull PsiElement leaf) {
    PsiElement parent = aClass instanceof GroovyScriptClass ? aClass.getContainingFile() : ((GrTypeDefinition)aClass).getBody();
    if (parent == null) return null;

    if (!PsiTreeUtil.isAncestor(parent, leaf, true)) {
      return null; // we are not in class body
    }

    PsiElement element = PsiTreeUtil.findPrevParent(parent, leaf);

    PsiElement lBrace = aClass.getLBrace();
    if (lBrace == null) {
      return null;
    }
    else {
      PsiElement rBrace = aClass.getRBrace();
      if (!GenerateMembersUtil.isChildInRange(element, lBrace.getNextSibling(), rBrace)) {
        return null;
      }
    }

    return element;
  }
@Override
  public PsiElement findInsertionAnchor(@NotNull PsiClass aClass, @NotNull PsiElement leaf)