public static IParsedElement boundingParent ( List < IParseTree > locations , int position , Class < ? extends IParsedElement > ... possibleTypes ) { IParseTree location = IParseTree . Search . getDeepestLocation ( locations , position , true ) ; IParsedElement pe = null ; if ( location != null ) { pe = location . getParsedElement ( ) ; while ( pe != null && ! isOneOfTypes ( pe , possibleTypes ) ) { pe = pe . getParent ( ) ; } } return pe ; }
Finds a bounding parent of any of the possible types passed in from the list of locations starting at the position given .