Skip to content

Commit

Permalink
[2236] Update View.Form metamodel
Browse files Browse the repository at this point in the history
Bug: #2236
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
  • Loading branch information
pcdavid committed Aug 28, 2023
1 parent dc6d4dc commit 3540dde
Show file tree
Hide file tree
Showing 90 changed files with 3,643 additions and 1,156 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.adoc
Expand Up @@ -29,6 +29,12 @@ All of its remaining content was only relevant inside of Sirius Web and it has t
- [releng] Stop minifying the code of Sirius Components packages.
As a result the development of applications consuming Sirius Components packages will be easier and it will be the responsability of the application to minify everything (which they should already be doing).
- https://github.com/eclipse-sirius/sirius-web/issues/2296[#2296] [diagram] `sirius-components-diagrams-reactflow` now depends on `html-to-image` node package.
- https://github.com/eclipse-sirius/sirius-web/issues/2236[#2236] [forms] The introduction of _ForDescription_ and _IfDescription_ elements to the Forms DSL introduced breaking changes in the metamodel.
Existing FormDescription documents will need to be modified to load correctly, and any custom widget's metamodel will need to be regenerated using the new `form.ecore` version as reference.
See [ADR-107] _Add support for dynamic and conditional widgets in Forms_ for the details of the changes.
Also, all widget descriptions now have a `Function<VariableManager, String> targetObjectIdProvider`, needed to compute the widget instance's id.
The new `targetObjectIdProvider` is required to be non-null, so any code which programatically builds core Form Descriptions (not View-based ones), needs to pass a non-null provider.
A suitable implementation is to get the id of the `self` object using `IObjectService.getId()`.

=== Dependency update

Expand All @@ -55,6 +61,11 @@ As a result the development of applications consuming Sirius Components packages

- https://github.com/eclipse-sirius/sirius-web/issues/2185[#2185] [diagram] Add support for drop tool from the explorer with React Flow.
- https://github.com/eclipse-sirius/sirius-web/issues/2117[#2117] [form] Add a modal to select new values for multi-valued references
- https://github.com/eclipse-sirius/sirius-web/issues/2236[#2236] [forms] It is now possible to use `For` and `If` constructs inside the definition of Form (currently only inside _Groups_ and _Flexbox containers_).
Both constructs are commonly combined together, with e.g. _For_ iterating on the different features of the current semantic element and several _If_ inside the loop to decide which concrete widget(s) to instantiate depending on the feature's type.
They can however also be used independently (e.g. a single _If_ ouside of a _For_ to make the presence of a widget conditional) and combined in arbitrary ways (e.g. nested loops or conditionals).
Note that this first version has a known limitation: _FormDescriptions_ which use _For_ or _If_ elements can not be reliably edited using the _Form Description Editor_.
This will be fixed in the next version.

=== Improvements

Expand Down
Expand Up @@ -29,16 +29,15 @@

/**
* This is the item provider adapter for a
* {@link org.eclipse.sirius.components.widgets.reference.ConditionalReferenceWidgetDescriptionStyle}
* object. <!-- begin-user-doc --> <!-- end-user-doc -->
* {@link org.eclipse.sirius.components.widgets.reference.ConditionalReferenceWidgetDescriptionStyle} object. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public class ConditionalReferenceWidgetDescriptionStyleItemProvider extends ConditionalItemProvider {

/**
* This constructs an instance from a factory and a notifier. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
Expand All @@ -47,8 +46,7 @@ public ConditionalReferenceWidgetDescriptionStyleItemProvider(AdapterFactory ada
}

/**
* This returns the property descriptors for the adapted class. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
Expand All @@ -68,104 +66,74 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
}

/**
* This adds a property descriptor for the Font Size feature. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This adds a property descriptor for the Font Size feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addFontSizePropertyDescriptor(Object object) {
this.itemPropertyDescriptors
.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(),
this.getResourceLocator(), this.getString("_UI_LabelStyle_fontSize_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_fontSize_feature",
"_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__FONT_SIZE, true, false, false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null));
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_LabelStyle_fontSize_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_fontSize_feature", "_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__FONT_SIZE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Italic feature. <!-- begin-user-doc
* --> <!-- end-user-doc -->
* This adds a property descriptor for the Italic feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addItalicPropertyDescriptor(Object object) {
this.itemPropertyDescriptors
.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(),
this.getResourceLocator(), this.getString("_UI_LabelStyle_italic_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_italic_feature",
"_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__ITALIC, true, false, false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_LabelStyle_italic_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_italic_feature", "_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__ITALIC, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Bold feature. <!-- begin-user-doc -->
* <!-- end-user-doc -->
* This adds a property descriptor for the Bold feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addBoldPropertyDescriptor(Object object) {
this.itemPropertyDescriptors
.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(),
this.getResourceLocator(), this.getString("_UI_LabelStyle_bold_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_bold_feature",
"_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__BOLD, true, false, false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_LabelStyle_bold_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_bold_feature", "_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__BOLD, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Underline feature. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This adds a property descriptor for the Underline feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addUnderlinePropertyDescriptor(Object object) {
this.itemPropertyDescriptors
.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(),
this.getResourceLocator(), this.getString("_UI_LabelStyle_underline_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_underline_feature",
"_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__UNDERLINE, true, false, false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_LabelStyle_underline_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_underline_feature", "_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__UNDERLINE, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Strike Through feature. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This adds a property descriptor for the Strike Through feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addStrikeThroughPropertyDescriptor(Object object) {
this.itemPropertyDescriptors
.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(),
this.getResourceLocator(), this.getString("_UI_LabelStyle_strikeThrough_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_strikeThrough_feature",
"_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__STRIKE_THROUGH, true, false, false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_LabelStyle_strikeThrough_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_LabelStyle_strikeThrough_feature", "_UI_LabelStyle_type"),
ViewPackage.Literals.LABEL_STYLE__STRIKE_THROUGH, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Color feature. <!-- begin-user-doc
* --> <!-- end-user-doc -->
* This adds a property descriptor for the Color feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addColorPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(
((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_ReferenceWidgetDescriptionStyle_color_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_ReferenceWidgetDescriptionStyle_color_feature",
"_UI_ReferenceWidgetDescriptionStyle_type"),
ReferencePackage.Literals.REFERENCE_WIDGET_DESCRIPTION_STYLE__COLOR, true, false, true, null, null,
null));
this.getString("_UI_PropertyDescriptor_description", "_UI_ReferenceWidgetDescriptionStyle_color_feature", "_UI_ReferenceWidgetDescriptionStyle_type"),
ReferencePackage.Literals.REFERENCE_WIDGET_DESCRIPTION_STYLE__COLOR, true, false, true, null, null, null));
}

/**
* This returns ConditionalReferenceWidgetDescriptionStyle.gif. <!--
* begin-user-doc --> <!-- end-user-doc -->
* This returns ConditionalReferenceWidgetDescriptionStyle.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
Expand All @@ -185,8 +153,7 @@ protected boolean shouldComposeCreationImage() {
}

/**
* This returns the label text for the adapted class. <!-- begin-user-doc -->
* <!-- end-user-doc -->
* This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
Expand All @@ -198,9 +165,9 @@ public String getText(Object object) {
}

/**
* This handles model notifications by calling {@link #updateChildren} to update
* any cached children and by creating a viewer notification, which it passes to
* {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc -->
* This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating
* a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @generated
*/
Expand All @@ -221,9 +188,8 @@ public void notifyChanged(Notification notification) {
}

/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing
* the children that can be created under this object. <!-- begin-user-doc -->
* <!-- end-user-doc -->
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created
* under this object. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
Expand All @@ -233,8 +199,7 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
}

/**
* Return the resource locator for this item provider's resources. <!--
* begin-user-doc --> <!-- end-user-doc -->
* Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
Expand Down

0 comments on commit 3540dde

Please sign in to comment.