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 @@ -91,6 +91,7 @@ For example `ViewUsage` elements are no longer rendered in _parts_ compartments.
- https://github.com/eclipse-syson/syson/issues/2031[#2031] [diagrams] Fix an issue where it was not possible to drag and drop a `LibraryPackage` from the _Explorer_ to a diagram.
- https://github.com/eclipse-syson/syson/issues/2050[#2050] [diagrams] Fix an issue where creating a `PerformActionUsage` from the `ActionUsage` graphical node (or any other graphical node that allows to create it) was displaying it in the diagram background and its compartments every time.
It now follows the same rule than all other graphical node: if a compartment that can display the new `PerformActionUsage` is displayed, then the new `PerformActionUsage` is displayed in this compartment, otherwise it is displayed in the diagram background.
- https://github.com/eclipse-syson/syson/issues/2046[#2046] [diagrams] Fix an issue where the creation of a `RequirementUsage` from a `Package` graphical node was not revealing it.

=== Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,4 +431,53 @@ public void testCreateItemInSubPackage() {
.thenCancel()
.verify(Duration.ofSeconds(10));
}

@DisplayName("GIVEN a diagram with a Package node, WHEN a ReferenceUsage node is created, THEN the ReferenceUsage node is only visible inside the Package")
@GivenSysONServer({ GeneralViewWithTopNodesTestProjectData.SCRIPT_PATH })
@Test
public void testCreateReferenceInPackage() {
var flux = this.givenSubscriptionToDiagram();

var diagramDescription = this.givenDiagramDescription.getDiagramDescription(GeneralViewWithTopNodesTestProjectData.EDITING_CONTEXT_ID,
SysONRepresentationDescriptionIdentifiers.GENERAL_VIEW_DIAGRAM_DESCRIPTION_ID);
var diagramDescriptionIdProvider = new DiagramDescriptionIdProvider(diagramDescription, this.diagramIdProvider);

var newReferenceToolId = diagramDescriptionIdProvider.getNodeToolId(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getPackage()), "New Reference");
assertThat(newReferenceToolId).as("The tool 'New Reference' should exist on the Package").isNotNull();

var diagramId = new AtomicReference<String>();
var packageNodeId = new AtomicReference<String>();

Consumer<Object> initialDiagramContentConsumer = assertRefreshedDiagramThat(diag -> {
diagramId.set(diag.getId());

var packageNode = new DiagramNavigator(diag).nodeWithLabel(PACKAGE).getNode();
packageNodeId.set(packageNode.getId());

assertThat(packageNode.getChildNodes()).hasSize(0);

assertThat(new DiagramNavigator(diag).findDiagramEdgeCount()).isEqualTo(3);
});

Runnable newReferenceTool = () -> this.toolTester.invokeTool(GeneralViewWithTopNodesTestProjectData.EDITING_CONTEXT_ID, diagramId.get(), packageNodeId.get(), newReferenceToolId,
List.of());

Consumer<Object> updatedDiagramContentConsumerAfterNewPart = assertRefreshedDiagramThat(diag -> {
var packageNode = new DiagramNavigator(diag).nodeWithLabel(PACKAGE).getNode();
assertThat(packageNode.getChildNodes()).hasSize(1);

var referenceUsageNode = new DiagramNavigator(diag)
.nodeWithLabel(LabelConstants.OPEN_QUOTE + "ref reference" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR + "reference1").getNode();
assertThat(referenceUsageNode).isNotNull();

assertThat(new DiagramNavigator(diag).findDiagramEdgeCount()).isEqualTo(3);
});

StepVerifier.create(flux)
.consumeNextWith(initialDiagramContentConsumer)
.then(newReferenceTool)
.consumeNextWith(updatedDiagramContentConsumerAfterNewPart)
.thenCancel()
.verify(Duration.ofSeconds(10));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ private static Stream<Arguments> topNodeParameters() {
Arguments.of(SysmlPackage.eINSTANCE.getPartUsage(), 11, 0, 0, 0, ViewConstants.DEFAULT_USAGE_NODE_HEIGHT, ViewConstants.DEFAULT_USAGE_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getPortDefinition(), 5, 0, 0, 0, ViewConstants.DEFAULT_DEFINITION_NODE_HEIGHT, ViewConstants.DEFAULT_DEFINITION_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getPortUsage(), 5, 0, 0, 0, ViewConstants.DEFAULT_USAGE_NODE_HEIGHT, ViewConstants.DEFAULT_USAGE_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getReferenceUsage(), 0, 0, 0, 0, ViewConstants.DEFAULT_USAGE_NODE_HEIGHT, ViewConstants.DEFAULT_USAGE_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getRequirementDefinition(), 8, 0, 0, 0, ViewConstants.DEFAULT_DEFINITION_NODE_HEIGHT, ViewConstants.DEFAULT_DEFINITION_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getRequirementUsage(), 8, 0, 0, 0, ViewConstants.DEFAULT_USAGE_NODE_HEIGHT, ViewConstants.DEFAULT_USAGE_NODE_WIDTH),
Arguments.of(SysmlPackage.eINSTANCE.getUseCaseDefinition(), 5, 0, 0, 0, ViewConstants.DEFAULT_DEFINITION_NODE_HEIGHT, ViewConstants.DEFAULT_DEFINITION_NODE_WIDTH),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023, 2025 Obeo.
* Copyright (c) 2023, 2026 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -50,6 +50,8 @@ protected List<NodeDescription> getReusedChildren(IViewDiagramElementFinder cach
SDVDiagramDescriptionProvider.ANNOTATINGS.forEach(annotating -> cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(annotating)).ifPresent(reusedChildren::add));
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getPackage())).ifPresent(reusedChildren::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getNamespaceImport())).ifPresent(reusedChildren::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getReferenceUsage())).ifPresent(reusedChildren::add);

return reusedChildren;
}

Expand All @@ -62,6 +64,7 @@ protected List<NodeDescription> getDroppableNodes(IViewDiagramElementFinder cach
SDVDiagramDescriptionProvider.ANNOTATINGS.forEach(annotating -> cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(annotating)).ifPresent(droppableNodes::add));
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getPackage())).ifPresent(droppableNodes::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getNamespaceImport())).ifPresent(droppableNodes::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getReferenceUsage())).ifPresent(droppableNodes::add);

return droppableNodes;
}
Expand All @@ -75,6 +78,8 @@ protected List<NodeDescription> getAllNodeDescriptions(IViewDiagramElementFinder
SDVDiagramDescriptionProvider.ANNOTATINGS.forEach(annotating -> cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(annotating)).ifPresent(allNodes::add));
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getPackage())).ifPresent(allNodes::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getNamespaceImport())).ifPresent(allNodes::add);
cache.getNodeDescription(this.descriptionNameGenerator.getNodeName(SysmlPackage.eINSTANCE.getReferenceUsage())).ifPresent(allNodes::add);

return allNodes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ They can also add their own SysML-based validation rules by returning additional
** Fix an issue where it was not possible to drag and drop a `LibraryPackage` from the _Explorer_ to a diagram.
** Fix an issue where creating a `PerformActionUsage` from the `ActionUsage` graphical node (or any other graphical node that allows to create it) was displaying it in the diagram background and its compartments every time.
It now follows the same rule than all other graphical node: if a compartment that can display the new `PerformActionUsage` is displayed, then the new `PerformActionUsage` is displayed in this compartment, otherwise it is displayed in the diagram background.
** Fix an issue where the creation of a `RequirementUsage` from a `Package` graphical node was not revealing it.

* In textual import/export:

Expand Down
Loading