Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -131,6 +133,9 @@ public class GVFlowUsageTests extends AbstractIntegrationTests {
@Autowired
private IIdentityService identityService;

@Autowired
private ToolTester toolTester;

private SemanticCheckerService semanticCheckerService;

private Flux<DiagramRefreshedEventPayload> givenSubscriptionToDiagram() {
Expand Down Expand Up @@ -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> diagram = new AtomicReference<>();
Consumer<Object> 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<String>();
Consumer<Object> 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<String>();
Consumer<Object> 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<String> newFlow = new AtomicReference<>();
Consumer<Object> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ protected EdgeTool createBindingConnectorAsUsageEdgeTool(List<NodeDescription> 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,
Expand All @@ -196,9 +197,11 @@ protected EdgeTool createFlowUsageEdgeTool(List<NodeDescription> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Loading