From: lempinen Date: Wed, 23 Oct 2013 07:27:16 +0000 (+0000) Subject: Scl.commands prevented sysdyn diagram modifications, since sysdyn connections do... X-Git-Tag: 1.8.1~233 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=ed90a55dc6633b9fa84fde0e323d9502df63ea91;p=simantics%2Fsysdyn.git Scl.commands prevented sysdyn diagram modifications, since sysdyn connections do not yet have names. 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 --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java index 19e93e0d..159abc54 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectionBuilder.java @@ -27,6 +27,7 @@ import org.simantics.diagram.participant.ConnectionBuilder; import org.simantics.diagram.participant.ControlPoint; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.diagram.stubs.G2DResource; +import org.simantics.diagram.synchronization.graph.AddElement; import org.simantics.diagram.ui.DiagramModelHints; import org.simantics.g2d.diagram.IDiagram; import org.simantics.g2d.diagram.handler.Topology.Terminal; @@ -89,6 +90,9 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{ // 1. Get diagram connection to construct. Resource connection = getOrCreateConnection(graph, startTerminal, endTerminal); + + // 1.1 Give running name to connection and increment the counter attached to the diagram. + AddElement.claimFreshElementName(graph, diagramResource, connection); // 2. Add branch points List> bps = createBranchPoints(graph, connection, controlPoints); @@ -188,6 +192,7 @@ public class SysdynConnectionBuilder extends ConnectionBuilder{ Resource valve = graph.newResource(); graph.claim(valve, L0.InstanceOf, null, valveClassResource); graph.claim(valve, L0.PartOf, diagramResource); + AddElement.claimFreshElementName(graph, diagramResource, valve); valveElement.setHint(ElementHints.KEY_OBJECT, valve); OrderedSetUtils.add(graph, diagramResource, valve);