Skip to content

Commit bc610c4

Browse files
pcdavidAxelRICHARD
authored andcommitted
[2023] Use «connection def» to label ConnectionDefinitions
Bug: #2023 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
1 parent fc49fb3 commit bc610c4

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ For example `ViewUsage` elements are no longer rendered in _parts_ compartments.
4444
- https://github.com/eclipse-syson/syson/issues/1863[#1863] [diagrams] Dropping an elements on a diagram which is already visible gives feedback again.
4545
- 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.
4646
- https://github.com/eclipse-syson/syson/issues/1998[#1998] [metamodel] Missing implicit TypeFeaturing.
47+
- https://github.com/eclipse-syson/syson/issues/2023[#2023] [diagrans] On diagrams, `ConnectionDefinition` graphical nodes are now correctly labelled as `«connection def»`.
4748

4849
=== Improvements
4950

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.eclipse.syson.sysml.Comment;
3131
import org.eclipse.syson.sysml.ConcernDefinition;
3232
import org.eclipse.syson.sysml.ConcernUsage;
33+
import org.eclipse.syson.sysml.ConnectionDefinition;
3334
import org.eclipse.syson.sysml.ConstraintDefinition;
3435
import org.eclipse.syson.sysml.ConstraintUsage;
3536
import org.eclipse.syson.sysml.Definition;
@@ -76,6 +77,7 @@
7677
import org.eclipse.syson.sysml.ViewUsage;
7778
import org.eclipse.syson.sysml.VisibilityKind;
7879
import org.eclipse.syson.sysml.helper.LabelConstants;
80+
import org.eclipse.syson.sysml.textual.SysMLv2Keywords;
7981
import org.eclipse.syson.sysml.util.SysmlSwitch;
8082

8183
/**
@@ -361,6 +363,22 @@ public String caseConstraintUsage(ConstraintUsage object) {
361363
return label.toString();
362364
}
363365

366+
@Override
367+
public String caseConnectionDefinition(ConnectionDefinition object) {
368+
StringBuilder label = new StringBuilder();
369+
label
370+
.append(this.getBasicNamePrefix(object))
371+
.append(LabelConstants.OPEN_QUOTE)
372+
.append(SysMLv2Keywords.CONNECTION)
373+
.append(LabelConstants.SPACE)
374+
.append(SysMLv2Keywords.DEF)
375+
.append(LabelConstants.CLOSE_QUOTE)
376+
.append(LabelConstants.CR)
377+
.append(this.caseElement(object))
378+
.append(this.labelService.getSubclassificationLabel(object));
379+
return label.toString();
380+
}
381+
364382
@Override
365383
public String caseDocumentation(Documentation object) {
366384
StringBuilder label = new StringBuilder();

backend/services/syson-diagram-services/src/test/java/org/eclipse/syson/diagram/services/utils/MultilineLabelSwitchTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public class MultilineLabelSwitchTest {
7575

7676
private static final String DEFAULT_CONSTRAINT_DEFINITION_LABEL = LabelConstants.OPEN_QUOTE + "constraint def" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR;
7777

78+
private static final String DEFAULT_CONNECTION_DEFINITION_LABEL = LabelConstants.OPEN_QUOTE + "connection def" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR;
79+
7880
private static final String DEFAULT_CONSTRAINT_USAGE_LABEL = LabelConstants.OPEN_QUOTE + REF_ATTRIBUTE_LABEL + "constraint" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR;
7981

8082
private static final String DEFAULT_DOCUMENTATION_LABEL = LabelConstants.OPEN_QUOTE + "doc" + LabelConstants.CLOSE_QUOTE + LabelConstants.CR;
@@ -145,6 +147,7 @@ private static Stream<Arguments> defaultParameterProvider() {
145147
Arguments.of(SYSML.getConcernDefinition(), DEFAULT_CONCERN_DEFINITION_LABEL),
146148
Arguments.of(SYSML.getConcernUsage(), DEFAULT_CONCERN_USAGE_LABEL),
147149
Arguments.of(SYSML.getConstraintDefinition(), DEFAULT_CONSTRAINT_DEFINITION_LABEL),
150+
Arguments.of(SYSML.getConnectionDefinition(), DEFAULT_CONNECTION_DEFINITION_LABEL),
148151
Arguments.of(SYSML.getConstraintUsage(), DEFAULT_CONSTRAINT_USAGE_LABEL),
149152
Arguments.of(SYSML.getDocumentation(), DEFAULT_DOCUMENTATION_LABEL),
150153
Arguments.of(SYSML.getEnumerationDefinition(), DEFAULT_ENUMERATION_DEFINITION_LABEL),
@@ -184,6 +187,7 @@ private static Stream<Arguments> prefixParameterProvider() {
184187
Arguments.of(SYSML.getConcernDefinition(), DEFAULT_CONCERN_DEFINITION_LABEL),
185188
Arguments.of(SYSML.getConcernUsage(), DEFAULT_CONCERN_USAGE_LABEL),
186189
Arguments.of(SYSML.getConstraintDefinition(), DEFAULT_CONSTRAINT_DEFINITION_LABEL),
190+
Arguments.of(SYSML.getConnectionDefinition(), DEFAULT_CONNECTION_DEFINITION_LABEL),
187191
Arguments.of(SYSML.getConstraintUsage(), DEFAULT_CONSTRAINT_USAGE_LABEL),
188192
Arguments.of(SYSML.getEnumerationDefinition(), DEFAULT_ENUMERATION_DEFINITION_LABEL),
189193
Arguments.of(SYSML.getExhibitStateUsage(), DEFAULT_EXHIBIT_STATE_USAGE_LABEL),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ It's not recommended for production use.
1919

2020
** Fix an issue where some type of `Elements` could appear in the wrong compartment if they shared a common type with said compartment, for example `ViewUsage` elements could appear in the _parts_ compartment since they extends `PartUsage`.
2121
** Allow redefining a `PartUsage` with the same name as the redefined `Usage`.
22+
** Fix an issue where `ConnectionDefinition` graphical nodes where incorrectly labelled as `«part def»` instead of `«connection def»`.
2223

2324
* In textual import/export:
2425

0 commit comments

Comments
 (0)