Skip to content
Closed
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
10 changes: 9 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ And the following methods have been added:
**`org.eclipse.syson.tree.explorer.services.api.ISysONExplorerServiceDelegate` has a new `String getTreeItemTooltip(Object self);` method to provide tooltip for tree items in the explorer.
** `org.eclipse.syson.tree.explorer.services.api.ISysONExplorerFragment` has a new `String getTooltip(Object self);` method to provide tooltip for tree items in the explorer.

- [test] Reduce our call to `DiagramNavigator#nodeWithTargetObjectLabel` which has been deprecated for removal.
+ The API of `ToolTester#invokeTool` and `NodeCreationTestsService#createNode` has been updated accordingly to take a `targetObjectId` instead of a `label`.

- https://github.com/eclipse-syson/syson/issues/2045[#2045] [diagrams] The service `ViewNodeService#revealCompartment` has been changed to reveal a compartment only when it is needed.
+ Only reveal a compartment of a node when none of the revealed compartment can display the `targetElement`.
+ If many compartment candidates exist, choose the first free form compartment.

=== Dependency update

- [releng] Update to https://github.com/eclipse-sirius/sirius-web[Sirius Web 2026.1.6]
Expand Down Expand Up @@ -102,8 +109,9 @@ Now the _end_ keyword is not displayed anymore in the label of these graphical n
- https://github.com/eclipse-syson/syson/issues/2053[#2053] [diagrams] Prevent incoming and outgoing graphical edges of a graphical `ForkNode` or `JoinNode` to point empty space.
- https://github.com/eclipse-syson/syson/issues/2059[#2059] [diagrams] Fix an issue where the _Add existing elements_ tool was not working correctly on the _action flow_ compartment of `ActionUsage` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2043[#2043] [explorer] Prevent user libraries from being moved to the root of the project when a child is created in it.
- https://github.com/eclipse-syson/syson/issues/2056[#2056] [diagams] Fix the user feedback when dropping an `Element` which is already exposed on a diagram.
- https://github.com/eclipse-syson/syson/issues/2056[#2056] [diagrams] Fix the user feedback when dropping an `Element` which is already exposed on a diagram.
- https://github.com/eclipse-syson/syson/issues/2048[#2048] [diagrams] Fix an issue where the non-empty compartments of graphical nodes were being displayed when executing the _Add existing elements_ tool.
- https://github.com/eclipse-syson/syson/issues/2045[#2045] [diagrams] In Interconnection View diagrams, fix an issue where the `parts` compartment of a `PartDefinition` graphical node was incorrectly revealed when creating a `PartUsage` from the `PartDefinition` graphical node, even if the `interconnection` compartment was already visible.

=== Improvements

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* Copyright (c) 2025, 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 @@ -35,7 +35,7 @@ public class CheckBorderNode implements IDiagramChecker {

private final DiagramComparator diagramComparator;

private String parentLabel;
private String parentTargetObjectId;

private String borderNodeDescriptionName;

Expand All @@ -44,8 +44,8 @@ public CheckBorderNode(DiagramDescriptionIdProvider diagramDescriptionIdProvider
this.diagramComparator = diagramComparator;
}

public CheckBorderNode withParentLabel(String expectedParentLabel) {
this.parentLabel = expectedParentLabel;
public CheckBorderNode withParentTargetObjectId(String expectedParentTargetObjectId) {
this.parentTargetObjectId = expectedParentTargetObjectId;
return this;
}

Expand All @@ -58,7 +58,7 @@ public CheckBorderNode hasBorderNodeDescriptionName(String expectedBorderNodeDes
public void check(Diagram previousDiagram, Diagram newDiagram) {
List<Node> newNodes = this.diagramComparator.newNodes(previousDiagram, newDiagram);
DiagramNavigator diagramNavigator = new DiagramNavigator(newDiagram);
var parentNode = diagramNavigator.nodeWithTargetObjectLabel(this.parentLabel).getNode();
var parentNode = diagramNavigator.nodeWithTargetObjectId(this.parentTargetObjectId).getNode();
assertThat(parentNode.getBorderNodes()).anySatisfy(borderNode -> {
String borderNodeDescriptionId = this.diagramDescriptionIdProvider.getNodeDescriptionId(this.borderNodeDescriptionName);
assertThat(borderNode).hasDescriptionId(borderNodeDescriptionId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024, 2025 Obeo.
* Copyright (c) 2024, 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 @@ -35,7 +35,7 @@ public class CheckChildNode implements IDiagramChecker {

private final DiagramComparator diagramComparator;

private String parentLabel;
private String parentTargetObjectId;

private String parentNodeId;

Expand All @@ -48,8 +48,8 @@ public CheckChildNode(DiagramDescriptionIdProvider diagramDescriptionIdProvider,
this.diagramComparator = Objects.requireNonNull(diagramComparator);
}

public CheckChildNode withParentLabel(String expectedParentLabel) {
this.parentLabel = expectedParentLabel;
public CheckChildNode withParentTargetObjectId(String expectedParentTargetObjectId) {
this.parentTargetObjectId = expectedParentTargetObjectId;
return this;
}

Expand All @@ -76,7 +76,7 @@ public void check(Diagram previousDiagram, Diagram newDiagram) {
if (this.parentNodeId != null) {
parentNode = diagramNavigator.nodeWithId(this.parentNodeId).getNode();
} else {
parentNode = diagramNavigator.nodeWithTargetObjectLabel(this.parentLabel).getNode();
parentNode = diagramNavigator.nodeWithTargetObjectId(this.parentTargetObjectId).getNode();
}
assertThat(parentNode).isNotNull();
assertThat(parentNode.getChildNodes()).anySatisfy(childNode -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024, 2025 Obeo.
* Copyright (c) 2024, 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 @@ -36,7 +36,7 @@ public class CheckNodeInCompartment implements IDiagramChecker {

private final DiagramComparator diagramComparator;

private String parentLabel;
private String targetObjectId;

private String compartmentName;

Expand All @@ -46,13 +46,15 @@ public class CheckNodeInCompartment implements IDiagramChecker {

private boolean isRevealed;

private boolean isHidden;

public CheckNodeInCompartment(DiagramDescriptionIdProvider diagramDescriptionIdProvider, DiagramComparator diagramComparator) {
this.diagramDescriptionIdProvider = diagramDescriptionIdProvider;
this.diagramComparator = diagramComparator;
}

public CheckNodeInCompartment withParentLabel(String expectedParentLabel) {
this.parentLabel = expectedParentLabel;
public CheckNodeInCompartment withTargetObjectId(String expectedTargetObjectId) {
this.targetObjectId = expectedTargetObjectId;
return this;
}

Expand All @@ -76,11 +78,16 @@ public CheckNodeInCompartment isRevealed() {
return this;
}

public CheckNodeInCompartment isHidden() {
this.isHidden = true;
return this;
}

@Override
public void check(Diagram previousDiagram, Diagram newDiagram) {
List<Node> newNodes = this.diagramComparator.newNodes(previousDiagram, newDiagram);
DiagramNavigator diagramNavigator = new DiagramNavigator(newDiagram);
var compartmentNode = diagramNavigator.nodeWithTargetObjectLabel(this.parentLabel)
var compartmentNode = diagramNavigator.nodeWithTargetObjectId(this.targetObjectId)
.childNodeWithLabel(this.compartmentName)
.getNode();
assertThat(compartmentNode.getChildNodes()).anySatisfy(childNode -> {
Expand All @@ -93,5 +100,8 @@ public void check(Diagram previousDiagram, Diagram newDiagram) {
if (this.isRevealed) {
assertThat(compartmentNode.getState()).isEqualTo(ViewModifier.Normal);
}
if (this.isHidden) {
assertThat(compartmentNode.getState()).isEqualTo(ViewModifier.Hidden);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public DiagramCheckerService(DiagramComparator diagramComparator, IDescriptionNa
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param parentLabel
* the label of the parent node
* @param parentTargetObjectId
* the parent target object ID
* @param childEClass
* the EClass of the expected child node
* @param compartmentCount
Expand All @@ -65,7 +65,7 @@ public DiagramCheckerService(DiagramComparator diagramComparator, IDescriptionNa
* the expected total number of new border nodes
* @return a consumer that performs the graphical check
*/
public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentLabel, EClass childEClass,
public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentTargetObjectId, EClass childEClass,
int compartmentCount, int newNodesCount, int newBorderNodesCount) {
return assertRefreshedDiagramThat(newDiagram -> {
new CheckDiagramElementCount(this.diagramComparator)
Expand All @@ -76,7 +76,7 @@ public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previ

String newNodeDescriptionName = this.descriptionNameGenerator.getNodeName(childEClass);
new CheckChildNode(diagramDescriptionIdProvider, this.diagramComparator)
.withParentLabel(parentLabel)
.withParentTargetObjectId(parentTargetObjectId)
.hasNodeDescriptionName(newNodeDescriptionName)
.hasCompartmentCount(compartmentCount)
.check(previousDiagram.get(), newDiagram);
Expand All @@ -90,8 +90,8 @@ public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previ
* the reference to the previous diagram state
* @param diagramDescriptionIdProvider
* the provider for diagram description IDs
* @param parentLabel
* the label of the parent node
* @param parentTargetObjectId
* the parent target object ID
* @param parentEClass
* the EClass of the parent node
* @param containmentReference
Expand All @@ -102,7 +102,7 @@ public Consumer<Object> childNodeGraphicalChecker(AtomicReference<Diagram> previ
* check only new nodes and edges that are visible on the diagram
* @return a consumer that performs the graphical check
*/
public Consumer<Object> compartmentNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentLabel,
public Consumer<Object> compartmentNodeGraphicalChecker(AtomicReference<Diagram> previousDiagram, DiagramDescriptionIdProvider diagramDescriptionIdProvider, String parentTargetObjectId,
EClass parentEClass, EReference containmentReference, String compartmentName, boolean onlyNewVisibleNodesAndEdges) {
return assertRefreshedDiagramThat(newDiagram -> {
new CheckDiagramElementCount(this.diagramComparator)
Expand All @@ -112,7 +112,7 @@ public Consumer<Object> compartmentNodeGraphicalChecker(AtomicReference<Diagram>

String newNodeDescriptionName = this.descriptionNameGenerator.getCompartmentItemName(parentEClass, containmentReference);
new CheckNodeInCompartment(diagramDescriptionIdProvider, this.diagramComparator)
.withParentLabel(parentLabel)
.withTargetObjectId(parentTargetObjectId)
.withCompartmentName(compartmentName)
.hasNodeDescriptionName(newNodeDescriptionName)
.hasCompartmentCount(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.sirius.components.view.emf.diagram.IDiagramIdProvider;
import org.eclipse.sirius.web.tests.services.api.IGivenInitialServerState;
import org.eclipse.syson.AbstractIntegrationTests;
import org.eclipse.syson.GivenSysONServer;
import org.eclipse.syson.application.controllers.diagrams.testers.ToolTester;
import org.eclipse.syson.application.data.ActionTransitionUsagesProjectData;
import org.eclipse.syson.services.diagrams.DiagramDescriptionIdProvider;
Expand All @@ -47,8 +48,6 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.jdbc.SqlConfig;
import org.springframework.test.context.transaction.TestTransaction;
import org.springframework.transaction.annotation.Transactional;

Expand Down Expand Up @@ -114,10 +113,8 @@ public void tearDown() {
}
}

@Sql(scripts = { ActionTransitionUsagesProjectData.SCRIPT_PATH }, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD,
config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@Sql(scripts = { "/scripts/cleanup.sql" }, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED))
@DisplayName("GIVEN a model with TransitionUsage ending on 'start' or 'done' ActionUsage, WHEN adding existing nested element on the parent of the TransitionUsage, THEN the 'start' and 'done' node should be added to the ActionFlow compartment.")
@GivenSysONServer({ ActionTransitionUsagesProjectData.SCRIPT_PATH })
@Test
public void addExistingNestedElementsOnActionUsage() {
TestTransaction.flagForCommit();
Expand All @@ -126,7 +123,7 @@ public void addExistingNestedElementsOnActionUsage() {
"Add existing nested elements");
assertThat(toolId).as("The tool 'Add existing elements' should exist on Action Usage").isNotNull();

this.verifier.then(() -> this.nodeCreationTester.invokeTool(ActionTransitionUsagesProjectData.EDITING_CONTEXT_ID, this.diagram, "a0", toolId));
this.verifier.then(() -> this.nodeCreationTester.invokeTool(ActionTransitionUsagesProjectData.EDITING_CONTEXT_ID, this.diagram, ActionTransitionUsagesProjectData.SemanticIds.A0_ID, toolId));

Consumer<DiagramRefreshedEventPayload> updatedDiagramConsumer = payload -> Optional.of(payload)
.map(DiagramRefreshedEventPayload::diagram)
Expand Down
Loading
Loading