Skip to content

Commit 6bb2a6b

Browse files
flatombeAxelRICHARD
authored andcommitted
[960] Display possible 'subject' Usages in a tree instead of a list
In the 'General View' diagram, the creation tool for SubjectParameter now shows possible candidate Usages in a tree instead of a flat list. Bug: #960 Signed-off-by: Florent Latombe <florent.latombe@obeo.fr>
1 parent 3ded8c8 commit 6bb2a6b

File tree

5 files changed

+33
-8
lines changed

5 files changed

+33
-8
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- https://github.com/eclipse-syson/syson/issues/1061[#1061] [general-view] Add ellipsis on `Packages` label, to provide visual feedback on name overflow.
1818
- https://github.com/eclipse-syson/syson/issues/1007[#1007] Improve direct edit on Feature elements to be able to set the `isDefault` and `isInitial` properties
1919
- https://github.com/eclipse-syson/syson/issues/1033[#1033] [explorer] Make it possible to create a diagram representation directly under a `root Namespace` element
20+
- https://github.com/eclipse-syson/syson/issues/960[#960] [general-view] In the selection dialog of the `subject` creation tool, display possible `Usage` candidates in a tree instead of a list.
2021

2122
=== New features
2223

backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,29 @@ public List<? extends Object> getStakeholderSelectionDialogChildren(Object selec
12271227
return this.getChildrenWithInstancesOf(selectionDialogTreeElement, SysmlPackage.eINSTANCE.getPartUsage());
12281228
}
12291229

1230+
/**
1231+
* Provides the root elements in the tree of the selection dialog for the SubjectParameter creation tool.
1232+
*
1233+
* @param editingContext
1234+
* the (non-{@code null}) {@link IEditingContext}.
1235+
* @return the (non-{@code null}) {@link List} of all {@link Resource} that contain at least one {@link Type}.
1236+
*/
1237+
public List<Resource> getSubjectSelectionDialogElements(IEditingContext editingContext) {
1238+
return this.getAllResourcesWithInstancesOf(editingContext, SysmlPackage.eINSTANCE.getUsage());
1239+
}
1240+
1241+
/**
1242+
* Provides the children of element in the tree of the selection dialog for the SubjectParameter creation tool.
1243+
*
1244+
* @param selectionDialogTreeElement
1245+
* a (non-{@code null}) selection dialog tree element.
1246+
* @return the (non-{@code null}) {@link List} of all children that contain (possibly indirectly) or are
1247+
* {@link Usage}.
1248+
*/
1249+
public List<? extends Object> getSubjectSelectionDialogChildren(Object selectionDialogTreeElement) {
1250+
return this.getChildrenWithInstancesOf(selectionDialogTreeElement, SysmlPackage.eINSTANCE.getUsage());
1251+
}
1252+
12301253
/**
12311254
* Provides the root elements in the tree of the selection dialog for the ActorParameter creation tool.
12321255
*

backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/tools/SubjectCompartmentNodeToolProvider.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2024 Obeo.
2+
* Copyright (c) 2024, 2025 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
@@ -12,12 +12,8 @@
1212
*******************************************************************************/
1313
package org.eclipse.syson.diagram.common.view.tools;
1414

15-
import java.util.List;
16-
1715
import org.eclipse.sirius.components.view.diagram.SelectionDialogDescription;
18-
import org.eclipse.syson.sysml.SysmlPackage;
1916
import org.eclipse.syson.util.AQLUtils;
20-
import org.eclipse.syson.util.SysMLMetamodelHelper;
2117

2218
/**
2319
* Node tool provider for Subject compartment in the element that need such compartment.
@@ -33,13 +29,14 @@ protected String getServiceCallExpression() {
3329

3430
@Override
3531
protected SelectionDialogDescription getSelectionDialogDescription() {
36-
String domainType = SysMLMetamodelHelper.buildQualifiedName(SysmlPackage.eINSTANCE.getType());
3732
var selectionDialogTree = this.diagramBuilderHelper.newSelectionDialogTreeDescription()
38-
.elementsExpression(AQLUtils.getSelfServiceCallExpression("getAllReachable", List.of(domainType, "false")))
33+
.elementsExpression(AQLUtils.getServiceCallExpression("editingContext", "getSubjectSelectionDialogElements"))
34+
.childrenExpression(AQLUtils.getSelfServiceCallExpression("getSubjectSelectionDialogChildren"))
35+
.isSelectableExpression("aql:self.oclIsKindOf(sysml::Usage)")
3936
.build();
4037
return this.diagramBuilderHelper.newSelectionDialogDescription()
4138
.selectionDialogTreeDescription(selectionDialogTree)
42-
.selectionMessage("Select an existing Type as subject:")
39+
.selectionMessage("Select an existing Usage as subject:")
4340
.build();
4441
}
4542

49 KB
Loading

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ image::release-notes-package-name-ellipsis-overflow.png[Package name overflow wi
1818

1919
image::release-notes-create-diagram-on-root-namespace-element.png[Create diagram on root namespace element, width=50%, height=50%]
2020

21+
- In the `General View` diagram, the subject creation tool displays available `Usages` in a tree instead of a list.
22+
23+
image::release-notes-gv-subject-creation-selection-dialog-tree.png['subject creation tool selection dialog tree' compartment, width=50%, height=50%]
24+
2125
== Dependency update
2226

2327
== Technical details

0 commit comments

Comments
 (0)