From ed90a55dc6633b9fa84fde0e323d9502df63ea91 Mon Sep 17 00:00:00 2001 From: lempinen Date: Wed, 23 Oct 2013 07:27:16 +0000 Subject: [PATCH] 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 --- .../ui/editor/participant/SysdynConnectionBuilder.java | 5 +++++ 1 file changed, 5 insertions(+) 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); -- 2.47.1