2525import org .eclipse .emf .ecore .resource .Resource ;
2626import org .eclipse .emf .ecore .util .EcoreUtil ;
2727import org .eclipse .emf .ecore .xmi .impl .XMIResourceImpl ;
28- import org .eclipse .syson .sysml .Element ;
2928import org .eclipse .emf .edit .provider .ComposedAdapterFactory .Descriptor ;
3029import org .eclipse .sirius .components .collaborative .forms .services .api .IPropertiesDescriptionRegistry ;
3130import org .eclipse .sirius .components .collaborative .forms .services .api .IPropertiesDescriptionRegistryConfigurer ;
6362import org .eclipse .syson .model .services .ModelMutationElementService ;
6463import org .eclipse .syson .model .services .aql .ModelMutationAQLService ;
6564import org .eclipse .syson .model .services .aql .ModelQueryAQLService ;
66- import org .eclipse .syson .services . UtilService ;
65+ import org .eclipse .syson .sysml . Element ;
6766import org .eclipse .syson .sysml .SysmlPackage ;
67+ import org .eclipse .syson .sysml .metamodel .services .MetamodelQueryElementService ;
6868import org .eclipse .syson .util .AQLConstants ;
6969import org .eclipse .syson .util .AQLUtils ;
7070import org .eclipse .syson .util .ServiceMethod ;
@@ -119,10 +119,10 @@ public class SysMLv2PropertiesConfigurer implements IPropertiesDescriptionRegist
119119
120120 private final ILabelService labelService ;
121121
122- private final UtilService utilService ;
123-
124122 private final IReadOnlyObjectPredicate readOnlyObjectPredicate ;
125123
124+ private final MetamodelQueryElementService metamodelQueryElementService ;
125+
126126 private final List <IDetailsViewHelpTextProvider > detailViewHelpTextProviders ;
127127
128128 public SysMLv2PropertiesConfigurer (List <Descriptor > composedAdapterFactoryDescriptors , ViewFormDescriptionConverter converter , IFeedbackMessageService feedbackMessageService ,
@@ -133,7 +133,7 @@ public SysMLv2PropertiesConfigurer(List<Descriptor> composedAdapterFactoryDescri
133133 this .labelService = Objects .requireNonNull (labelService );
134134 this .readOnlyObjectPredicate = Objects .requireNonNull (readOnlyObjectPredicate );
135135 this .detailViewHelpTextProviders = Objects .requireNonNull (detailViewHelpTextProviders );
136- this .utilService = new UtilService ();
136+ this .metamodelQueryElementService = new MetamodelQueryElementService ();
137137 }
138138
139139 @ Override
@@ -155,7 +155,8 @@ public void addPropertiesDescriptions(IPropertiesDescriptionRegistry registry) {
155155
156156 // Convert the View-based FormDescription and register the result into the system
157157 AQLInterpreter interpreter = new AQLInterpreter (List .of (),
158- List .of (new DetailsViewService (this .composedAdapterFactoryDescriptors , this .feedbackMessageService , this .readOnlyObjectPredicate , this .detailViewHelpTextProviders ), this .labelService , this .utilService ,
158+ List .of (new DetailsViewService (this .composedAdapterFactoryDescriptors , this .feedbackMessageService , this .readOnlyObjectPredicate , this .metamodelQueryElementService ,
159+ this .detailViewHelpTextProviders ), this .labelService ,
159160 new ModelMutationAQLService (new ModelMutationElementService ()), new ModelQueryAQLService (), new FormMutationAQLService (), new FormQueryAQLService ()),
160161 List .of (SysmlPackage .eINSTANCE ));
161162 ViewConverterResult converterResult = this .converter .convert (viewFormDescription , List .of (), interpreter );
@@ -188,6 +189,8 @@ private FormDescription createDetailsViewForElement() {
188189 pageCore .getGroups ().add (this .createExtraAcceptActionUsagePropertiesGroup ());
189190 pageCore .getGroups ().add (this .createExtraTransitionSourceTargetPropertiesGroup ());
190191 pageCore .getGroups ().add (this .createFeatureValuePropertiesGroup ());
192+ pageCore .getGroups ().add (this .createResultExpressionPropertiesGroup ());
193+ pageCore .getGroups ().add (this .createExpressionPropertiesGroup ());
191194
192195 PageDescription pageAdvanced = FormFactory .eINSTANCE .createPageDescription ();
193196 pageAdvanced .setName ("SysON-DetailsView-Advanced" );
@@ -217,7 +220,7 @@ private GroupDescription createFeatureValuePropertiesGroup() {
217220
218221 TextAreaDescription expressionWidget = FormFactory .eINSTANCE .createTextAreaDescription ();
219222 expressionWidget .setName ("ValueExpression" );
220- expressionWidget .setLabelExpression ("Value" );
223+ expressionWidget .setLabelExpression ("custom: Value" );
221224 expressionWidget .setValueExpression (ServiceMethod .of0 (DetailsViewService ::getValueExpressionTextualRepresentation ).aqlSelf ());
222225 expressionWidget .setIsEnabledExpression (AQLConstants .AQL_FALSE );
223226
@@ -226,6 +229,52 @@ private GroupDescription createFeatureValuePropertiesGroup() {
226229 return group ;
227230 }
228231
232+ /**
233+ * Creates a group to display the value of an Expression.
234+ *
235+ * @return a {@link GroupDescription}
236+ */
237+ private GroupDescription createExpressionPropertiesGroup () {
238+ GroupDescription group = FormFactory .eINSTANCE .createGroupDescription ();
239+ group .setDisplayMode (GroupDisplayMode .LIST );
240+ group .setName ("Result" );
241+ group .setLabelExpression ("" );
242+ group .setSemanticCandidatesExpression (ServiceMethod .of0 (DetailsViewService ::getExpression ).aqlSelf ());
243+
244+ TextAreaDescription expressionWidget = FormFactory .eINSTANCE .createTextAreaDescription ();
245+ expressionWidget .setName ("Expression" );
246+ expressionWidget .setLabelExpression ("custom:Expression" );
247+ expressionWidget .setValueExpression (ServiceMethod .of0 (DetailsViewService ::getExpressionTextualRepresentation ).aqlSelf ());
248+ expressionWidget .setIsEnabledExpression (AQLConstants .AQL_FALSE );
249+
250+ group .getChildren ().add (expressionWidget );
251+
252+ return group ;
253+ }
254+
255+ /**
256+ * Creates a group to display the value of a ResultExpression.
257+ *
258+ * @return a {@link GroupDescription}
259+ */
260+ private GroupDescription createResultExpressionPropertiesGroup () {
261+ GroupDescription group = FormFactory .eINSTANCE .createGroupDescription ();
262+ group .setDisplayMode (GroupDisplayMode .LIST );
263+ group .setName ("Result" );
264+ group .setLabelExpression ("" );
265+ group .setSemanticCandidatesExpression (ServiceMethod .of0 (DetailsViewService ::getResultExpression ).aqlSelf ());
266+
267+ TextAreaDescription expressionWidget = FormFactory .eINSTANCE .createTextAreaDescription ();
268+ expressionWidget .setName ("ResultExpression" );
269+ expressionWidget .setLabelExpression ("Result" );
270+ expressionWidget .setValueExpression (ServiceMethod .of0 (DetailsViewService ::getResultExpressionTextualRepresentation ).aqlSelf ());
271+ expressionWidget .setIsEnabledExpression (AQLConstants .AQL_FALSE );
272+
273+ group .getChildren ().add (expressionWidget );
274+
275+ return group ;
276+ }
277+
229278 private GroupDescription createCorePropertiesGroup () {
230279 GroupDescription group = FormFactory .eINSTANCE .createGroupDescription ();
231280 group .setDisplayMode (GroupDisplayMode .LIST );
0 commit comments