Skip to content

Commit a2b3e62

Browse files
committed
[2049] Fix direct edit on "end" element
Bug: #2049 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 1bbf9ba commit a2b3e62

6 files changed

Lines changed: 29 additions & 63 deletions

File tree

CHANGELOG.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ For example `ViewUsage` elements are no longer rendered in _parts_ compartments.
9393
It now follows the same rule than all other graphical node: if a compartment that can display the new `PerformActionUsage` is displayed, then the new `PerformActionUsage` is displayed in this compartment, otherwise it is displayed in the diagram background.
9494
- https://github.com/eclipse-syson/syson/issues/2046[#2046] [diagrams] Fix an issue where the creation of a `RequirementUsage` from a `Package` graphical node was not revealing it.
9595
- https://github.com/eclipse-syson/syson/issues/1990[#1990] [diagrams] Fix the `EnumerationDefinition` graphical node compartment name to follow the SysMLv2 specification.
96+
- https://github.com/eclipse-syson/syson/issues/2049[#2049] [diagrams] Fix the direct edit and the display of `ends` graphical node elements inside the _ends_ compartment.
97+
Now the _end_ keyword is not displayed anymore in the label of these graphical nodes, and the direct edit only allows to edit the name of the end instead of the full label which was confusing for users.
98+
9699

97100
=== Improvements
98101

backend/services/syson-diagram-services/src/main/java/org/eclipse/syson/diagram/services/DiagramQueryLabelService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.eclipse.syson.sysml.ActionUsage;
2828
import org.eclipse.syson.sysml.AttributeUsage;
2929
import org.eclipse.syson.sysml.Comment;
30+
import org.eclipse.syson.sysml.ConnectionDefinition;
3031
import org.eclipse.syson.sysml.ConnectionUsage;
3132
import org.eclipse.syson.sysml.ConstraintUsage;
3233
import org.eclipse.syson.sysml.Definition;
@@ -457,13 +458,13 @@ public String getUsageListItemPrefix(Usage usage) {
457458
if (usage.isIsVariation()) {
458459
label.append(LabelConstants.VARIATION + LabelConstants.SPACE);
459460
}
460-
if (usage.isIsConstant()) {
461+
if (usage.isIsConstant() && !(usage.getOwner() instanceof ConnectionDefinition)) {
461462
label.append(LabelConstants.CONSTANT + LabelConstants.SPACE);
462463
}
463464
if (usage.isIsDerived()) {
464465
label.append(LabelConstants.DERIVED + LabelConstants.SPACE);
465466
}
466-
if (usage.isIsEnd()) {
467+
if (usage.isIsEnd() && !(usage.getOwner() instanceof ConnectionDefinition)) {
467468
label.append(LabelConstants.END + LabelConstants.SPACE);
468469
}
469470
this.getReferenceUsagePrefix(usage, label);
@@ -792,7 +793,7 @@ private String getShortNameLabel(Element element) {
792793
* otherwise.
793794
*/
794795
private void getReferenceUsagePrefix(Usage usage, StringBuilder label) {
795-
if (usage.isIsReference() && !(usage instanceof AttributeUsage)) {
796+
if (usage.isIsReference() && !(usage instanceof AttributeUsage) && !(usage.getOwner() instanceof ConnectionDefinition)) {
796797
// AttributeUsage are always referential, so no need to add the ref keyword
797798
label.append(LabelConstants.REF + LabelConstants.SPACE);
798799
}

backend/services/syson-services/src/main/java/org/eclipse/syson/services/DiagramDirectEditListener.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,6 @@ public void exitListItemExpression(ListItemExpressionContext ctx) {
226226
}
227227
}
228228
this.handleMissingDirectionPrefixExpression(ctx);
229-
this.handleMissingAbstractPrefixExpression(ctx);
230-
this.handleMissingDerivedPrefixExpression(ctx);
231-
this.handleMissingEndPrefixExpression(ctx);
232-
this.handleMissingVariationPrefixExpression(ctx);
233-
this.handleMissingConstantPrefixExpression(ctx);
234-
this.handleMissingReferenceExpression(ctx);
235229
this.handleMissingMultiplicityExpression(ctx);
236230
this.handleMissingOrderedMultiplicityExpression(ctx);
237231
this.handleMissingNonuniqueMultiplicityExpression(ctx);
@@ -281,10 +275,6 @@ public void exitAbstractPrefixExpression(AbstractPrefixExpressionContext ctx) {
281275
if (this.element instanceof Usage usage) {
282276
if (ctx != null) {
283277
usage.setIsAbstract(true);
284-
} else {
285-
usage.setIsAbstract(false);
286-
// A variation is always abstract
287-
usage.setIsVariation(false);
288278
}
289279
}
290280
super.exitAbstractPrefixExpression(ctx);
@@ -305,8 +295,6 @@ public void exitDerivedPrefixExpression(DerivedPrefixExpressionContext ctx) {
305295
if (this.element instanceof Usage usage) {
306296
if (ctx != null) {
307297
usage.setIsDerived(true);
308-
} else {
309-
usage.setIsDerived(false);
310298
}
311299
}
312300
super.exitDerivedPrefixExpression(ctx);
@@ -317,8 +305,6 @@ public void exitEndPrefixExpression(EndPrefixExpressionContext ctx) {
317305
if (this.element instanceof Usage usage) {
318306
if (ctx != null) {
319307
usage.setIsEnd(true);
320-
} else {
321-
usage.setIsEnd(false);
322308
}
323309
}
324310
super.exitEndPrefixExpression(ctx);
@@ -329,8 +315,6 @@ public void exitConstantPrefixExpression(ConstantPrefixExpressionContext ctx) {
329315
if (this.element instanceof Usage usage) {
330316
if (ctx != null) {
331317
usage.setIsConstant(true);
332-
} else {
333-
usage.setIsConstant(false);
334318
}
335319
}
336320
super.exitConstantPrefixExpression(ctx);
@@ -343,8 +327,6 @@ public void exitVariationPrefixExpression(VariationPrefixExpressionContext ctx)
343327
usage.setIsVariation(true);
344328
// A variation is always abstract
345329
usage.setIsAbstract(true);
346-
} else {
347-
usage.setIsVariation(false);
348330
}
349331
}
350332
super.exitVariationPrefixExpression(ctx);
@@ -396,8 +378,6 @@ public void exitOrderedMultiplicityExpression(OrderedMultiplicityExpressionConte
396378
if (this.element instanceof Usage usage) {
397379
if (ctx != null) {
398380
usage.setIsOrdered(true);
399-
} else {
400-
usage.setIsOrdered(false);
401381
}
402382
}
403383
super.exitOrderedMultiplicityExpression(ctx);
@@ -408,8 +388,6 @@ public void exitNonuniqueMultiplicityExpression(NonuniqueMultiplicityExpressionC
408388
if (this.element instanceof Usage usage) {
409389
if (ctx != null) {
410390
usage.setIsUnique(false);
411-
} else {
412-
usage.setIsUnique(true);
413391
}
414392
}
415393
super.exitNonuniqueMultiplicityExpression(ctx);
@@ -1077,27 +1055,6 @@ private void handleMissingAbstractPrefixExpression(ParserRuleContext ctx) {
10771055
}
10781056
}
10791057

1080-
private void handleMissingDerivedPrefixExpression(ListItemExpressionContext ctx) {
1081-
DerivedPrefixExpressionContext derivedPrefixExpression = ctx.prefixListItemExpression().derivedPrefixExpression(0);
1082-
if (this.element instanceof Usage usage && derivedPrefixExpression == null) {
1083-
usage.setIsDerived(false);
1084-
}
1085-
}
1086-
1087-
private void handleMissingEndPrefixExpression(ListItemExpressionContext ctx) {
1088-
EndPrefixExpressionContext endPrefixExpression = ctx.prefixListItemExpression().endPrefixExpression(0);
1089-
if (this.element instanceof Usage usage && endPrefixExpression == null) {
1090-
usage.setIsEnd(false);
1091-
}
1092-
}
1093-
1094-
private void handleMissingConstantPrefixExpression(ListItemExpressionContext ctx) {
1095-
ConstantPrefixExpressionContext constantPrefixExpression = ctx.prefixListItemExpression().constantPrefixExpression(0);
1096-
if (this.element instanceof Usage usage && constantPrefixExpression == null) {
1097-
usage.setIsConstant(false);
1098-
}
1099-
}
1100-
11011058
private void handleMissingVariationPrefixExpression(ParserRuleContext ctx) {
11021059
VariationPrefixExpressionContext variationPrefixExpression = null;
11031060
if (ctx instanceof ListItemExpressionContext listCtx) {

doc/content/modules/user-manual/pages/hands-on/how-tos/model-management.adoc

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,21 @@ These shortcuts offer a convenient way to update model elements efficiently.
311311

312312
[WARNING]
313313
====
314-
When using the direct edit tool to set the name of an `Element` be aware that the following keywords would not be accepted in the name part of your input:
315-
316-
* ':'
317-
* ':>'
318-
* '::>'
319-
* ':>>'
320-
* '='
321-
* ':='
322-
* '['
323-
* ' default'
324-
* ' ordered'
325-
* ' nonunique'
326-
327-
To be able to use those in the name of the `Element`, use the "name" field in the {details} view.
314+
In diagrams, when using the direct edit tool to set the name of an `Element` be aware that the following keywords would not be accepted in the name part of your input:
315+
316+
* ':' (because it's used to set the type of an `Element`)
317+
* ':>' (because it's used to set a subsetting `Relationship` between two `Element`)
318+
* '::>' (because it's used to set a redefinition `Relationship` between two `Element`)
319+
* ':>>' (because it's used to set a reference subsetting `Relationship` between two `Element`)
320+
* '=' (because it's used to set a value to a `Feature`)
321+
* ':=' (because it's used to set an initial value to a `Feature`)
322+
* '[' (because it's used to set the cardinality of an `Element` or a `Relationship`)
323+
* ' constant' (note the space before _constant_)(because it's used to set a `Feature` as constant)
324+
* ' default' (note the space before _default_)(because it's used to set a `Feature` value as default)
325+
* ' end' (note the space before _end_)(because it's used to set a `Feature` as an end)
326+
* ' nonunique' (note the space before _nonunique_)(because it's used to set a `Feature` as non-unique)
327+
* ' ordered' (note the space before _ordered_)(because it's used to set a `Feature` as ordered)
328+
* ' variation' (note the space before _variation_)(because it's used to set a `Feature` as a variation)
329+
330+
To be able to use those in the name of the `Element`, use the "Declared Name" text field in the {details} view.
328331
====

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ They can also add their own SysML-based validation rules by returning additional
3030
It now follows the same rule than all other graphical node: if a compartment that can display the new `PerformActionUsage` is displayed, then the new `PerformActionUsage` is displayed in this compartment, otherwise it is displayed in the diagram background.
3131
** Fix an issue where the creation of a `RequirementUsage` from a `Package` graphical node was not revealing it.
3232
** Fix the `EnumerationDefinition` graphical node compartment name from `enumerations` to `enums`, to follow the SysMLv2 specification.
33+
** Fix the direct edit and the display of `ends` graphical node elements inside the _ends_ compartment.
34+
Now the _end_ keyword is not displayed anymore in the label of these graphical nodes, and the direct edit only allows to edit the name of the `end` element instead of the full label which was confusing for users.
3335

3436
* In textual import/export:
3537

scripts/check-coverage.jsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ var moduleCoverageData = List.of(
3434
new ModuleCoverage("syson-application", 37.0),
3535
new ModuleCoverage("syson-application-configuration", 75.0),
3636
new ModuleCoverage("syson-common-view", 100.0),
37-
new ModuleCoverage("syson-diagram-common-view", 88.0),
37+
new ModuleCoverage("syson-diagram-common-view", 89.0),
3838
new ModuleCoverage("syson-diagram-services", 84.0),
39-
new ModuleCoverage("syson-direct-edit-grammar", 68.0),
39+
new ModuleCoverage("syson-direct-edit-grammar", 67.0),
4040
new ModuleCoverage("syson-form-services", 100.0),
4141
new ModuleCoverage("syson-model-services", 94.0),
4242
new ModuleCoverage("syson-representation-services", 100.0),
4343
new ModuleCoverage("syson-services", 64.0),
4444
new ModuleCoverage("syson-siriusweb-customnodes-metamodel", 41.0),
4545
new ModuleCoverage("syson-siriusweb-customnodes-metamodel-edit", 0.0),
4646
new ModuleCoverage("syson-standard-diagrams-view", 97.0),
47-
new ModuleCoverage("syson-sysml-export", 69.0),
47+
new ModuleCoverage("syson-sysml-export", 71.0),
4848
new ModuleCoverage("syson-sysml-import", 85.0),
4949
new ModuleCoverage("syson-sysml-metamodel", 76.0),
5050
new ModuleCoverage("syson-sysml-metamodel-edit", 17.0),

0 commit comments

Comments
 (0)