public static TreePath pathTillOfKind(final TreePath path,final Tree.Kind kind){
  return pathTillOfKind(path,EnumSet.of(kind));
}

public static TreePath pathTillOfKind ( final TreePath path , final Tree . Kind kind ) { return pathTillOfKind ( path , EnumSet . of ( kind ) ) ; }
gets path to the first enclosing tree of the specified kind .
