@SuppressWarnings({"unchecked", "rawtypes"}) private void setSourceRef( DataAssociation association, ItemAwareElement value, EObject container, EStructuralFeature containerFeature) { if (association.getSourceRef().size() == 0) { if (container != null) { if (containerFeature.isMany()) ((List) container.eGet(containerFeature)).add(value); else container.eSet(containerFeature, value); } if (value == null) association.getSourceRef().clear(); else association.getSourceRef().add(value); updateConnectionIfNeeded(association, value); } else { if (container != null) { if (containerFeature.isMany()) ((List) container.eGet(containerFeature)).add(value); else container.eSet(containerFeature, value); } updateConnectionIfNeeded(association, value); if (value == null) association.getSourceRef().clear(); else association.getSourceRef().set(0, value); updateConnectionIfNeeded(association, value); } if (association.getTargetRef() != null) { ItemAwareElement targetRef = association.getTargetRef(); if (value != null) targetRef.setItemSubjectRef(value.getItemSubjectRef()); else targetRef.setItemSubjectRef(null); updateConnectionIfNeeded(association, value); } }
@SuppressWarnings({"unchecked", "rawtypes"}) private void setTargetRef( DataAssociation association, ItemAwareElement value, EObject container, EStructuralFeature containerFeature) { if (container != null) { if (containerFeature.isMany()) ((List) container.eGet(containerFeature)).add(value); else container.eSet(containerFeature, value); } updateConnectionIfNeeded(association, value); association.setTargetRef(value); if (!association.getSourceRef().isEmpty()) { ItemAwareElement sourceRef = association.getSourceRef().get(0); if (value != null) sourceRef.setItemSubjectRef(value.getItemSubjectRef()); else sourceRef.setItemSubjectRef(null); } updateConnectionIfNeeded(association, value); }