// Expanding arraydefs in UnionFields
Set<EObject> ufields = EcoreUtil2.findAllByType(EcoreUtil.getAllProperContents(tu, true), UnionField.class);
for(EObject obj : ufields) {
UnionField ufld = (UnionField) obj;
if(ufld.getContainedType() instanceof ArrayDef)
expand(ufld);
}
}