Skip to content
Open
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 @@ -40,6 +40,7 @@ In any case, it is strongly recommended to back up your data before proceeding w
- https://github.com/eclipse-syson/syson/issues/2370[#2370] [diagrams] Add support of `ItemUsage` inheritance in _items_ compartments of `PortUsage` and `PortDefinition` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2372[#2372] [diagrams] Add support of assume constraint inheritance in _assume constraints_ compartments of `RequirementUsage` and `RequirementDefinition` graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2375[#2375] [diagrams] Add support of require constraints inheritance in _require constraints_ compartments of `RequirementUsage`, `RequirementDefinition` and subtypes graphical nodes.
- https://github.com/eclipse-syson/syson/issues/2380[#2380] [diagrams] Add support of `SatisfyRequirementUsage` inheritance in _satisfy requirements_ compartment of `PartUsage` and `PartDefinition` graphical nodes.

== v2026.7.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,55 @@ public void checkConcernUsageRequireConstraintsInheritanceWithReferenceSubsettin
.run();
}

@DisplayName("GIVEN a base PartDefinition with a satisfy requirement, WHEN a PartDefinition is subclassifying the base PartDefinition, THEN the PartDefinition satisfy requirements are inherited from the base PartDefinition")
@Test
public void checkPartDefinitionSatisfyRequirementsInheritanceWithSubclassification() {
var eClass = SysmlPackage.eINSTANCE.getPartDefinition();
new ElementSpecializationInheritanceTestRunner()
.baseElementToInheritFromEClass(eClass)
.baseElementToInheritFromNodeId(GeneralViewWithTopNodesTestProjectData.GraphicalIds.PART_DEFINITION_ID)
.elementToInheritCreationToolName("New Satisfy Requirement")
.withEdgeExpected()
.withSelectedElementId("")
.elementToInheritExpectedListItemLabelText("satisfyRequirement1")
.compartmentName("satisfy requirements")
.elementThatInheritFromBaseElementCreationToolName("New Part Definition")
.elementThatInheritFromBaseElementEClass(eClass)
.specializationToolName("New Subclassification")
.run();
}

private ElementSpecializationInheritanceTestRunner getPartUsageSatisfyRequirementsInheritanceTestRunner() {
var eClass = SysmlPackage.eINSTANCE.getPartUsage();
return new ElementSpecializationInheritanceTestRunner()
.baseElementToInheritFromEClass(eClass)
.baseElementToInheritFromNodeId(GeneralViewWithTopNodesTestProjectData.GraphicalIds.PART_USAGE_ID)
.elementToInheritCreationToolName("New Satisfy Requirement")
.withEdgeExpected()
.withSelectedElementId("")
.withExtraEdgesExpected(1)
.elementToInheritExpectedListItemLabelText("satisfyRequirement1")
.compartmentName("satisfy requirements")
.elementThatInheritFromBaseElementCreationToolName("New Part")
.elementThatInheritFromBaseElementEClass(eClass);
}

@DisplayName("GIVEN a base PartUsage with a satisfy requirement, WHEN a PartUsage is subsetting the base PartUsage, THEN the PartUsage satisfy requirements are inherited from the base PartUsage")
@Test
public void checkRequirementUsageSatisfyRequirementsInheritanceWithSubsetting() {
this.getPartUsageSatisfyRequirementsInheritanceTestRunner()
.specializationToolName("New Subsetting")
.run();
}

@DisplayName("GIVEN a base PartUsage with a satisfy requirement, WHEN a PartUsage is subsetting by reference the base PartUsage, THEN the PartUsage satisfy requirements are inherited from the base PartUsage")
@Test
public void checkRequirementUsageSatisfyRequirementsInheritanceWithReferenceSubsetting() {
this.getPartUsageSatisfyRequirementsInheritanceTestRunner()
.specializationToolName("New Reference Subsetting")
.run();
}

/**
* This test runner verifies that creating a specializing relationship create inherited elements.
*
Expand Down Expand Up @@ -724,6 +773,14 @@ private final class ElementSpecializationInheritanceTestRunner {
*/
private boolean withEdgeExpected;

/**
* Additional edges could be created when the {@code elementToInheritCreationToolName} tool on {@code baseElementToInheritFromNodeId} is performed.
* <p>
* Satisfy edge for instance, from a {@code PartUsage} to a nested {@code SatisfyRequiremenUsage}.
* </p>
*/
private int withExtraEdgesExpected;

/**
* The selected element required for the creation tool applied on the base element.
*/
Expand Down Expand Up @@ -779,6 +836,11 @@ public ElementSpecializationInheritanceTestRunner withEdgeExpected() {
return this;
}

public ElementSpecializationInheritanceTestRunner withExtraEdgesExpected(int extraEdgesExpected) {
this.withExtraEdgesExpected = extraEdgesExpected;
return this;
}

public ElementSpecializationInheritanceTestRunner withSelectedElementId(String selectedElementId) {
this.selectedElementId = Optional.of(selectedElementId);
return this;
Expand Down Expand Up @@ -863,6 +925,9 @@ public void run() {
if (this.selectedElementId.isPresent() && !this.selectedElementId.get().isBlank()) {
expectEdgeCount = 2;
}
if (this.withExtraEdgesExpected > 0) {
expectEdgeCount += this.withExtraEdgesExpected;
}
}
new CheckDiagramElementCount(GVCompartmentItemInheritanceTests.this.diagramComparator)
.hasNewBorderNodeCount(expectedBorderNodeCount) // The element is created and sometimes can be represented as a border node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.syson.sysml.ReferenceUsage;
import org.eclipse.syson.sysml.RequirementConstraintKind;
import org.eclipse.syson.sysml.RequirementConstraintMembership;
import org.eclipse.syson.sysml.SatisfyRequirementUsage;
import org.eclipse.syson.sysml.StateUsage;
import org.eclipse.syson.sysml.Step;
import org.eclipse.syson.sysml.SysmlPackage;
Expand Down Expand Up @@ -185,6 +186,18 @@ public Boolean caseReferenceUsage(ReferenceUsage object) {
return eType.equals(eClass) || (eType instanceof EClass eTypeEClass && eTypeEClass.isSuperTypeOf(eClass));
}

/**
* Filters inherited satisfy requirement usages against the targeted compartment.
*
* @param object
* the inherited satisfy requirement usage.
* @return {@code true} when the satisfy requirement belongs to the requested compartment
*/
@Override
public Boolean caseSatisfyRequirementUsage(SatisfyRequirementUsage object) {
return SysmlPackage.eINSTANCE.getUsage_NestedRequirement().equals(this.eReference) || SysmlPackage.eINSTANCE.getDefinition_OwnedRequirement().equals(this.eReference);
}

/**
* Indicates whether the feature should be evaluated as a behavior or step parameter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void link(DiagramDescription diagramDescription, IViewDiagramElementFinde
cache.getNodeDescription(this.getDescriptionNameGenerator().getCompartmentName(this.eClass, this.eReference) + COMPARTMENT_NAME).ifPresent(nodeDescription -> {
cache.getNodeDescription(this.getDescriptionNameGenerator().getCompartmentItemName(this.eClass, this.eReference) + SatisfyRequirementCompartmentItemNodeDescription.COMPARTMENT_ITEM_NAME)
.ifPresent(itemNodeDesc -> nodeDescription.getChildrenDescriptions().add(itemNodeDesc));
cache.getNodeDescription(this.getDescriptionNameGenerator().getInheritedCompartmentItemName(this.eClass, this.eReference) + SatisfyRequirementCompartmentItemNodeDescription.COMPARTMENT_ITEM_NAME).ifPresent(nodeDescription.getChildrenDescriptions()::add);
nodeDescription.setPalette(this.createCompartmentPalette(cache));
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 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
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/

package org.eclipse.syson.diagram.common.view.nodes;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.sirius.components.view.builder.providers.IColorProvider;
import org.eclipse.sirius.components.view.diagram.NodeDescription;
import org.eclipse.syson.sysml.SysmlPackage;
import org.eclipse.syson.util.AQLConstants;
import org.eclipse.syson.util.IDescriptionNameGenerator;
import org.eclipse.syson.util.SysMLMetamodelHelper;

/**
* The inherited satisfy requirements compartment list item node description provider.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really needed?

@jerome-obeo jerome-obeo Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This time, it is necessary, because the reference to hold satisfy requirement in a PartUsage is SysmlPackage.eINSTANCE.getUsage_NestedRequirement() whereas the compartment item node description has a domain type set to SysmlPackage.eINSTANCE.getSatisfyRequirementUsage() and not SysmlPackage.eINSTANCE.getRequirementUsage().
Same explanation for PartDefinition.

*
* @author Jerome Gout
*/
public class SatisfyRequirementInheritedCompartmentItemNodeDescription extends InheritedCompartmentItemNodeDescriptionProvider {

public SatisfyRequirementInheritedCompartmentItemNodeDescription(EClass eClass, EReference eReference, IColorProvider colorProvider, IDescriptionNameGenerator descriptionNameGenerator) {
super(eClass, eReference, colorProvider, descriptionNameGenerator);
}

@Override
public NodeDescription create() {
NodeDescription nd = super.create();
var qualifiedName = SysMLMetamodelHelper.buildQualifiedName(SysmlPackage.eINSTANCE.getSatisfyRequirementUsage());
nd.setName(this.descriptionNameGenerator.getInheritedCompartmentItemName(this.eClass, this.eReference) + SatisfyRequirementCompartmentItemNodeDescription.COMPARTMENT_ITEM_NAME);
nd.setDomainType(qualifiedName);
nd.setPreconditionExpression(AQLConstants.AQL_SELF + ".oclIsTypeOf(" + qualifiedName + ")");
return nd;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.eclipse.syson.diagram.common.view.nodes.RequireConstraintCompartmentNodeDescription;
import org.eclipse.syson.diagram.common.view.nodes.SatisfyRequirementCompartmentItemNodeDescription;
import org.eclipse.syson.diagram.common.view.nodes.SatisfyRequirementCompartmentNodeDescription;
import org.eclipse.syson.diagram.common.view.nodes.SatisfyRequirementInheritedCompartmentItemNodeDescription;
import org.eclipse.syson.diagram.common.view.nodes.StartActionNodeDescriptionProvider;
import org.eclipse.syson.diagram.common.view.nodes.StartStateNodeDescriptionProvider;
import org.eclipse.syson.diagram.common.view.nodes.StateTransitionCompartmentNodeDescriptionProvider;
Expand Down Expand Up @@ -745,6 +746,8 @@ private List<IDiagramElementDescriptionProvider<?>> createSatisfyRequirementsCom
colorProvider, this.getDescriptionNameGenerator()));
compartmentNodeDescriptionProviders.add(new SatisfyRequirementCompartmentItemNodeDescription(SysmlPackage.eINSTANCE.getPartUsage(), SysmlPackage.eINSTANCE.getUsage_NestedRequirement(),
colorProvider, this.getDescriptionNameGenerator()));
compartmentNodeDescriptionProviders.add(new SatisfyRequirementInheritedCompartmentItemNodeDescription(SysmlPackage.eINSTANCE.getPartUsage(), SysmlPackage.eINSTANCE.getUsage_NestedRequirement(), colorProvider, this.getDescriptionNameGenerator()));
compartmentNodeDescriptionProviders.add(new SatisfyRequirementInheritedCompartmentItemNodeDescription(SysmlPackage.eINSTANCE.getPartDefinition(), SysmlPackage.eINSTANCE.getDefinition_OwnedRequirement(), colorProvider, this.getDescriptionNameGenerator()));
return compartmentNodeDescriptionProviders;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
** Add support of `ItemUsage` inheritance in _items_ compartments of `PortUsage` and `PortDefinition` graphical nodes.

** Add support of assume constraint inheritance in _assume constraints_ compartments of `RequirementUsage` and `RequirementDefinition` graphical nodes.

** Add support of require constraints inheritance in _require constraints_ compartments of `RequirementUsage`, `RequirementDefinition` and subtypes graphical nodes.

** Add support of `SatisfyRequirementUsage` inheritance in _satisfy requirements_ compartment of `PartUsage` and `PartDefinition` graphical nodes.

* In textual import/export:

== Bug fixes
Expand Down
Loading