/** @generated */
 private Collection<IAdaptable> refreshConnections() {
   Domain2Notation domain2NotationMap = new Domain2Notation();
   Collection<TaiPanLinkDescriptor> linkDescriptors =
       collectAllLinks(getDiagram(), domain2NotationMap);
   Collection existingLinks = new LinkedList(getDiagram().getEdges());
   for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext(); ) {
     Edge nextDiagramLink = (Edge) linksIterator.next();
     int diagramLinkVisualID = TaiPanVisualIDRegistry.getVisualID(nextDiagramLink);
     if (diagramLinkVisualID == -1) {
       if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
         linksIterator.remove();
       }
       continue;
     }
     EObject diagramLinkObject = nextDiagramLink.getElement();
     EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
     EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
     for (Iterator<TaiPanLinkDescriptor> linkDescriptorsIterator = linkDescriptors.iterator();
         linkDescriptorsIterator.hasNext(); ) {
       TaiPanLinkDescriptor nextLinkDescriptor = linkDescriptorsIterator.next();
       if (diagramLinkObject == nextLinkDescriptor.getModelElement()
           && diagramLinkSrc == nextLinkDescriptor.getSource()
           && diagramLinkDst == nextLinkDescriptor.getDestination()
           && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
         linksIterator.remove();
         linkDescriptorsIterator.remove();
         break;
       }
     }
   }
   deleteViews(existingLinks.iterator());
   return createConnections(linkDescriptors, domain2NotationMap);
 }
 /** @generated */
 private Collection createConnections(Collection linkDescriptors, Map domain2NotationMap) {
   List adapters = new LinkedList();
   for (Iterator linkDescriptorsIterator = linkDescriptors.iterator();
       linkDescriptorsIterator.hasNext(); ) {
     final TaiPanLinkDescriptor nextLinkDescriptor =
         (TaiPanLinkDescriptor) linkDescriptorsIterator.next();
     EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
     EditPart targetEditPart =
         getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
     if (sourceEditPart == null || targetEditPart == null) {
       continue;
     }
     CreateConnectionViewRequest.ConnectionViewDescriptor descriptor =
         new CreateConnectionViewRequest.ConnectionViewDescriptor(
             nextLinkDescriptor.getSemanticAdapter(),
             null,
             ViewUtil.APPEND,
             false,
             ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
     CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
     ccr.setType(RequestConstants.REQ_CONNECTION_START);
     ccr.setSourceEditPart(sourceEditPart);
     sourceEditPart.getCommand(ccr);
     ccr.setTargetEditPart(targetEditPart);
     ccr.setType(RequestConstants.REQ_CONNECTION_END);
     Command cmd = targetEditPart.getCommand(ccr);
     if (cmd != null && cmd.canExecute()) {
       executeCommand(cmd);
       IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
       if (viewAdapter != null) {
         adapters.add(viewAdapter);
       }
     }
   }
   return adapters;
 }