protected AbstractElement getEnclosingSingleElementGroup ( AbstractElement elementToParse ) { EObject container = elementToParse . eContainer ( ) ; if ( container instanceof Group ) { if ( ( ( Group ) container ) . getElements ( ) . size ( ) == 1 ) { return ( AbstractElement ) container ; } } return null ; }
Return the containing group if it contains exactly one element .