}
}
protected void createDIEdge(Connection connection, BaseElement conElement, BPMNEdge edge) throws IOException {
ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
if (edge == null) {
EList<EObject> businessObjects = Graphiti.getLinkService().getLinkForPictogramElement(getDiagram())
.getBusinessObjects();
for (EObject eObject : businessObjects) {
if (eObject instanceof BPMNDiagram) {
BPMNDiagram bpmnDiagram = (BPMNDiagram) eObject;
edge = BpmnDiFactory.eINSTANCE.createBPMNEdge();
// edge.setId(EcoreUtil.generateUUID());
edge.setBpmnElement(conElement);
if (conElement instanceof Association) {
edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
((Association) conElement).getSourceRef()));
edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
((Association) conElement).getTargetRef()));
} else if (conElement instanceof MessageFlow) {
edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
(BaseElement) ((MessageFlow) conElement).getSourceRef()));
edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
(BaseElement) ((MessageFlow) conElement).getTargetRef()));
} else if (conElement instanceof SequenceFlow) {
edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
((SequenceFlow) conElement).getSourceRef()));
edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
((SequenceFlow) conElement).getTargetRef()));
}
ILocation sourceLoc = Graphiti.getPeService().getLocationRelativeToDiagram(connection.getStart());
ILocation targetLoc = Graphiti.getPeService().getLocationRelativeToDiagram(connection.getEnd());