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 @@ -42,6 +42,7 @@ In any case, it is strongly recommended to back up your data before proceeding w
- https://github.com/eclipse-syson/syson/issues/2399[#2399] [details] Fix the _Typed by_ selection dialog so a `Usage` can only be typed by its corresponding `Definition` kind.
- https://github.com/eclipse-syson/syson/issues/2407[#2407] [diagrams] Fix the nested composition edge tool label on `ConcernUsage` graphical nodes in _General View_ diagrams.
It is now _Become nested Concern_ instead of _Become nested Requirement_.
- https://github.com/eclipse-syson/syson/issues/2369[#2369] [diagrams] Remove the _New Subclassification_ edge tool from `EnumerationDefinition` graphical nodes, which cannot subclassify another `EnumerationDefinition`.
- https://github.com/eclipse-syson/syson/issues/2388[#2388] [search] Fix concurrent creation of SysML model search indices.
- https://github.com/eclipse-syson/syson/issues/2397[#2397] [metamodel] Fix the resolution of the ends of a connector so the ends declared with the `end` keyword inside a connection body are taken into account.
Following KerML, where `endFeature` is defined as the owned features having `isEnd = true`, the ends owned through a plain `FeatureMembership` are now collected as well, and not only those owned through an `EndFeatureMembership`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ public List<EdgeTool> caseDefinition(Definition object) {
addAttributeAsNestedOfDefinition.forEach(nodeDesc -> edgeTools.add(this.edgeToolService.createAddAsNestedEdgeTool(nodeDesc)));

edgeTools.add(this.edgeToolService.createDependencyEdgeTool(this.allNodeDescriptions));
edgeTools.add(this.edgeToolService.createSubclassificationEdgeTool(List.of(this.nodeDescription)));
// SysML forbids an EnumerationDefinition from subclassifying another EnumerationDefinition.
if (!SysmlPackage.eINSTANCE.getEnumerationDefinition().isInstance(object)) {
edgeTools.add(this.edgeToolService.createSubclassificationEdgeTool(List.of(this.nodeDescription)));
}
return edgeTools;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*******************************************************************************
* 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.services;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.sirius.components.view.builder.generated.diagram.DiagramBuilders;
import org.eclipse.sirius.components.view.diagram.EdgeTool;
import org.eclipse.sirius.components.view.diagram.NodeDescription;
import org.eclipse.syson.sysml.SysmlPackage;
import org.eclipse.syson.util.DescriptionNameGenerator;
import org.eclipse.syson.util.SysMLMetamodelHelper;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

/**
* Tests for {@link ViewEdgeToolSwitch}.
*
* @author arichard
*/
public class ViewEdgeToolSwitchTest {

private final DescriptionNameGenerator descriptionNameGenerator = new DescriptionNameGenerator("test");

@Test
@DisplayName("GIVEN an EnumerationDefinition, WHEN its edge tools are created, THEN the New Subclassification tool is not available")
void enumerationDefinitionDoesNotProvideSubclassificationEdgeTool() {
var nodeDescription = this.createNodeDescription(SysmlPackage.eINSTANCE.getEnumerationDefinition());

var edgeTools = this.createEdgeToolSwitch(nodeDescription).doSwitch(SysmlPackage.eINSTANCE.getEnumerationDefinition());

assertThat(edgeTools)
.extracting(EdgeTool::getName)
.doesNotContain(this.descriptionNameGenerator.getCreationToolName(SysmlPackage.eINSTANCE.getSubclassification()));
}

@Test
@DisplayName("GIVEN a PartDefinition, WHEN its edge tools are created, THEN the New Subclassification tool is available")
void partDefinitionProvidesSubclassificationEdgeTool() {
var nodeDescription = this.createNodeDescription(SysmlPackage.eINSTANCE.getPartDefinition());

var edgeTools = this.createEdgeToolSwitch(nodeDescription).doSwitch(SysmlPackage.eINSTANCE.getPartDefinition());

assertThat(edgeTools)
.extracting(EdgeTool::getName)
.contains(this.descriptionNameGenerator.getCreationToolName(SysmlPackage.eINSTANCE.getSubclassification()));
}

/**
* Creates the edge tool switch to test with the given node description.
*
* @param nodeDescription
* the node description represented by the switch
* @return the configured edge tool switch
*/
private ViewEdgeToolSwitch createEdgeToolSwitch(NodeDescription nodeDescription) {
return new ViewEdgeToolSwitch(nodeDescription, List.of(nodeDescription), this.descriptionNameGenerator);
}

/**
* Creates a minimal node description for an EClass.
*
* @param eClass
* the EClass represented by the node description
* @return the node description for the given EClass
*/
private NodeDescription createNodeDescription(EClass eClass) {
return new DiagramBuilders().newNodeDescription()
.name(eClass.getName())
.domainType(SysMLMetamodelHelper.buildQualifiedName(eClass))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ It is now _Become nested Concern_ instead of _Become nested Requirement_.
** Fix the ends of the connections whose ends are declared with the `end` keyword inside the body of the connection, which were not resolved.
Those connections were missing their source and their target, and were therefore never displayed as edges.
** Replace the name of the _New Perform action_ tool to _New Perform Action_ to be consistent with other tools.
** Remove the _New Subclassification_ edge tool from `EnumerationDefinition` graphical nodes, which cannot subclassify another `EnumerationDefinition`.

* In all views:

Expand Down
Loading