]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectionBuilder.java
ConnectionTool fixes for overlapping terminals
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / participant / ConnectionBuilder.java
index 599aba0d042d49b72c380fb8c66981a1869a9122..8da84709b6ee89be5dd29c9ee53697e9ca7a51a0 100644 (file)
@@ -497,7 +497,7 @@ public class ConnectionBuilder {
 
             Connector endConnector = null;
             if (endTerminal != null) {
-                endConnector = createConnectorForNode(graph, attachToConnection, endTerminal, EdgeEnd.End, judgment);
+               endConnector = createConnectorForNode(graph, attachToConnection, endTerminal, flagType == FlagClass.Type.In ? EdgeEnd.Begin : EdgeEnd.End, judgment);
             } else if (createFlags) {
                 EdgeEnd end = flagType == FlagClass.Type.In ? EdgeEnd.Begin : EdgeEnd.End;
                 IElement endFlag = createFlag(graph, attachToConnection, end, controlPoints.getLast(), flagType, null);
@@ -763,7 +763,9 @@ public class ConnectionBuilder {
             EdgeEnd end, ConnectionJudgement judgment) throws DatabaseException {
         IConnectionPoint cp = ConnectionUtil.toConnectionPoint(graph, element, terminal);
         CPTerminal cpt = (cp instanceof CPTerminal) ? (CPTerminal) cp : null;
-        Resource attachment = judgment.attachmentRelations.get(graph, cpt);
+        Resource attachment = null;
+        if (judgment.attachmentRelations != null)
+            attachment = judgment.attachmentRelations.get(graph, cpt);
         if (attachment == null)
             attachment = cu.toHasConnectorRelation(end);
         Resource connector = cu.getOrCreateConnector(connection, element, terminal, end, attachment);