GrDocCommentOwner (GroovyDocPsiElement docElement) { PsiElement element = docElement; while (element != null && element.getParent() instanceof GroovyDocPsiElement) element = element.getParent(); if (element == null) return null; element = skipWhiteSpacesAndStopOnDoc(element, true); if (element instanceof GrDocCommentOwner) return (GrDocCommentOwner)element; if (element instanceof GrMembersDeclaration) { GrMember[] members = ((GrMembersDeclaration)element).getMembers(); if (members.length > 0 && members[0] instanceof GrDocCommentOwner) { return (GrDocCommentOwner)members[0]; } } return null; }