// TODO: broken.\r
connection = ghostDiagram.getMutatedCorrespondence(possibleConnection);\r
} else {\r
- Object connectionType = connection.getHint(ElementHints.KEY_CONNECTION_TYPE);\r
connection = createConnection(connectionClass);\r
- connection.setHint(ElementHints.KEY_CONNECTION_TYPE, connectionType);\r
- \r
ghostDiagram.addElement(connection);\r
}\r
\r
topology.connect(edge, EdgeEnd.Begin, firstElement, firstTerminal);\r
\r
if (endElement != null) {\r
+ IConnectionAdvisor advisor = diagram.getHint(DiagramHints.CONNECTION_ADVISOR);\r
+ Object canConnect = canConnect(advisor, ghostDiagram.getMutatedCorrespondence(endElement), endTerminal);\r
+ if(canConnect != null) {\r
+ connection.setHint(ElementHints.KEY_CONNECTION_TYPE, canConnect);\r
+ }\r
topology.connect(edge, EdgeEnd.End, ghostDiagram.getMutatedCorrespondence(endElement), endTerminal);\r
} else {\r
IElement secondElement = connectionHandler.newBranchPoint(connection);\r
controlPoints.add(secondElement);\r
ElementUtils.setPos(secondElement, pos);\r
Terminal secondTerminal = ElementUtils.getSingleTerminal(secondElement);\r
+ IConnectionAdvisor advisor = diagram.getHint(DiagramHints.CONNECTION_ADVISOR);\r
+ Object canConnect = canConnect(advisor, null, null);\r
+ if(canConnect != null) {\r
+ connection.setHint(ElementHints.KEY_CONNECTION_TYPE, canConnect);\r
+ }\r
+ \r
topology.connect(edge, EdgeEnd.End, secondElement, secondTerminal);\r
}\r
DiagramUtils.validateAndFix(ghostDiagram, getContext());\r
return true;\r
} else {\r
if (isCurrentConnectionFlow() && startElement != null && startTerminal != null) {\r
-\r
- createValveIfNecessary(mouseCanvasPos);\r
-\r
+ \r
IConnectionAdvisor advisor = diagram.getHint(DiagramHints.CONNECTION_ADVISOR);\r
Object canConnect = canConnect(advisor, null, null);\r
if (canConnect != null)\r
connection.setHint(ElementHints.KEY_CONNECTION_TYPE, canConnect);\r
+ \r
+ createValveIfNecessary(mouseCanvasPos);\r
\r
// Finish connection in thin air only if the\r
// connection was started from a valid terminal.\r