Skip to content

Commit 32d431c

Browse files
committed
[6269] Update the selection dialog description in View DSL
Bug: #6269 Signed-off-by: Guillaume Coutable <guillaume.coutable@obeo.fr>
1 parent f75837a commit 32d431c

File tree

22 files changed

+2535
-278
lines changed

22 files changed

+2535
-278
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ A new provisional method `IHierarchyEventProcessor#update` is available to updat
6464
- https://github.com/eclipse-sirius/sirius-web/issues/6229[#6229] [selection] Improve the user experience of the selection dialog.
6565
It now comes with small improvements in the filter bar for better reuse
6666
- https://github.com/eclipse-sirius/sirius-web/issues/6250[#6250] [selection] Default selection dialog customizations have been moved in the backend
67+
- https://github.com/eclipse-sirius/sirius-web/issues/6269[#6269] [view] Add more selection dialog labels customization in the View DSL.
68+
+ Come with a migration participant to rename the name of `selectionMessage` and `noSelectionLabel` feature name into `descriptionExpression` and `noSelectionActionLabelExpression`.
6769

6870

6971

packages/selection/backend/sirius-components-selection/src/main/java/org/eclipse/sirius/components/selection/description/SelectionDescriptionDialog.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323
* </p>
2424
* @author gcoutable
2525
*/
26-
public record SelectionDescriptionDialog(SelectionDescriptionDialogTitles titles, String description, SelectionDescriptionDialogAction noSelectionAction, SelectionDescriptionDialogAction withSelectionAction, SelectionDescriptionDialogStatusMessages statusMessages, SelectionDescriptionDialogConfirmButtonLabels confirmButtonLabels) {
26+
public record SelectionDescriptionDialog(
27+
SelectionDescriptionDialogTitles titles,
28+
String description,
29+
SelectionDescriptionDialogAction noSelectionAction,
30+
SelectionDescriptionDialogAction withSelectionAction,
31+
SelectionDescriptionDialogStatusMessages statusMessages,
32+
SelectionDescriptionDialogConfirmButtonLabels confirmButtonLabels
33+
) {
2734
public SelectionDescriptionDialog {
2835
Objects.requireNonNull(titles);
2936
Objects.requireNonNull(description);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.sirius.web.application.editingcontext.migration.participants;
14+
15+
import com.google.gson.JsonObject;
16+
17+
import java.util.Optional;
18+
19+
import org.eclipse.emf.ecore.EObject;
20+
import org.eclipse.sirius.components.emf.migration.api.IMigrationParticipant;
21+
import org.eclipse.sirius.components.view.diagram.SelectionDialogDescription;
22+
import org.eclipse.sirius.emfjson.resource.JsonResource;
23+
import org.springframework.stereotype.Service;
24+
25+
/**
26+
* Used to migrate `selectionMessage` and `noSelectionLabel` from existing SelectionDialogDescription to `descriptionExpression` and `noSelectionActionLabelExpression`.
27+
*
28+
* @author gcoutable
29+
*/
30+
@Service
31+
public class SelectionDialogDescriptionMigrateLabelsToExpressionMigrationParticipant implements IMigrationParticipant {
32+
33+
private static final String PARTICIPANT_VERSION = "2026.3.0-202603061557";
34+
35+
@Override
36+
public String getVersion() {
37+
return PARTICIPANT_VERSION;
38+
}
39+
40+
@Override
41+
public void postObjectLoading(JsonResource resource, EObject eObject, JsonObject jsonObject) {
42+
if (eObject instanceof SelectionDialogDescription selectionDialogDescription) {
43+
Optional.ofNullable(jsonObject.getAsJsonObject("data")).ifPresent(selectionDialogDescriptionData -> {
44+
Optional.ofNullable(selectionDialogDescriptionData.get("selectionMessage")).ifPresent(selectionMessageJson -> {
45+
var selectionMessage = selectionMessageJson.getAsString();
46+
if (!selectionMessage.isBlank()) {
47+
selectionDialogDescription.setDescriptionExpression(selectionMessage);
48+
}
49+
});
50+
Optional.ofNullable(selectionDialogDescriptionData.get("noSelectionLabel")).ifPresent(noSelectionLabelJson -> {
51+
var noSelectionLabel = noSelectionLabelJson.getAsString();
52+
if (!noSelectionLabel.isBlank()) {
53+
selectionDialogDescription.setNoSelectionActionLabelExpression(noSelectionLabel);
54+
}
55+
});
56+
});
57+
}
58+
}
59+
}

packages/sirius-web/backend/sirius-web-papaya/src/main/java/org/eclipse/sirius/web/papaya/representations/classdiagram/tools/diagram/ImportExistingTypesToolProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024, 2025 Obeo.
2+
* Copyright (c) 2024, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -43,7 +43,7 @@ public NodeTool getNodeTool(IViewDiagramElementFinder cache) {
4343
.build();
4444

4545
var dialogDescription = new DiagramBuilders().newSelectionDialogDescription()
46-
.selectionMessage("Select the types to import")
46+
.descriptionExpression("Select the types to import")
4747
.selectionDialogTreeDescription(treeDescription)
4848
.multiple(true)
4949
.build();

packages/sirius-web/backend/sirius-web-papaya/src/main/java/org/eclipse/sirius/web/papaya/representations/classdiagram/tools/dialogs/TypeContainerSelectionDialogDescriptionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public SelectionDialogDescription getDialog() {
3030
.build();
3131

3232
return new DiagramBuilders().newSelectionDialogDescription()
33-
.selectionMessage("Select the container of the new type")
33+
.descriptionExpression("Select the container of the new type")
3434
.selectionDialogTreeDescription(treeDescription)
3535
.optional(true)
3636
.build();

packages/sirius-web/backend/sirius-web-papaya/src/main/java/org/eclipse/sirius/web/papaya/representations/classdiagram/tools/dialogs/TypeSelectionDialogDescriptionProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 Obeo.
2+
* Copyright (c) 2024, 2026 Obeo.
33
* This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ public SelectionDialogDescription getDialog() {
2929
.build();
3030

3131
return new DiagramBuilders().newSelectionDialogDescription()
32-
.selectionMessage("Select the type to use")
32+
.descriptionExpression("Select the type to use")
3333
.selectionDialogTreeDescription(treeDescription)
3434
.build();
3535
}

packages/sirius-web/backend/sirius-web-tests-data/src/main/resources/sirius-web-scripts/migration.sql

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,78 @@ INSERT INTO document (
12331233
'2024-07-18 15:00:0.000'
12341234
);
12351235

1236+
INSERT INTO document (
1237+
id,
1238+
semantic_data_id,
1239+
name,
1240+
content,
1241+
is_read_only,
1242+
created_on,
1243+
last_modified_on
1244+
) VALUES (
1245+
'0f84ac24-fe64-43f6-87a2-7f359c7d6f9a',
1246+
'06d828d9-c2c6-46d0-a9c4-7fabd588755b',
1247+
'SelectionDialogDescriptionMigrateLabelsToExpressionMigrationParticipant migration',
1248+
'{
1249+
"json": { "version": "1.0", "encoding": "utf-8" },
1250+
"ns": { "diagram": "http://www.eclipse.org/sirius-web/diagram", "view": "http://www.eclipse.org/sirius-web/view" },
1251+
"content": [
1252+
{
1253+
"id": "93caaf4e-8593-4ee7-8d5e-50b05996d7d8",
1254+
"eClass": "view:View",
1255+
"data": {
1256+
"descriptions": [
1257+
{
1258+
"id": "782e9016-4c4d-48ba-bb59-21313ba905ec",
1259+
"eClass": "diagram:DiagramDescription",
1260+
"data": {
1261+
"name": "SelectionDialogDescriptionMigrateLabelsToExpressionMigrationParticipant migration",
1262+
"domainType": "wilson::Root",
1263+
"titleExpression": "wilson diagram",
1264+
"palette": {
1265+
"id": "286d4d54-366d-442c-8359-b7860650116b",
1266+
"eClass": "diagram:DiagramPalette",
1267+
"data": {
1268+
"nodeTools": [
1269+
{
1270+
"id": "7812650b-fe54-48a9-aca3-1239ee93b135",
1271+
"eClass": "diagram:NodeTool",
1272+
"data": {
1273+
"name": "Selection Tool",
1274+
"dialogDescription": {
1275+
"id": "6b93da0c-1a1f-41ca-9f20-d5dc9542d679",
1276+
"eClass": "diagram:SelectionDialogDescription",
1277+
"data": {
1278+
"selectionMessage": "Selection message to migrate",
1279+
"noSelectionLabel": "no selection label to migrate",
1280+
"selectionDialogTreeDescription": {
1281+
"id": "7a4e835c-754b-4a34-908b-eaa555efa128",
1282+
"eClass": "diagram:SelectionDialogTreeDescription",
1283+
"data": {
1284+
"elementsExpression": "aql:self.eContents()",
1285+
"childrenExpression": "aql:self.eContents()",
1286+
"isSelectableExpression": "aql:true"
1287+
}
1288+
}
1289+
}
1290+
}
1291+
}
1292+
}
1293+
]
1294+
}
1295+
}
1296+
}
1297+
}
1298+
]
1299+
}
1300+
}
1301+
]
1302+
}',
1303+
false,
1304+
'2025-12-18 15:00:0.000',
1305+
'2025-12-18 15:00:0.000'
1306+
);
1307+
12361308
INSERT INTO project (
12371309
id,
12381310
name,

packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/selection/SelectionControllerIntegrationTests.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,17 @@ public void givenSemanticObjectWhenRequestingSelectionDescriptionThenTheSelectio
183183
String selectionRequiredWithSelectionConfirmButtonLabel = JsonPath.read(result.data(), "$.data.viewer.editingContext.representation.description.dialog.confirmButtonLabels.selectionRequiredWithSelectionConfirmButtonLabel");
184184
String treeDescriptionId = JsonPath.read(result.data(), "$.data.viewer.editingContext.representation.description.treeDescription.id");
185185

186-
assertThat(dialogDefaultTitle).isEqualTo("Element Selection");
187-
assertThat(dialogNoSelectionTitle).isEqualTo("Element Selection");
188-
assertThat(dialogWithSelectionTitle).isEqualTo("Element Selection");
186+
assertThat(dialogDefaultTitle).isEqualTo("Just the default title");
187+
assertThat(dialogNoSelectionTitle).isEqualTo("The title when the option 'no selection' is selected");
188+
assertThat(dialogWithSelectionTitle).isEqualTo("The title when the dialog requires a selection");
189189
assertThat(dialogDescription).isEqualTo("Select the objects to consider");
190-
assertThat(noSelectionActionLabel).isEqualTo("Execute the tool without making a selection");
191-
assertThat(noSelectionActionDescription).isEqualTo("Proceed without selecting an existing element");
192-
assertThat(withSelectionActionLabel).isEqualTo("Use an existing element");
193-
assertThat(withSelectionActionDescription).isEqualTo("Select one or more elements");
194-
assertThat(noSelectionActionStatusMessage).isEqualTo("The tool execution will continue without any element selected");
195-
assertThat(selectionRequiredWithoutSelectionStatusMessage).isEqualTo("Select at least one element to continue the tool execution");
196-
assertThat(noSelectionConfirmButtonLabel).isEqualTo("Confirm");
190+
assertThat(noSelectionActionLabel).isEqualTo("The selection is not required");
191+
assertThat(noSelectionActionDescription).isEqualTo("Can confirm the dialog without making a selection");
192+
assertThat(withSelectionActionLabel).isEqualTo("The selection is required");
193+
assertThat(withSelectionActionDescription).isEqualTo("Need a selection to confirm the dialog");
194+
assertThat(noSelectionActionStatusMessage).isEqualTo("Can continue without a selection");
195+
assertThat(selectionRequiredWithoutSelectionStatusMessage).isEqualTo("Select an element");
196+
assertThat(noSelectionConfirmButtonLabel).isEqualTo("Confirm without selection");
197197
assertThat(selectionRequiredWithoutSelectionConfirmButtonLabel).isEqualTo("Select an element");
198198
assertThat(selectionRequiredWithSelectionConfirmButtonLabel).isEqualTo("Confirm");
199199
assertThat(treeDescriptionId).isEqualTo(this.selectionDescriptionProvider.getSelectionDialogTreeDescriptionId());
@@ -473,13 +473,13 @@ public void givenSemanticObjectWhenWeSubscribeToItsSelectionEventsThenTheURLOfIt
473473
@GivenSiriusWebServer
474474
@DisplayName("given a selectionDescription then the image and the label are the expected ones")
475475
public void givenASelectionDescriptionThenTheImageAndLabelAreTheExpectedOnes() {
476-
SelectionDialogDescription selectionDRialogDescription = this.selectionDescriptionProvider.getSelectionDialog();
477-
String selectionDialogLabel = this.labelService.getStyledLabel(selectionDRialogDescription).toString();
478-
assertThat(selectionDialogLabel).isEqualTo(selectionDRialogDescription.getSelectionMessage());
479-
List<String> imagePath = this.labelService.getImagePaths(selectionDRialogDescription);
476+
SelectionDialogDescription selectionDialogDescription = this.selectionDescriptionProvider.getSelectionDialog();
477+
String selectionDialogLabel = this.labelService.getStyledLabel(selectionDialogDescription).toString();
478+
assertThat(selectionDialogLabel).isEqualTo(selectionDialogDescription.getDefaultTitleExpression());
479+
List<String> imagePath = this.labelService.getImagePaths(selectionDialogDescription);
480480
assertThat(imagePath).hasSize(1).first().isEqualTo("/icons/full/obj16/SelectionDialogDescription.svg");
481481

482-
SelectionDialogTreeDescription selectionDialogTreeDescription = selectionDRialogDescription.getSelectionDialogTreeDescription();
482+
SelectionDialogTreeDescription selectionDialogTreeDescription = selectionDialogDescription.getSelectionDialogTreeDescription();
483483
String selectionDialogTreeDescriptionLabel = this.labelService.getStyledLabel(selectionDialogTreeDescription).toString();
484484
assertThat(selectionDialogTreeDescriptionLabel).isEqualTo(selectionDialogTreeDescription.getElementsExpression());
485485
List<String> selectionDialogTreeDescriptionImagePath = this.labelService.getImagePaths(selectionDialogTreeDescription);

packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/data/MigrationIdentifiers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public final class MigrationIdentifiers {
5555

5656
public static final String MIGRATION_SELECTION_DIALOG_DESCRIPTION_SELECTION_CANDIDATES_EXPRESSION_STUDIO_DIAGRAM = "SelectionDialogDescription#selectionCandidatesExpression migration";
5757

58+
public static final String SELECTION_DIALOG_DESCRIPTION_MIGRATE_LABELS_TO_EXPRESSION_MIGRATION_PARTICIPANT_DOCUMENT_NAME = "SelectionDialogDescriptionMigrateLabelsToExpressionMigrationParticipant migration";
59+
5860
public static final UUID MIGRATION_INSIDE_LABEL_STYLE_HEADER_SEPARATOR_DISPLAY_STUDIO = UUID.fromString("dc9643f8-b1ce-4c93-a176-379063d42b32");
5961

6062
public static final UUID MIGRATION_DIAGRAM_STYLE_DESCRIPTION = UUID.fromString("14df1eb9-0915-4a62-ba83-b26ce5e2cfe1");

packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/diagrams/ModelOperationDiagramDescriptionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private void createRenameElementNodeTool() {
239239
.elementsExpression("aql:self.eResource().eAllContents()")
240240
.build();
241241
var selectionDialog = new SelectionDialogDescriptionBuilder()
242-
.selectionMessage("Select a new element")
242+
.descriptionExpression("Select a new element")
243243
.selectionDialogTreeDescription(selectionDialogTreeDescription)
244244
.build();
245245

0 commit comments

Comments
 (0)