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 @@ -45,6 +45,7 @@ For example `ViewUsage` elements are no longer rendered in _parts_ compartments.
- https://github.com/eclipse-syson/syson/issues/2026[#2026] [explorer] Fix an issue where creating a new model using the _Create a new model_ action in the _Explorer_ view was not adding the ".sysml" extension to the model name.
- https://github.com/eclipse-syson/syson/issues/1998[#1998] [metamodel] Missing implicit TypeFeaturing.
- https://github.com/eclipse-syson/syson/issues/2023[#2023] [diagrans] On diagrams, `ConnectionDefinition` graphical nodes are now correctly labelled as `«connection def»`.
- https://github.com/eclipse-syson/syson/issues/2034[#2034] [import] Fix textual import to be able to annotate `Relationships`.

=== Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.eclipse.syson.sysml.LiteralRational;
import org.eclipse.syson.sysml.LiteralString;
import org.eclipse.syson.sysml.Membership;
import org.eclipse.syson.sysml.MembershipExpose;
import org.eclipse.syson.sysml.MetadataAccessExpression;
import org.eclipse.syson.sysml.MetadataDefinition;
import org.eclipse.syson.sysml.MetadataUsage;
Expand Down Expand Up @@ -181,6 +182,29 @@ public void unnamedRedefinedReferenceFeature() throws IOException {
}).check(input);
}

@DisplayName("GIVEN an MetadataUsage annotating a ExposeMembership, WHEN importing the model, THEN the Annotation holding the MetadataUsage should be stored in ownedRelationships.")
@Test
public void metadataUsageOnExposeMembership() throws IOException {
var input = """
package Test {
metadata def MyAnnotation;

item def MyItem;

view MyView {
expose MyItem { @MyAnnotation; }
}

item def MyItem2;
}
""";
this.checker.checkImportedModel(resource -> {
List<MembershipExpose> membershipExposes = EMFUtils.allContainedObjectOfType(resource, MembershipExpose.class).toList();
assertThat(membershipExposes).hasSize(1);
assertThat(membershipExposes.get(0).getOwnedRelationship()).hasSize(1);
}).check(input);
}

@DisplayName("GIVEN a redefinition of a part with the same name as the redefined part, WHEN importing the model, THEN the redefintion's redefined feature is correctly resolved.")
@Test
public void namedRedefinedReferenceFeature() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 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 All @@ -23,6 +23,7 @@
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.syson.sysml.Relationship;
import org.eclipse.syson.sysml.SysmlPackage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -73,7 +74,11 @@ public Optional<EReference> getContainmentReference(EObject owner, EClass target
*/

if (references.equals(REL_CONTAINEMTS_REF)) {
if (owner.eContainingFeature() == SysmlPackage.eINSTANCE.getRelationship_OwnedRelatedElement()) {
// Case where the previously described pattern is not correct.
// Here we have a Relationship holding a Relationship in "ownedRelationship"
if (owner instanceof Relationship && SysmlPackage.eINSTANCE.getAnnotation().isSuperTypeOf(targetEClass)) {
ref = Optional.of(SysmlPackage.eINSTANCE.getElement_OwnedRelationship());
} else if (owner.eContainingFeature() == SysmlPackage.eINSTANCE.getRelationship_OwnedRelatedElement()) {
ref = Optional.of(SysmlPackage.eINSTANCE.getElement_OwnedRelationship());
} else {
ref = Optional.of(SysmlPackage.eINSTANCE.getRelationship_OwnedRelatedElement());
Expand Down
17 changes: 17 additions & 0 deletions doc/content/modules/user-manual/pages/release-notes/2026.3.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ part system {
}
```

** Fix the textual import so `Relationships` can be annotated.
Such as in :

```
package Test {
metadata def MyAnnotation;

item def MyItem;

view MyView {
expose MyItem { @MyAnnotation; } // The MembershipExpose is annotated with MyAnnotation
}

item def MyItem2;
}
```

* In _Explorer_ view:

** Fix an issue where creating a new model using the _Create a new model_ action in the _Explorer_ view was not adding the ".sysml" extension to the model name.
Expand Down
Loading