diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 7c5083fa76..5050d003de 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -21,6 +21,9 @@ - https://github.com/eclipse-sirius/sirius-components/issues/2058[#2058] [view] Fix an issue where the default icon for List widget candidates was missing when the candidates were not EObjects. - https://github.com/eclipse-sirius/sirius-components/issues/2060[#2060] [form] Fix an issue where the list widget was displayed on a single line inside a flexbox container, no matter the length of the labels of its items. +- https://github.com/eclipse-sirius/sirius-components/issues/2032[#2032] [form] Add domainType on PageDescription in the view DSL and takes into account the impacts for the FormDescriptionAggregator. +Change for `IPropertiesDescriptionRegistry` which now handles `PageDescription` directly instead of `FormDescription`. +Add of the `selection` variable available in some context. === New Features diff --git a/packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/DomainPropertiesConfigurer.java b/packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/DomainPropertiesConfigurer.java index ed7b9386e7..af4161b49a 100644 --- a/packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/DomainPropertiesConfigurer.java +++ b/packages/sirius-web/backend/sirius-web-sample-application/src/main/java/org/eclipse/sirius/web/sample/configuration/DomainPropertiesConfigurer.java @@ -87,9 +87,8 @@ private FormDescription getAttributeDetails() { form.setTitleExpression("Attribute Details"); PageDescription page = ViewFactory.eINSTANCE.createPageDescription(); - // FormDescriptionAggregator works at the Page level and uses a *list* of selected - // objects as input to determine which pages to instantiate according to their precondition. - page.setPreconditionExpression("aql:self->first().oclIsKindOf(domain::Attribute)"); + page.setDomainType("domain::Attribute"); + page.setPreconditionExpression(""); page.setLabelExpression("aql:self.name + ': ' + self.getDataType().capitalize()"); form.getPages().add(page); page.getGroups().add(this.createGroup()); diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/PageDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/PageDescriptionBuilder.java index 89aa892564..9357735f26 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/PageDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/PageDescriptionBuilder.java @@ -51,6 +51,7 @@ public PageDescriptionBuilder name(java.lang.String value) { this.getPageDescription().setName(value); return this; } + /** * Setter for LabelExpression. * @@ -60,6 +61,17 @@ public PageDescriptionBuilder labelExpression(java.lang.String value) { this.getPageDescription().setLabelExpression(value); return this; } + + /** + * Setter for DomainType. + * + * @generated + */ + public PageDescriptionBuilder domainType(java.lang.String value) { + this.getPageDescription().setDomainType(value); + return this; + } + /** * Setter for SemanticCandidatesExpression. * diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/PageDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/PageDescriptionItemProvider.java index d0c4f9281d..d5e6ff5012 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/PageDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/PageDescriptionItemProvider.java @@ -65,6 +65,7 @@ public List getPropertyDescriptors(Object object) { this.addNamePropertyDescriptor(object); this.addLabelExpressionPropertyDescriptor(object); + this.addDomainTypePropertyDescriptor(object); this.addSemanticCandidatesExpressionPropertyDescriptor(object); this.addPreconditionExpressionPropertyDescriptor(object); } @@ -94,6 +95,17 @@ protected void addLabelExpressionPropertyDescriptor(Object object) { ViewPackage.Literals.PAGE_DESCRIPTION__LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Domain Type feature. + * + * @generated + */ + protected void addDomainTypePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_PageDescription_domainType_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_PageDescription_domainType_feature", "_UI_PageDescription_type"), + ViewPackage.Literals.PAGE_DESCRIPTION__DOMAIN_TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This adds a property descriptor for the Semantic Candidates Expression feature. @@ -196,6 +208,7 @@ public void notifyChanged(Notification notification) { switch (notification.getFeatureID(PageDescription.class)) { case ViewPackage.PAGE_DESCRIPTION__NAME: case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION: + case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE: case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION: case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties index 25242e5965..4d3c0feb86 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties @@ -209,6 +209,7 @@ _UI_ConditionalNodeStyle_style_feature=Style _UI_FormDescription_pages_feature=Pages _UI_PageDescription_name_feature=Name _UI_PageDescription_labelExpression_feature=Label Expression +_UI_PageDescription_domainType_feature=Domain Type _UI_PageDescription_semanticCandidatesExpression_feature=Semantic Candidates Expression _UI_PageDescription_preconditionExpression_feature=Precondition Expression _UI_PageDescription_groups_feature=Groups diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/PageDescription.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/PageDescription.java index ea037bafd8..9b5eb6758c 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/PageDescription.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/PageDescription.java @@ -81,15 +81,37 @@ public interface PageDescription extends EObject { */ void setLabelExpression(String value); + /** + * Returns the value of the 'Domain Type' attribute. The default value is "". + * + * @return the value of the 'Domain Type' attribute. + * @model default="" dataType="org.eclipse.sirius.components.view.DomainType" + * @generated + * @see #setDomainType(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_DomainType() + */ + String getDomainType(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.PageDescription#getDomainType Domain + * Type}' attribute. + * + * @param value the new value of the 'Domain Type' attribute. + * @generated + * @see #getDomainType() + */ + void setDomainType(String value); + /** * Returns the value of the 'Semantic Candidates Expression' attribute. The default value is * "aql:self". * * @return the value of the 'Semantic Candidates Expression' attribute. - * @see #setSemanticCandidatesExpression(String) - * @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_SemanticCandidatesExpression() * @model default="aql:self" dataType="org.eclipse.sirius.components.view.InterpretedExpression" * @generated + * @see #setSemanticCandidatesExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_SemanticCandidatesExpression() */ String getSemanticCandidatesExpression(); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java index e4d0a8688e..d8c20989b0 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java @@ -2888,6 +2888,14 @@ public interface ViewPackage extends EPackage { */ int PAGE_DESCRIPTION__LABEL_EXPRESSION = 1; + /** + * The feature id for the 'Domain Type' attribute. + * + * @generated + * @ordered + */ + int PAGE_DESCRIPTION__DOMAIN_TYPE = 2; + /** * The feature id for the 'Semantic Candidates Expression' attribute. @@ -2895,7 +2903,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION = 2; + int PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION = 3; /** * The feature id for the 'Precondition Expression' attribute. + * + * @return the meta object for the attribute 'Domain Type'. + * @generated + * @see org.eclipse.sirius.components.view.PageDescription#getDomainType() + * @see #getPageDescription() + */ + EAttribute getPageDescription_DomainType(); + /** * Returns the meta object for the attribute * '{@link org.eclipse.sirius.components.view.PageDescription#getSemanticCandidatesExpression Semantic @@ -11113,6 +11133,14 @@ interface Literals { */ EAttribute PAGE_DESCRIPTION__LABEL_EXPRESSION = eINSTANCE.getPageDescription_LabelExpression(); + /** + * The meta object literal for the 'Domain Type' attribute feature. + * + * @generated + */ + EAttribute PAGE_DESCRIPTION__DOMAIN_TYPE = eINSTANCE.getPageDescription_DomainType(); + /** * The meta object literal for the 'Semantic Candidates Expression' attribute feature. diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/PageDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/PageDescriptionImpl.java index ab0a08adec..aeaa5ded8a 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/PageDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/PageDescriptionImpl.java @@ -74,31 +74,48 @@ public class PageDescriptionImpl extends MinimalEObjectImpl.Container implements * The default value of the '{@link #getLabelExpression() Label Expression}' attribute. * - * @see #getLabelExpression() * @generated * @ordered + * @see #getLabelExpression() */ protected static final String LABEL_EXPRESSION_EDEFAULT = null; /** - * The cached value of the '{@link #getLabelExpression() Label Expression}' attribute. + * The default value of the '{@link #getDomainType() Domain Type}' attribute. * - * @see #getLabelExpression() * @generated * @ordered + * @see #getDomainType() */ - protected String labelExpression = LABEL_EXPRESSION_EDEFAULT; - + protected static final String DOMAIN_TYPE_EDEFAULT = ""; /** * The default value of the '{@link #getSemanticCandidatesExpression() Semantic Candidates Expression}' * attribute. * - * @see #getSemanticCandidatesExpression() * @generated * @ordered + * @see #getSemanticCandidatesExpression() */ protected static final String SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT = "aql:self"; + /** + * The cached value of the '{@link #getLabelExpression() Label Expression}' attribute. + * + * @generated + * @ordered + * @see #getLabelExpression() + */ + protected String labelExpression = LABEL_EXPRESSION_EDEFAULT; + /** + * The cached value of the '{@link #getDomainType() Domain Type}' attribute. + * + * @generated + * @ordered + * @see #getDomainType() + */ + protected String domainType = DOMAIN_TYPE_EDEFAULT; /** * The cached value of the '{@link #getSemanticCandidatesExpression() Semantic Candidates Expression}' @@ -215,6 +232,29 @@ public void setLabelExpression(String newLabelExpression) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION, oldLabelExpression, this.labelExpression)); } + /** + * + * + * @generated + */ + @Override + public String getDomainType() { + return this.domainType; + } + + /** + * + * + * @generated + */ + @Override + public void setDomainType(String newDomainType) { + String oldDomainType = this.domainType; + this.domainType = newDomainType; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE, oldDomainType, this.domainType)); + } + /** * * @@ -316,6 +356,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getName(); case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION: return this.getLabelExpression(); + case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE: + return this.getDomainType(); case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION: return this.getSemanticCandidatesExpression(); case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION: @@ -343,6 +385,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION: this.setLabelExpression((String) newValue); return; + case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE: + this.setDomainType((String) newValue); + return; case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION: this.setSemanticCandidatesExpression((String) newValue); return; @@ -375,6 +420,9 @@ public void eUnset(int featureID) { case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION: this.setLabelExpression(LABEL_EXPRESSION_EDEFAULT); return; + case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE: + this.setDomainType(DOMAIN_TYPE_EDEFAULT); + return; case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION: this.setSemanticCandidatesExpression(SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT); return; @@ -403,6 +451,8 @@ public boolean eIsSet(int featureID) { return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name); case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION: return LABEL_EXPRESSION_EDEFAULT == null ? this.labelExpression != null : !LABEL_EXPRESSION_EDEFAULT.equals(this.labelExpression); + case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE: + return DOMAIN_TYPE_EDEFAULT == null ? this.domainType != null : !DOMAIN_TYPE_EDEFAULT.equals(this.domainType); case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION: return SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT == null ? this.semanticCandidatesExpression != null : !SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT.equals(this.semanticCandidatesExpression); case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION: @@ -430,6 +480,8 @@ public String toString() { result.append(this.name); result.append(", labelExpression: "); result.append(this.labelExpression); + result.append(", domainType: "); + result.append(this.domainType); result.append(", semanticCandidatesExpression: "); result.append(this.semanticCandidatesExpression); result.append(", preconditionExpression: "); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java index b23bb2c8f5..e704f306d1 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java @@ -2170,7 +2170,7 @@ public EAttribute getPageDescription_LabelExpression() { * @generated */ @Override - public EAttribute getPageDescription_SemanticCandidatesExpression() { + public EAttribute getPageDescription_DomainType() { return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(2); } @@ -2180,10 +2180,20 @@ public EAttribute getPageDescription_SemanticCandidatesExpression() { * @generated */ @Override - public EAttribute getPageDescription_PreconditionExpression() { + public EAttribute getPageDescription_SemanticCandidatesExpression() { return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(3); } + /** + * + * + * @generated + */ + @Override + public EAttribute getPageDescription_PreconditionExpression() { + return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -2191,7 +2201,7 @@ public EAttribute getPageDescription_PreconditionExpression() { */ @Override public EReference getPageDescription_Groups() { - return (EReference) this.pageDescriptionEClass.getEStructuralFeatures().get(4); + return (EReference) this.pageDescriptionEClass.getEStructuralFeatures().get(5); } /** @@ -4032,6 +4042,7 @@ public void createPackageContents() { this.pageDescriptionEClass = this.createEClass(PAGE_DESCRIPTION); this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__NAME); this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__LABEL_EXPRESSION); + this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__DOMAIN_TYPE); this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION); this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__PRECONDITION_EXPRESSION); this.createEReference(this.pageDescriptionEClass, PAGE_DESCRIPTION__GROUPS); @@ -4632,6 +4643,8 @@ public void initializePackageContents() { IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getPageDescription_LabelExpression(), this.getInterpretedExpression(), "labelExpression", null, 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getPageDescription_DomainType(), this.getDomainType(), "domainType", "", 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getPageDescription_SemanticCandidatesExpression(), this.getInterpretedExpression(), "semanticCandidatesExpression", "aql:self", 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getPageDescription_PreconditionExpression(), this.getInterpretedExpression(), "preconditionExpression", "", 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, diff --git a/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore b/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore index 08f0165828..49b0141919 100644 --- a/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore +++ b/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore @@ -270,6 +270,8 @@ + +