referenceSourceElement.setTextContent(referenceIdentifier);
}
@SuppressWarnings("unchecked")
private void performAddOperation(ModelElementInstanceImpl referenceSourceParentElement, Target referenceTargetElement) {
ModelInstanceImpl modelInstance = referenceSourceParentElement.getModelInstance();
String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement);
ModelElementInstance existingElement = modelInstance.getModelElementById(referenceTargetIdentifier);
if (existingElement == null || !existingElement.equals(referenceTargetElement)) {
throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement
+": element is not part of model. Please connect element to the model first.");
}
else {
Collection<Source> referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement);
Source referenceSourceElement = modelInstance.newInstance(referenceSourceType);
referenceSourceElements.add(referenceSourceElement);
setReferenceIdentifier(referenceSourceElement, referenceTargetIdentifier);
}
}