for (EMFClass source : root.getClasses()) {
for (EReference ref : source.getTargetClass().getEReferences()) {
// get the destination type
EClass refDest = ref.getEReferenceType();
// find the corresponding EMFClass
EMFClass refDestEMF = getEMFClassFor(root, refDest);
// create a new EMFReference
EMFReference newRef = factory.createEMFReference();
newRef.setName(ref.getName());
newRef.setLowerBound(ref.getLowerBound());
newRef.setUpperBound(ref.getUpperBound());
newRef.setContainment(ref.isContainment());
if (refDestEMF != null) {
newRef.setType(refDestEMF);
} else {
// is there an external class?
EMFExternalClass refExternalClass = getEMFExternalClassFor(root, refDest);
if (refExternalClass == null) {
// we need to create one
refExternalClass = factory.createEMFExternalClass();
refExternalClass.setName(refDest.getName());
EPackage pkg = refDest.getEPackage();
if (pkg != null) {
refExternalClass.setTargetClass(refDest);
refExternalClass.setPackageName(pkg.getName());
refExternalClass.setPackageURI(pkg.getNsURI());
refExternalClass.setPackagePrefix(pkg.getNsPrefix());
}
root.getExternalClasses().add(refExternalClass);
}
newRef.setType(refExternalClass);
}
newRef.setTypeName(refDest.getName());
// add tagline
EMFLoaderHelper helper = new EMFLoaderHelper() {
@Override
public List<ITagHandler> getSemanticTagHandlers() {