]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Scl.commands prevented sysdyn diagram modifications, since sysdyn connections do...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 23 Oct 2013 07:27:16 +0000 (07:27 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 23 Oct 2013 07:27:16 +0000 (07:27 +0000)
Workaround: Display error once, so that it is not forgotten, but then carry on modifying the diagram.

Added names for future sysdyn connections. The workaround is needed to support old models.

refs #4480

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28105 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java

index 19e93e0d7c9c60c589ca1ed40f695230a41237d3..159abc54e33267ad5da55dffa8acc3ae243a3957 100644 (file)
@@ -27,6 +27,7 @@ import org.simantics.diagram.participant.ConnectionBuilder;
 import org.simantics.diagram.participant.ControlPoint;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.diagram.synchronization.graph.AddElement;\r
 import org.simantics.diagram.ui.DiagramModelHints;\r
 import org.simantics.g2d.diagram.IDiagram;\r
 import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
@@ -89,6 +90,9 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{
 \r
         // 1. Get diagram connection to construct.\r
         Resource connection = getOrCreateConnection(graph, startTerminal, endTerminal);\r
+        \r
+        // 1.1 Give running name to connection and increment the counter attached to the diagram.\r
+        AddElement.claimFreshElementName(graph, diagramResource, connection);\r
 \r
         // 2. Add branch points\r
         List<Pair<ControlPoint, Resource>> bps = createBranchPoints(graph, connection, controlPoints);\r
@@ -188,6 +192,7 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{
         Resource valve = graph.newResource();\r
         graph.claim(valve, L0.InstanceOf, null, valveClassResource);\r
         graph.claim(valve, L0.PartOf, diagramResource);\r
+        AddElement.claimFreshElementName(graph, diagramResource, valve);\r
         valveElement.setHint(ElementHints.KEY_OBJECT, valve);\r
 \r
         OrderedSetUtils.add(graph, diagramResource, valve);\r