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
\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
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