org.dmg.pmml._40.DataFieldType lastDataFieldType = null;
org.dmg.pmml._40.DataFieldType classDataFieldType = null;
org.eclipse.emf.common.command.Command cmd = null;
DataDictionaryTypeEditPart diagram = (DataDictionaryTypeEditPart)getHost();
ArrayList<DataFieldType> tRelations = null;
ArrayList<DataFieldType> cRelations = new ArrayList<DataFieldType>();
for (Object o : result) {
if (o instanceof DataFieldType ) {
DataFieldType dft = (DataFieldType)o;
if (!dft.getName().equals("class")) {
cRelations.add(dft);
if (oldDataFieldType != null) {
tRelations = new ArrayList<DataFieldType>();
tRelations.add(oldDataFieldType);
cmd = SetCommand.create(diagram.getEditingDomain(), dft,
(EStructuralFeature) dft.eClass().getEStructuralFeature(
"relation"), tRelations);
diagram.getEditingDomain().getCommandStack().execute(cmd);
oldDataFieldType = dft;
lastDataFieldType = dft;
tRelations = null;
} else {
firstDataFieldType = dft;
oldDataFieldType = dft;
}
} else {
classDataFieldType = dft;
}
}
}
tRelations = new ArrayList<DataFieldType>(firstDataFieldType.getRelation());
tRelations.add(lastDataFieldType);
cmd = SetCommand.create(diagram.getEditingDomain(), firstDataFieldType,
(EStructuralFeature) firstDataFieldType.eClass().getEStructuralFeature(
"relation"), tRelations);
diagram.getEditingDomain().getCommandStack().execute(cmd);
cmd = SetCommand.create(diagram.getEditingDomain(), classDataFieldType,
(EStructuralFeature) classDataFieldType.eClass().getEStructuralFeature(
"relation"), cRelations);
diagram.getEditingDomain().getCommandStack().execute(cmd);
return result;
}