Skip to content

Commit 3cd1ff8

Browse files
committed
[1318] Fix issue with adding values to multi-valued references
Bug: #1318 Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
1 parent ed653cc commit 3cd1ff8

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ When creating a new `Perform Action` referencing an existing `Action`, all compa
4242
- https://github.com/eclipse-syson/syson/issues/1324[#1324] [details] Fix an issue that prevents ending up with a `null` reference in the reference widget.
4343
- https://github.com/eclipse-syson/syson/issues/1090[#1090] [import] Fix the textual import of `MultiplicityRange` with lower and upper bounds.
4444
The import now correctly creates a `MultiplicityRange` containing `LiteralInteger` elements for integer bounds, and `FeatureReferenceExpression` elements for feature bounds.
45+
- https://github.com/eclipse-syson/syson/issues/1318[#1318] [details] Fix an issue that prevents adding a new value to a multi-valued reference in the reference widget.
4546

4647
=== Improvements
4748

backend/application/syson-application-configuration/src/main/java/org/eclipse/syson/application/services/DetailsViewService.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ public boolean setNewValue(Element element, EStructuralFeature eStructuralFeatur
126126
}
127127
if (eStructuralFeature.getEType() instanceof EEnum && eStructuralFeature.isUnsettable() && !(valueToSet instanceof Enumerator)) {
128128
element.eUnset(eStructuralFeature);
129+
} else if (eStructuralFeature.isMany() && newValue instanceof List<?> newListValue) {
130+
((List<Object>) element.eGet(eStructuralFeature)).addAll(newListValue);
129131
} else {
130132
if (eStructuralFeature.getEType() instanceof EDataType eDataType && newValue instanceof String stringValue) {
131133
valueToSet = EcoreUtil.createFromString(eDataType, stringValue);
@@ -185,9 +187,9 @@ public boolean isReadOnly(Element element) {
185187
* and isReadOnly(EStructuralFeature).
186188
*
187189
* @param element
188-
* The {@link Element} to check
190+
* The {@link Element} to check
189191
* @param eStructuralFeature
190-
* The {@link EStructuralFeature} to check
192+
* The {@link EStructuralFeature} to check
191193
* @return
192194
*/
193195
public boolean isReadOnly(Element element, EStructuralFeature eStructuralFeature) {
@@ -227,11 +229,7 @@ public boolean isReadOnlyStringAttribute(Element element, EStructuralFeature eSt
227229

228230
public boolean isMultilineStringAttribute(Element element, EStructuralFeature eStructuralFeature) {
229231
boolean isMultiline = false;
230-
if (this.isBodyField(eStructuralFeature)) {
231-
isMultiline = true;
232-
} else {
233-
isMultiline = false;
234-
}
232+
isMultiline = this.isBodyField(eStructuralFeature);
235233
return isMultiline;
236234
}
237235

@@ -343,9 +341,9 @@ public Element handleReferenceWidgetNewValue(Element element, String eStructural
343341
* feature.
344342
*
345343
* @param feature
346-
* the current {@link Feature}.
344+
* the current {@link Feature}.
347345
* @param newValue
348-
* the newValue to set.
346+
* the newValue to set.
349347
* @return the real element (i.e. a FeatureTyping) that holds the property to set.
350348
*/
351349
public Element handleFeatureTypingNewValue(Feature feature, Object newValue) {
@@ -369,7 +367,7 @@ public Element handleFeatureTypingNewValue(Feature feature, Object newValue) {
369367
* Get the real owner of the reference widget for the extra property "Typed by".
370368
*
371369
* @param element
372-
* the current {@link Element}.
370+
* the current {@link Element}.
373371
* @return the real element that holds the property.
374372
*/
375373
public Element getFeatureTypingOwnerExpression(Element element) {
@@ -437,7 +435,6 @@ public boolean setTransitionSourceParameter(TransitionUsage transitionUsage, Ele
437435
// Update transition source
438436
transitionUsage.getOwnedMembership().stream()
439437
.filter(Objects::nonNull)
440-
.map(Membership.class::cast)
441438
.findFirst()
442439
.ifPresent(mem -> mem.setMemberElement(au));
443440
// Update succession source
@@ -583,7 +580,7 @@ public Element setNewDocumentationValue(Element self, String newValue) {
583580
* Returns the element that owns the visibility feature of the given element.
584581
*
585582
* @param self
586-
* An element for which the visibility owner is being searched.
583+
* An element for which the visibility owner is being searched.
587584
* @return the element that owns the visibility feature of the given element
588585
*/
589586
public Element getVisibilityPropertyOwner(Element self) {
@@ -597,7 +594,7 @@ public Element getVisibilityPropertyOwner(Element self) {
597594
* Returns the enumeration literals for the visibility feature of the given element.
598595
*
599596
* @param self
600-
* An element for which the list of visibility literals are being searched.
597+
* An element for which the list of visibility literals are being searched.
601598
* @return the enumeration literals for the visibility feature of the given element.
602599
*/
603600
public List<EEnumLiteral> getVisibilityEnumLiterals(Element self) {
@@ -612,7 +609,7 @@ public List<EEnumLiteral> getVisibilityEnumLiterals(Element self) {
612609
* Returns the visibility value of the given element.
613610
*
614611
* @param self
615-
* An element for which the list of visibility literals are being searched.
612+
* An element for which the list of visibility literals are being searched.
616613
* @return the current value of the visibility feature of the given element.
617614
*/
618615
public EEnumLiteral getVisibilityValue(Element self) {
@@ -627,11 +624,11 @@ public EEnumLiteral getVisibilityValue(Element self) {
627624
* Sets the visibility value of the given element.
628625
*
629626
* @param self
630-
* An element for which the list of visibility literals are being searched.
627+
* An element for which the list of visibility literals are being searched.
631628
* @param newValue
632-
* the value to set.
629+
* the value to set.
633630
* @return <code>true</code> if the visibility feature of the given element has been properly set and
634-
* <code>false</code> otherwise.
631+
* <code>false</code> otherwise.
635632
*/
636633
public boolean setVisibilityValue(Element self, Object newValue) {
637634
boolean result = false;
@@ -668,7 +665,7 @@ private void handleImplied(Element element, EStructuralFeature eStructuralFeatur
668665
* guarantee that it is well formed after its call.
669666
*
670667
* @param aau
671-
* an {@link AcceptActionUsage}
668+
* an {@link AcceptActionUsage}
672669
*/
673670
private void checkAndRepairAcceptActionUsageStructure(AcceptActionUsage aau) {
674671
this.checkAndRepairAcceptActionUsagePayload(aau);

doc/content/modules/user-manual/pages/release-notes/2025.6.0.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ image::view-usage-nodes.png[ViewUsage nodes, width=65%,height=65%]
5252

5353
image::view-usage-graphical-contents.png[ViewUsage graphical contents, width=65%,height=65%]
5454

55+
- In the _Details_ view, fix an issue that prevents adding a new value to a multi-valued reference on a reference widget.
5556

5657
== Improvements
5758

0 commit comments

Comments
 (0)