diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 8a2919798..0f13a11d7 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -97,6 +97,7 @@ It now follows the same rule than all other graphical node: if a compartment tha Now the _end_ keyword is not displayed anymore in the label of these graphical nodes, and the direct edit only allows to edit the name of the end instead of the full label which was confusing for users. - https://github.com/eclipse-syson/syson/issues/2054[#2054] [diagrams] Fix an error when invoking the tools _New Start Action_ or _New Done Action_ from inside a package named `Actions`. - https://github.com/eclipse-syson/syson/issues/2057[#2057] [diagrams] Fix the support for removing the multiplicity using the direct edit. +- https://github.com/eclipse-syson/syson/issues/1938[#1938] [diagrams] Fix an issue where the _New Flow (flow)_ tool between two parameters was broken. === Improvements diff --git a/backend/application/syson-application/src/test/java/org/eclipse/syson/application/controllers/diagrams/general/view/GVFlowUsageTests.java b/backend/application/syson-application/src/test/java/org/eclipse/syson/application/controllers/diagrams/general/view/GVFlowUsageTests.java index f967f1aa6..fb02abd4f 100644 --- a/backend/application/syson-application/src/test/java/org/eclipse/syson/application/controllers/diagrams/general/view/GVFlowUsageTests.java +++ b/backend/application/syson-application/src/test/java/org/eclipse/syson/application/controllers/diagrams/general/view/GVFlowUsageTests.java @@ -55,6 +55,7 @@ import org.eclipse.syson.application.controllers.diagrams.checkers.CheckDiagramElementCount; import org.eclipse.syson.application.controllers.diagrams.testers.EdgeCreationTester; import org.eclipse.syson.application.controllers.diagrams.testers.EdgeReconnectionTester; +import org.eclipse.syson.application.controllers.diagrams.testers.ToolTester; import org.eclipse.syson.application.data.GeneralViewFlowConnectionItemUsagesProjectData; import org.eclipse.syson.application.data.GeneralViewFlowUsageProjectData; import org.eclipse.syson.services.SemanticRunnableFactory; @@ -69,6 +70,7 @@ import org.eclipse.syson.sysml.FlowUsage; import org.eclipse.syson.sysml.PayloadFeature; import org.eclipse.syson.sysml.SysmlPackage; +import org.eclipse.syson.sysml.helper.LabelConstants; import org.eclipse.syson.util.IDescriptionNameGenerator; import org.eclipse.syson.util.SysONRepresentationDescriptionIdentifiers; import org.junit.jupiter.api.BeforeEach; @@ -131,6 +133,9 @@ public class GVFlowUsageTests extends AbstractIntegrationTests { @Autowired private IIdentityService identityService; + @Autowired + private ToolTester toolTester; + private SemanticCheckerService semanticCheckerService; private Flux givenSubscriptionToDiagram() { @@ -195,6 +200,73 @@ public void checkFlowConnectionCreation() { .verify(Duration.ofSeconds(10)); } + @DisplayName("GIVEN a SysML Project with ActionUsages with parameters (ReferenceUsages), WHEN creating a FlowUsage between parameters, THEN an edge should be displayed to represent that new flow") + @GivenSysONServer({ GeneralViewFlowConnectionItemUsagesProjectData.SCRIPT_PATH }) + @Test + public void checkFlowConnectionBetweenParametersCreation() { + var flux = this.givenSubscriptionToDiagram(); + + AtomicReference diagram = new AtomicReference<>(); + Consumer initialDiagramContentConsumer = assertRefreshedDiagramThat(diagram::set); + + var diagramDescription = this.givenDiagramDescription.getDiagramDescription(GeneralViewFlowConnectionItemUsagesProjectData.EDITING_CONTEXT_ID, + SysONRepresentationDescriptionIdentifiers.GENERAL_VIEW_DIAGRAM_DESCRIPTION_ID); + var diagramDescriptionIdProvider = new DiagramDescriptionIdProvider(diagramDescription, this.diagramIdProvider); + + var parameterCreationToolId = diagramDescriptionIdProvider.getNodeToolId(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getActionUsage()), "New Parameter In"); + var flowCreationToolId = diagramDescriptionIdProvider.getEdgeCreationToolId(this.descriptionNameGenerator.getBorderNodeName(SysmlPackage.eINSTANCE.getReferenceUsage()), "New Flow (flow)"); + + Runnable parameterOnAction1CreationTool = () -> this.toolTester.invokeTool(GeneralViewFlowConnectionItemUsagesProjectData.EDITING_CONTEXT_ID, + GeneralViewFlowConnectionItemUsagesProjectData.GraphicalIds.DIAGRAM_ID, + GeneralViewFlowConnectionItemUsagesProjectData.GraphicalIds.ACTION_USAGE_1_ID, parameterCreationToolId, List.of()); + + var parameterOnAction1BorderNodeId = new AtomicReference(); + Consumer diagramContentConsumerAfterNewParameterOnAction1 = assertRefreshedDiagramThat(newDiagram -> { + var parameterOnAction1BorderNode = new DiagramNavigator(newDiagram).nodeWithLabel(LabelConstants.OPEN_QUOTE + "action" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR + "action1") + .getNode().getBorderNodes().stream().filter(bn -> bn.getOutsideLabels().get(0).text().equals("parameter1")).findFirst().orElseThrow(); + parameterOnAction1BorderNodeId.set(parameterOnAction1BorderNode.getId()); + }); + + Runnable parameterOnAction2CreationTool = () -> this.toolTester.invokeTool(GeneralViewFlowConnectionItemUsagesProjectData.EDITING_CONTEXT_ID, + GeneralViewFlowConnectionItemUsagesProjectData.GraphicalIds.DIAGRAM_ID, + GeneralViewFlowConnectionItemUsagesProjectData.GraphicalIds.ACTION_USAGE_2_ID, parameterCreationToolId, List.of()); + + var parameterOnAction2BorderNodeId = new AtomicReference(); + Consumer diagramContentConsumerAfterNewParameterOnAction2 = assertRefreshedDiagramThat(newDiagram -> { + var parameterOnAction2BorderNode = new DiagramNavigator(newDiagram).nodeWithLabel(LabelConstants.OPEN_QUOTE + "action" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR + "action2") + .getNode().getBorderNodes().stream().filter(bn -> bn.getOutsideLabels().get(0).text().equals("parameter1")).findFirst().orElseThrow(); + parameterOnAction2BorderNodeId.set(parameterOnAction2BorderNode.getId()); + }); + + Runnable flowCreationTool = () -> this.edgeCreationTester.createEdgeUsingNodeId(GeneralViewFlowConnectionItemUsagesProjectData.EDITING_CONTEXT_ID, + diagram, + parameterOnAction1BorderNodeId.get(), + parameterOnAction2BorderNodeId.get(), + flowCreationToolId); + + AtomicReference newFlow = new AtomicReference<>(); + Consumer diagramCheck = assertRefreshedDiagramThat(newDiagram -> { + var initialDiagram = diagram.get(); + assertThat(this.diagramComparator.newEdges(initialDiagram, newDiagram)).hasSize(1); + Edge newEdge = this.diagramComparator.newEdges(initialDiagram, newDiagram).get(0); + newFlow.set(newEdge.getTargetObjectId()); + assertThat(newEdge).hasSourceId(parameterOnAction1BorderNodeId.get()); + assertThat(newEdge).hasTargetId(parameterOnAction2BorderNodeId.get()); + assertThat(newEdge.getStyle()).hasTargetArrow(ArrowStyle.InputFillClosedArrow); + }); + + StepVerifier.create(flux) + .consumeNextWith(initialDiagramContentConsumer) + .then(parameterOnAction1CreationTool) + .consumeNextWith(diagramContentConsumerAfterNewParameterOnAction1) + .then(parameterOnAction2CreationTool) + .consumeNextWith(diagramContentConsumerAfterNewParameterOnAction2) + .then(flowCreationTool) + .consumeNextWith(diagramCheck) + .thenCancel() + .verify(Duration.ofSeconds(10)); + } + @DisplayName("GIVEN a SysML Project with ItemUsages on ActionUsage, WHEN creating a BindingConnectorAsUsage between them, THEN an edge should be displayed to represent that new binding") @GivenSysONServer({ GeneralViewFlowConnectionItemUsagesProjectData.SCRIPT_PATH }) @Test diff --git a/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/nodes/ReferenceUsageBorderNodeDescriptionProvider.java b/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/nodes/ReferenceUsageBorderNodeDescriptionProvider.java index 1a6704587..60f08c928 100644 --- a/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/nodes/ReferenceUsageBorderNodeDescriptionProvider.java +++ b/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/nodes/ReferenceUsageBorderNodeDescriptionProvider.java @@ -177,7 +177,8 @@ protected EdgeTool createBindingConnectorAsUsageEdgeTool(List t var body = this.viewBuilderHelper.newChangeContext() .expression(ServiceMethod.of5(DiagramMutationAQLService::createBindingConnectorAsUsage) - .aql(EdgeDescription.SEMANTIC_EDGE_SOURCE, EdgeDescription.SEMANTIC_EDGE_TARGET, + .aql(EdgeDescription.SEMANTIC_EDGE_SOURCE, + EdgeDescription.SEMANTIC_EDGE_TARGET, EdgeDescription.EDGE_SOURCE, EdgeDescription.EDGE_TARGET, IEditingContext.EDITING_CONTEXT, @@ -196,9 +197,11 @@ protected EdgeTool createFlowUsageEdgeTool(List targetElementDe var body = this.viewBuilderHelper.newChangeContext() .expression(ServiceMethod.of5(DiagramMutationAQLService::createFlowUsage) - .aqlSelf(EdgeDescription.SEMANTIC_EDGE_TARGET, + .aql(EdgeDescription.SEMANTIC_EDGE_SOURCE, + EdgeDescription.SEMANTIC_EDGE_TARGET, EdgeDescription.EDGE_SOURCE, - EdgeDescription.EDGE_TARGET, IEditingContext.EDITING_CONTEXT, + EdgeDescription.EDGE_TARGET, + IEditingContext.EDITING_CONTEXT, DiagramContext.DIAGRAM_CONTEXT)); return builder diff --git a/doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc b/doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc index d5dcc6333..60256a064 100644 --- a/doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc +++ b/doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc @@ -35,6 +35,7 @@ Now the _end_ keyword is not displayed anymore in the label of these graphical n ** Fix an error when invoking the tools _New Start Action_ or _New Done Action_ from inside a package named `Actions`. ** Fix the support for removing the multiplicity using the direct edit. + During the direct edit, typing `[]` will remove the multiplicity if it exists, as it is supposed to do. +** Fix an issue where the _New Flow (flow)_ tool between two parameters was broken. * In textual import/export: