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