List adapters = new LinkedList();
for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator
.hasNext();) {
final OntoUML.diagram.part.OntoUMLLinkDescriptor nextLinkDescriptor = (OntoUML.diagram.part.OntoUMLLinkDescriptor) 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);