diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 101fe35e88..91340e15b4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -55,7 +55,8 @@ Specifiers can contribute dedicated AQL services for this feature using implemen - [charts] Make the npm package `sirius-components-charts` use the strict version of our TypeScript configuration - [trees] Make the npm package `sirius-components-trees` use the strict version of our TypeScript configuration - https://github.com/eclipse-sirius/sirius-web/issues/1047[#1047] [sirius-web] In the _Domain_ diagram, when using direct-edit on a relatin edge, the initial text now only includes the name of the relation (without the cardinality) -- https://github.com/eclipse-sirius/sirius-web/issues/4095[#4095] Add conditional tree item label element description +- https://github.com/eclipse-sirius/sirius-web/issues/4095[#4095] [tree] Add conditional tree item label element description +- https://github.com/eclipse-sirius/sirius-web/issues/4101[#4101] [tree] Add loop tree item label element description == v2025.1.0 diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java index bd2dea18d9..ec23ca2b31 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java @@ -161,6 +161,15 @@ private TreeItemLabelDescription entityStyle(TextStylePalette textStylePalette) .children( this.getEntityKeyFragment(textStylePalette), this.getEntityValueFragment(textStylePalette), + new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression(" {") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build(), + this.getAttributesFragments(textStylePalette), + new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("}") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build(), this.getAbstractEntityValueFragment(textStylePalette)) .build(); } @@ -176,6 +185,13 @@ private TreeItemLabelDescription defaultStyle() { .build(); } + private TreeItemLabelElementDescription getEntityKeyFragment(TextStylePalette textStylePalette) { + return new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:'[Entity] '") + .style(this.getTextStyleByName(textStylePalette, BROWN_BOLD_TEXT_STYLE_NAME)) + .build(); + } + private TreeItemLabelElementDescription getEntityValueFragment(TextStylePalette textStylePalette) { return new TreeBuilders().newTreeItemLabelFragmentDescription() .labelExpression(AQL_SELF_GET_TREE_ITEM_LABEL) @@ -193,10 +209,23 @@ private TreeItemLabelElementDescription getAbstractEntityValueFragment(TextStyle .build(); } - private TreeItemLabelElementDescription getEntityKeyFragment(TextStylePalette textStylePalette) { - return new TreeBuilders().newTreeItemLabelFragmentDescription() - .labelExpression("aql:'[Entity] '") - .style(this.getTextStyleByName(textStylePalette, BROWN_BOLD_TEXT_STYLE_NAME)) + private TreeItemLabelElementDescription getAttributesFragments(TextStylePalette textStylePalette) { + return new TreeBuilders().newForTreeItemLabelElementDescription() + .iterator("attribute") + .iterableExpression("aql:self.attributes") + .children( + new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:attribute.name") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build(), + new TreeBuilders().newIfTreeItemLabelElementDescription() + .predicateExpression("aql:self.attributes->indexOf(attribute) < (self.attributes->size())") + .children(new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression(", ") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build()) + .build() + ) .build(); } diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java index a34d078a71..aec24a1457 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java @@ -160,7 +160,7 @@ public void givenAnExplorerRepresentationWhenWeSubscribeToItsEventThenTheReprese assertThat(tree.getChildren().get(0).getChildren()).hasSize(1); assertThat(tree.getChildren().get(0).getChildren().get(0).getLabel().toString()).isEqualTo("buck"); assertThat(tree.getChildren().get(0).getChildren().get(0).getChildren()).hasSize(3); - assertThat(tree.getChildren().get(0).getChildren().get(0).getChildren().get(2).getLabel().toString()).isEqualTo("[Entity] Human"); + assertThat(tree.getChildren().get(0).getChildren().get(0).getChildren().get(2).getLabel().toString()).contains("[Entity] Human"); assertThat(tree.getChildren().get(0).getChildren().get(0).getChildren().get(2).getChildren()).hasSize(4); assertThat(tree.getChildren().get(0).getChildren().get(0).getChildren().get(2).getChildren().get(0).getLabel().toString()).isEqualTo("superTypes"); settingId.set(tree.getChildren().get(0).getChildren().get(0).getChildren().get(2).getChildren().get(0).getId()); diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/TreeItemLabelDescriptionControllerTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/TreeItemLabelDescriptionControllerTests.java index 0f617878eb..f3492529fc 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/TreeItemLabelDescriptionControllerTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/TreeItemLabelDescriptionControllerTests.java @@ -26,7 +26,6 @@ import java.util.function.Consumer; import org.eclipse.sirius.components.collaborative.trees.dto.TreeRefreshedEventPayload; -import org.eclipse.sirius.components.core.api.labels.StyledString; import org.eclipse.sirius.components.trees.Tree; import org.eclipse.sirius.components.trees.TreeItem; import org.eclipse.sirius.web.AbstractIntegrationTests; @@ -104,6 +103,7 @@ public void givenAStudioWhenTheTreeItemLabelsAreRequestedThenTheCorrectStylesAre // 2- check that styles are properly applied // - check that the ROOT entity has not the abstract style applied. // - check that the NamedElement entity has the abstract style (if style) + // - check that the Human entity has 3 attributes (for style) var inputStyle = new ExplorerEventInput(UUID.randomUUID(), StudioIdentifiers.SAMPLE_STUDIO_PROJECT.toString(), explorerRepresentationId); var fluxStyle = this.explorerEventSubscriptionRunner.run(inputStyle); @@ -114,11 +114,15 @@ public void givenAStudioWhenTheTreeItemLabelsAreRequestedThenTheCorrectStylesAre .getChildren() .get(0) .getChildren(); - StyledString rootLabel = domainChildren.get(0).getLabel(); - StyledString namedElementLabel = domainChildren.get(1).getLabel(); - assertThat(rootLabel.styledStringFragments()).hasSize(2); - assertThat(namedElementLabel.styledStringFragments()).hasSize(3); - assertThat(namedElementLabel.toString()).isEqualTo("[Entity] NamedElement [abstract]"); + var rootLabels = domainChildren.get(0).getLabel().styledStringFragments(); + var namedElementLabels = domainChildren.get(1).getLabel().styledStringFragments(); + var humanLabels = domainChildren.get(2).getLabel().styledStringFragments(); + assertThat(rootLabels.get(rootLabels.size() - 1).text()).doesNotContain("[abstract]"); + assertThat(namedElementLabels.get(namedElementLabels.size() - 1).text()).contains("[abstract]"); + assertThat(humanLabels).hasSize(9); + assertThat(humanLabels.get(3).text()).isEqualTo("description"); + assertThat(humanLabels.get(5).text()).isEqualTo("promoted"); + assertThat(humanLabels.get(7).text()).isEqualTo("birthDate"); }); StepVerifier.create(fluxStyle) diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/ForTreeItemLabelElementDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/ForTreeItemLabelElementDescriptionBuilder.java new file mode 100644 index 0000000000..4c1e020b10 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/ForTreeItemLabelElementDescriptionBuilder.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2023, 2025 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.tree; + +/** + * Builder for ForTreeItemLabelElementDescriptionBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class ForTreeItemLabelElementDescriptionBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription. + * @generated + */ + private org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription forTreeItemLabelElementDescription = org.eclipse.sirius.components.view.tree.TreeFactory.eINSTANCE.createForTreeItemLabelElementDescription(); + + /** + * Return instance org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription. + * @generated + */ + protected org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription getForTreeItemLabelElementDescription() { + return this.forTreeItemLabelElementDescription; + } + + /** + * Return instance org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription. + * @generated + */ + public org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription build() { + return this.getForTreeItemLabelElementDescription(); + } + + /** + * Setter for Iterator. + * + * @generated + */ + public ForTreeItemLabelElementDescriptionBuilder iterator(java.lang.String value) { + this.getForTreeItemLabelElementDescription().setIterator(value); + return this; + } + /** + * Setter for IterableExpression. + * + * @generated + */ + public ForTreeItemLabelElementDescriptionBuilder iterableExpression(java.lang.String value) { + this.getForTreeItemLabelElementDescription().setIterableExpression(value); + return this; + } + /** + * Setter for Children. + * + * @generated + */ + public ForTreeItemLabelElementDescriptionBuilder children(org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription ... values) { + for (org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription value : values) { + this.getForTreeItemLabelElementDescription().getChildren().add(value); + } + return this; + } + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java index 67c24ee177..813142c943 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java @@ -49,6 +49,16 @@ public IfTreeItemLabelElementDescriptionBuilder newIfTreeItemLabelElementDescrip return new IfTreeItemLabelElementDescriptionBuilder(); } + /** + * Instantiate a ForTreeItemLabelElementDescriptionBuilder . + * + * @author BuilderGenerator + * @generated + */ + public ForTreeItemLabelElementDescriptionBuilder newForTreeItemLabelElementDescription() { + return new ForTreeItemLabelElementDescriptionBuilder(); + } + /** * Instantiate a TreeItemLabelFragmentDescriptionBuilder . * diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generator/BuilderGenerator.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generator/BuilderGenerator.java index 791c32971b..9dcfa3aa8d 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generator/BuilderGenerator.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generator/BuilderGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2023, 2024 Obeo. + * Copyright (c) 2023, 2025 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -147,7 +147,7 @@ private StringBuilder getFactoryClassBody(GenPackage pak) { public #builderClassName new#className() { return new #builderClassName(); } - + """.replace(BUILDER_CLASSNAME, this.builderClasssName(clazz)) .replace("#className", clazz.getName())); } @@ -159,7 +159,7 @@ private StringBuilder getFactory(GenPackage pak, String builderFactoryName, Stri StringBuilder factory = new StringBuilder(); factory.append(""" /******************************************************************************* - * Copyright (c) 2023, 2024 Obeo. + * Copyright (c) 2023, 2025 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -171,7 +171,7 @@ private StringBuilder getFactory(GenPackage pak, String builderFactoryName, Stri * Obeo - initial API and implementation *******************************************************************************/ package #package; - + /** * Use to instantiate a new builder. * @@ -197,7 +197,7 @@ private StringBuilder getBody(GenClass clazz) { * @generated */ private #eObjType #eObjNameLowerCase = #packageFactory.create#eObjName(); - + /** * Return instance #eObjType. * @generated @@ -205,7 +205,7 @@ private StringBuilder getBody(GenClass clazz) { protected #eObjType get#eObjName() { return this.#eObjNameLowerCase; } - + /** * Return instance #eObjType. * @generated @@ -213,7 +213,7 @@ private StringBuilder getBody(GenClass clazz) { public #eObjType build() { return this.get#eObjName(); } - + """.replace("#packageFactory", clazz.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()) .replace("#eObjType", clazz.getQualifiedInterfaceName()) .replace("#eObjNameLowerCase", clazz.uncapPrefixedName(clazz.getSafeUncapName())) @@ -253,7 +253,7 @@ private StringBuilder getBody(GenClass clazz) { } return this; } - + """.replace(BUILDER_CLASSNAME, this.builderClasssName(clazz)) .replace("#paramType", feat.getListItemType(clazz)) .replace("#accessor", feat.getAccessorName()) @@ -272,7 +272,7 @@ private StringBuilder getBuilder(GenPackage pak, GenClass clazz, StringBuilder b if (clazz.isAbstract()) { builder.append(""" /******************************************************************************* - * Copyright (c) 2023, 2024 Obeo. + * Copyright (c) 2023, 2025 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -284,7 +284,7 @@ private StringBuilder getBuilder(GenPackage pak, GenClass clazz, StringBuilder b * Obeo - initial API and implementation *******************************************************************************/ package #package; - + /** * Builder for #qualifiedType. * @@ -292,16 +292,16 @@ private StringBuilder getBuilder(GenPackage pak, GenClass clazz, StringBuilder b * @generated */ public abstract class #builderClassName { - + /** * Builder for #qualifiedType. * @generated */ protected abstract #qualifiedType get#eObjName(); - + #classbody } - + """.replace(BUILDER_CLASSNAME, this.builderClasssName(clazz)) .replace("#qualifiedType", this.qualifiedNameFromGenClass(clazz)) .replace(CLASSBODY, body) @@ -310,7 +310,7 @@ public abstract class #builderClassName { } else { builder.append(""" /******************************************************************************* - * Copyright (c) 2023, 2024 Obeo. + * Copyright (c) 2023, 2025 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -322,7 +322,7 @@ public abstract class #builderClassName { * Obeo - initial API and implementation *******************************************************************************/ package #package; - + /** * Builder for #builderClassName. * @@ -330,10 +330,10 @@ public abstract class #builderClassName { * @generated */ public class #builderClassName { - + #classbody } - + """.replace(BUILDER_CLASSNAME, this.builderClasssName(clazz)) .replace("#qualifiedType", clazz.getQualifiedInterfaceName()) .replace(CLASSBODY, body) diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java index ddaf9edabb..e4b42995df 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.sirius.components.view.emf.tree; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -22,6 +23,7 @@ import org.eclipse.sirius.components.core.api.labels.StyledStringFragmentStyle; import org.eclipse.sirius.components.core.api.labels.UnderLineStyle; import org.eclipse.sirius.components.interpreter.AQLInterpreter; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; @@ -61,6 +63,8 @@ private List convertElement(TreeItemLabelElementDescriptio .flatMap(tiled -> this.convertElement(tiled).stream()) .toList(); } + } else if (element instanceof ForTreeItemLabelElementDescription forElement) { + result = this.convertForElementDescription(forElement); } return result; } @@ -91,6 +95,18 @@ private StyledStringFragment convertFragment(TreeItemLabelFragmentDescription fr return new StyledStringFragment(text, styleBuilder.build()); } + private List convertForElementDescription(ForTreeItemLabelElementDescription forElement) { + var result = new ArrayList(); + var iterable = evaluateObjectList(forElement.getIterableExpression()); + iterable.forEach(iteration -> { + variables.put(forElement.getIterator(), iteration); + result.addAll(forElement.getChildren().stream() + .flatMap(tiled -> this.convertElement(tiled).stream()) + .toList()); + }); + return result; + } + private Optional evaluateString(String expression) { return this.interpreter.evaluateExpression(this.variables, expression).asString(); } @@ -98,4 +114,10 @@ private Optional evaluateString(String expression) { private Optional evaluateBoolean(String expression) { return this.interpreter.evaluateExpression(this.variables, expression).asBoolean(); } + + private List evaluateObjectList(String expression) { + return interpreter.evaluateExpression(variables, expression) + .asObjects() + .orElse(List.of()); + } } diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/ForTreeItemLabelElementDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/ForTreeItemLabelElementDescriptionItemProvider.java new file mode 100644 index 0000000000..138e0f54e6 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/ForTreeItemLabelElementDescriptionItemProvider.java @@ -0,0 +1,188 @@ +/******************************************************************************* + * Copyright (c) 2025 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeFactory; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription} object. + * + * + * @generated + */ +public class ForTreeItemLabelElementDescriptionItemProvider extends TreeItemLabelElementDescriptionItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public ForTreeItemLabelElementDescriptionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (this.itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + this.addIteratorPropertyDescriptor(object); + this.addIterableExpressionPropertyDescriptor(object); + } + return this.itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Iterator feature. + * + * @generated + */ + protected void addIteratorPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ForTreeItemLabelElementDescription_iterator_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ForTreeItemLabelElementDescription_iterator_feature", "_UI_ForTreeItemLabelElementDescription_type"), + TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Iterable Expression feature. + * + * @generated + */ + protected void addIterableExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ForTreeItemLabelElementDescription_iterableExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ForTreeItemLabelElementDescription_iterableExpression_feature", "_UI_ForTreeItemLabelElementDescription_type"), + TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (this.childrenFeatures == null) { + super.getChildrenFeatures(object); + this.childrenFeatures.add(TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN); + } + return this.childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns ForTreeItemLabelElementDescription.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/ForTreeItemLabelElementDescription.svg")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ForTreeItemLabelElementDescription) object).getIterator(); + return label == null || label.length() == 0 ? this.getString("_UI_ForTreeItemLabelElementDescription_type") : this.getString("_UI_ForTreeItemLabelElementDescription_type") + " " + label; + } + + /** + * 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}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + this.updateChildren(notification); + + switch (notification.getFeatureID(ForTreeItemLabelElementDescription.class)) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR: + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createIfTreeItemLabelElementDescription())); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createForTreeItemLabelElementDescription())); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createTreeItemLabelFragmentDescription())); + } + +} diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/IfTreeItemLabelElementDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/IfTreeItemLabelElementDescriptionItemProvider.java index 6d019d33b2..bcd0909239 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/IfTreeItemLabelElementDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/IfTreeItemLabelElementDescriptionItemProvider.java @@ -17,11 +17,13 @@ import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeFactory; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -52,7 +54,6 @@ public List getPropertyDescriptors(Object object) { super.getPropertyDescriptors(object); this.addPredicateExpressionPropertyDescriptor(object); - this.addChildrenPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -71,15 +72,33 @@ protected void addPredicateExpressionPropertyDescriptor(Object object) { } /** - * This adds a property descriptor for the Children feature. + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * * @generated */ - protected void addChildrenPropertyDescriptor(Object object) { - this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), - this.getString("_UI_IfTreeItemLabelElementDescription_children_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_IfTreeItemLabelElementDescription_children_feature", "_UI_IfTreeItemLabelElementDescription_type"), - TreePackage.Literals.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, true, false, true, null, null, null)); + @Override + public Collection getChildrenFeatures(Object object) { + if (this.childrenFeatures == null) { + super.getChildrenFeatures(object); + this.childrenFeatures.add(TreePackage.Literals.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN); + } + return this.childrenFeatures; + } + + /** + * + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); } /** @@ -128,6 +147,9 @@ public void notifyChanged(Notification notification) { case TreePackage.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__PREDICATE_EXPRESSION: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; + case TreePackage.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; } super.notifyChanged(notification); } @@ -141,6 +163,12 @@ public void notifyChanged(Notification notification) { @Override protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createIfTreeItemLabelElementDescription())); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createForTreeItemLabelElementDescription())); + + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createTreeItemLabelFragmentDescription())); } } diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java index 8ae362b3a7..5d9b032e85 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java @@ -189,6 +189,8 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createIfTreeItemLabelElementDescription())); + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createForTreeItemLabelElementDescription())); + newChildDescriptors.add(this.createChildParameter(TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN, TreeFactory.eINSTANCE.createTreeItemLabelFragmentDescription())); } diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java index 2d0a14af1e..330abb125f 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java @@ -196,6 +196,30 @@ public Adapter createIfTreeItemLabelElementDescriptionAdapter() { return this.ifTreeItemLabelElementDescriptionItemProvider; } + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription} instances. + * + * @generated + */ + protected ForTreeItemLabelElementDescriptionItemProvider forTreeItemLabelElementDescriptionItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription}. + * + * + * @generated + */ + @Override + public Adapter createForTreeItemLabelElementDescriptionAdapter() { + if (this.forTreeItemLabelElementDescriptionItemProvider == null) { + this.forTreeItemLabelElementDescriptionItemProvider = new ForTreeItemLabelElementDescriptionItemProvider(this); + } + + return this.forTreeItemLabelElementDescriptionItemProvider; + } + /** * This creates an adapter for a {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription}. * @@ -377,6 +401,8 @@ public void dispose() { this.treeItemLabelDescriptionItemProvider.dispose(); if (this.ifTreeItemLabelElementDescriptionItemProvider != null) this.ifTreeItemLabelElementDescriptionItemProvider.dispose(); + if (this.forTreeItemLabelElementDescriptionItemProvider != null) + this.forTreeItemLabelElementDescriptionItemProvider.dispose(); if (this.treeItemLabelFragmentDescriptionItemProvider != null) this.treeItemLabelFragmentDescriptionItemProvider.dispose(); if (this.singleClickTreeItemContextMenuEntryItemProvider != null) diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/ForTreeItemLabelElementDescription.svg b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/ForTreeItemLabelElementDescription.svg new file mode 100644 index 0000000000..116b5ad19b --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/ForTreeItemLabelElementDescription.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties index 980ba739d3..6aa1f1d664 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties @@ -26,6 +26,7 @@ _UI_PropertyDescriptor_description = The {0} of the {1} _UI_TreeDescription_type = Tree Description _UI_TreeItemLabelDescription_type = Item Label Description _UI_IfTreeItemLabelElementDescription_type = If Tree Item Label Element Description +_UI_ForTreeItemLabelElementDescription_type = For Tree Item Label Element Description _UI_TreeItemLabelFragmentDescription_type = Item Label Fragment Description _UI_TreeItemLabelElementDescription_type = Item Label Element Description _UI_TreeItemContextMenuEntry_type = Item Context Menu Entry @@ -53,6 +54,9 @@ _UI_TreeItemLabelDescription_preconditionExpression_feature = Precondition Expre _UI_TreeItemLabelDescription_children_feature = Children _UI_IfTreeItemLabelElementDescription_predicateExpression_feature = Predicate Expression _UI_IfTreeItemLabelElementDescription_children_feature = Children +_UI_ForTreeItemLabelElementDescription_iterator_feature = Iterator +_UI_ForTreeItemLabelElementDescription_iterableExpression_feature = Iterable Expression +_UI_ForTreeItemLabelElementDescription_children_feature = Children _UI_TreeItemLabelFragmentDescription_labelExpression_feature = Label Expression _UI_TreeItemLabelFragmentDescription_style_feature = Style _UI_TreeItemContextMenuEntry_name_feature = Name diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/FetchTreeItemContextMenuEntryKind.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/FetchTreeItemContextMenuEntryKind.java index fee9bb3bc5..4caa32fd09 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/FetchTreeItemContextMenuEntryKind.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/FetchTreeItemContextMenuEntryKind.java @@ -22,9 +22,9 @@ * A representation of the literals of the enumeration 'Fetch Tree Item Context Menu * Entry Kind', and utility methods for working with them. * + * @see org.eclipse.sirius.components.view.tree.TreePackage#getFetchTreeItemContextMenuEntryKind() * @model * @generated - * @see org.eclipse.sirius.components.view.tree.TreePackage#getFetchTreeItemContextMenuEntryKind() */ public enum FetchTreeItemContextMenuEntryKind implements Enumerator { /** diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/ForTreeItemLabelElementDescription.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/ForTreeItemLabelElementDescription.java new file mode 100644 index 0000000000..24149a8303 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/ForTreeItemLabelElementDescription.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2025 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree; + +import org.eclipse.emf.common.util.EList; + +/** + * A representation of the model object 'For Tree Item Label Element + * Description'. + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterator + * Iterator}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterableExpression + * Iterable Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getChildren + * Children}
  • + *
+ * + * @see org.eclipse.sirius.components.view.tree.TreePackage#getForTreeItemLabelElementDescription() + * @model + * @generated + */ +public interface ForTreeItemLabelElementDescription extends TreeItemLabelElementDescription { + /** + * Returns the value of the 'Iterator' attribute. + * + * @return the value of the 'Iterator' attribute. + * @see #setIterator(String) + * @see org.eclipse.sirius.components.view.tree.TreePackage#getForTreeItemLabelElementDescription_Iterator() + * @model + * @generated + */ + String getIterator(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterator + * Iterator}' attribute. + * + * @param value + * the new value of the 'Iterator' attribute. + * @see #getIterator() + * @generated + */ + void setIterator(String value); + + /** + * Returns the value of the 'Iterable Expression' attribute. + * + * @return the value of the 'Iterable Expression' attribute. + * @see #setIterableExpression(String) + * @see org.eclipse.sirius.components.view.tree.TreePackage#getForTreeItemLabelElementDescription_IterableExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getIterableExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterableExpression + * Iterable Expression}' attribute. + * + * @param value + * the new value of the 'Iterable Expression' attribute. + * @see #getIterableExpression() + * @generated + */ + void setIterableExpression(String value); + + /** + * Returns the value of the 'Children' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription}. + * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.sirius.components.view.tree.TreePackage#getForTreeItemLabelElementDescription_Children() + * @model containment="true" required="true" + * @generated + */ + EList getChildren(); + +} // ForTreeItemLabelElementDescription diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java index 780c5c3930..0ef89b9322 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java @@ -55,6 +55,15 @@ public interface TreeFactory extends EFactory { */ IfTreeItemLabelElementDescription createIfTreeItemLabelElementDescription(); + /** + * Returns a new object of class 'For Tree Item Label Element Description'. + * + * @return a new object of class 'For Tree Item Label Element Description'. + * @generated + */ + ForTreeItemLabelElementDescription createForTreeItemLabelElementDescription(); + /** * Returns a new object of class 'Item Label Fragment Description'. diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java index ff8ba1a43b..7e55531031 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java @@ -305,7 +305,7 @@ public interface TreePackage extends EPackage { * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelElementDescription() * @generated */ - int TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = 4; + int TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = 5; /** * The number of structural features of the 'Item Label Element Description' class. @@ -372,6 +372,61 @@ public interface TreePackage extends EPackage { */ int IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT + 0; + /** + * The meta object id for the + * '{@link org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl For Tree Item + * Label Element Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getForTreeItemLabelElementDescription() + * @generated + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = 3; + + /** + * The feature id for the 'Iterator' attribute. + * + * @generated + * @ordered + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Iterable Expression' attribute. + * + * @generated + * @ordered + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Children' containment reference list. + * + * @generated + * @ordered + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'For Tree Item Label Element Description' class. + * + * @generated + * @ordered + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 3; + + /** + * The number of operations of the 'For Tree Item Label Element Description' class. + * + * + * @generated + * @ordered + */ + int FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT + 0; + /** * The meta object id for the * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl Item Label Fragment @@ -381,7 +436,7 @@ public interface TreePackage extends EPackage { * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelFragmentDescription() * @generated */ - int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION = 3; + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION = 4; /** * The feature id for the 'Label Expression' attribute. @@ -490,7 +545,7 @@ public interface TreePackage extends EPackage { * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getSingleClickTreeItemContextMenuEntry() * @generated */ - int SINGLE_CLICK_TREE_ITEM_CONTEXT_MENU_ENTRY = 6; + int SINGLE_CLICK_TREE_ITEM_CONTEXT_MENU_ENTRY = 7; /** * The feature id for the 'Name' attribute. @@ -562,7 +617,7 @@ public interface TreePackage extends EPackage { * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getFetchTreeItemContextMenuEntry() * @generated */ - int FETCH_TREE_ITEM_CONTEXT_MENU_ENTRY = 7; + int FETCH_TREE_ITEM_CONTEXT_MENU_ENTRY = 8; /** * The feature id for the 'Name' attribute. @@ -641,7 +696,7 @@ public interface TreePackage extends EPackage { * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getFetchTreeItemContextMenuEntryKind() * @generated */ - int FETCH_TREE_ITEM_CONTEXT_MENU_ENTRY_KIND = 8; + int FETCH_TREE_ITEM_CONTEXT_MENU_ENTRY_KIND = 9; /** * The singleton instance of the package. @@ -897,6 +952,53 @@ public interface TreePackage extends EPackage { */ EReference getIfTreeItemLabelElementDescription_Children(); + /** + * Returns the meta object for class + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription For Tree Item Label + * Element Description}'. + * + * @return the meta object for class 'For Tree Item Label Element Description'. + * @see org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription + * @generated + */ + EClass getForTreeItemLabelElementDescription(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterator + * Iterator}'. + * + * @return the meta object for the attribute 'Iterator'. + * @see org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterator() + * @see #getForTreeItemLabelElementDescription() + * @generated + */ + EAttribute getForTreeItemLabelElementDescription_Iterator(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterableExpression + * Iterable Expression}'. + * + * @return the meta object for the attribute 'Iterable Expression'. + * @see org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getIterableExpression() + * @see #getForTreeItemLabelElementDescription() + * @generated + */ + EAttribute getForTreeItemLabelElementDescription_IterableExpression(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getChildren + * Children}'. + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription#getChildren() + * @see #getForTreeItemLabelElementDescription() + * @generated + */ + EReference getForTreeItemLabelElementDescription_Children(); + /** * Returns the meta object for class * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription Item Label Fragment @@ -1267,6 +1369,41 @@ interface Literals { */ EReference IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN = eINSTANCE.getIfTreeItemLabelElementDescription_Children(); + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl For Tree Item + * Label Element Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getForTreeItemLabelElementDescription() + * @generated + */ + EClass FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = eINSTANCE.getForTreeItemLabelElementDescription(); + + /** + * The meta object literal for the 'Iterator' attribute feature. + * + * @generated + */ + EAttribute FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR = eINSTANCE.getForTreeItemLabelElementDescription_Iterator(); + + /** + * The meta object literal for the 'Iterable Expression' attribute feature. + * + * @generated + */ + EAttribute FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION = eINSTANCE.getForTreeItemLabelElementDescription_IterableExpression(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * @generated + */ + EReference FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN = eINSTANCE.getForTreeItemLabelElementDescription_Children(); + /** * The meta object literal for the * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl Item Label diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/ForTreeItemLabelElementDescriptionImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/ForTreeItemLabelElementDescriptionImpl.java new file mode 100644 index 0000000000..da046475ff --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/ForTreeItemLabelElementDescriptionImpl.java @@ -0,0 +1,288 @@ +/******************************************************************************* + * Copyright (c) 2025 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * An implementation of the model object 'For Tree Item Label Element + * Description'. + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl#getIterator + * Iterator}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl#getIterableExpression + * Iterable Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.impl.ForTreeItemLabelElementDescriptionImpl#getChildren + * Children}
  • + *
+ * + * @generated + */ +public class ForTreeItemLabelElementDescriptionImpl extends TreeItemLabelElementDescriptionImpl implements ForTreeItemLabelElementDescription { + /** + * The default value of the '{@link #getIterator() Iterator}' attribute. + * + * @see #getIterator() + * @generated + * @ordered + */ + protected static final String ITERATOR_EDEFAULT = null; + + /** + * The cached value of the '{@link #getIterator() Iterator}' attribute. + * + * @see #getIterator() + * @generated + * @ordered + */ + protected String iterator = ITERATOR_EDEFAULT; + + /** + * The default value of the '{@link #getIterableExpression() Iterable Expression}' attribute. + * + * @see #getIterableExpression() + * @generated + * @ordered + */ + protected static final String ITERABLE_EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getIterableExpression() Iterable Expression}' attribute. + * + * @see #getIterableExpression() + * @generated + * @ordered + */ + protected String iterableExpression = ITERABLE_EXPRESSION_EDEFAULT; + + /** + * The cached value of the '{@link #getChildren() Children}' containment reference list. + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * @generated + */ + protected ForTreeItemLabelElementDescriptionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreePackage.Literals.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION; + } + + /** + * + * + * @generated + */ + @Override + public String getIterator() { + return this.iterator; + } + + /** + * + * + * @generated + */ + @Override + public void setIterator(String newIterator) { + String oldIterator = this.iterator; + this.iterator = newIterator; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR, oldIterator, this.iterator)); + } + + /** + * + * + * @generated + */ + @Override + public String getIterableExpression() { + return this.iterableExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setIterableExpression(String newIterableExpression) { + String oldIterableExpression = this.iterableExpression; + this.iterableExpression = newIterableExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION, oldIterableExpression, this.iterableExpression)); + } + + /** + * + * + * @generated + */ + @Override + public EList getChildren() { + if (this.children == null) { + this.children = new EObjectContainmentEList<>(TreeItemLabelElementDescription.class, this, TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN); + } + return this.children; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + return ((InternalEList) this.getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR: + return this.getIterator(); + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION: + return this.getIterableExpression(); + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + return this.getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR: + this.setIterator((String) newValue); + return; + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION: + this.setIterableExpression((String) newValue); + return; + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + this.getChildren().clear(); + this.getChildren().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR: + this.setIterator(ITERATOR_EDEFAULT); + return; + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION: + this.setIterableExpression(ITERABLE_EXPRESSION_EDEFAULT); + return; + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + this.getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR: + return ITERATOR_EDEFAULT == null ? this.iterator != null : !ITERATOR_EDEFAULT.equals(this.iterator); + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION: + return ITERABLE_EXPRESSION_EDEFAULT == null ? this.iterableExpression != null : !ITERABLE_EXPRESSION_EDEFAULT.equals(this.iterableExpression); + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN: + return this.children != null && !this.children.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (iterator: "); + result.append(this.iterator); + result.append(", iterableExpression: "); + result.append(this.iterableExpression); + result.append(')'); + return result.toString(); + } + +} // ForTreeItemLabelElementDescriptionImpl diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java index 75924da9d1..24b8440501 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.plugin.EcorePlugin; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntryKind; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.SingleClickTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.TreeDescription; @@ -74,6 +75,8 @@ public EObject create(EClass eClass) { return this.createTreeItemLabelDescription(); case TreePackage.IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION: return this.createIfTreeItemLabelElementDescription(); + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION: + return this.createForTreeItemLabelElementDescription(); case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION: return this.createTreeItemLabelFragmentDescription(); case TreePackage.SINGLE_CLICK_TREE_ITEM_CONTEXT_MENU_ENTRY: @@ -148,6 +151,17 @@ public IfTreeItemLabelElementDescription createIfTreeItemLabelElementDescription return ifTreeItemLabelElementDescription; } + /** + * + * + * @generated + */ + @Override + public ForTreeItemLabelElementDescription createForTreeItemLabelElementDescription() { + ForTreeItemLabelElementDescriptionImpl forTreeItemLabelElementDescription = new ForTreeItemLabelElementDescriptionImpl(); + return forTreeItemLabelElementDescription; + } + /** * * diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java index 4f27b73417..4ae1b832f0 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java @@ -21,6 +21,7 @@ import org.eclipse.sirius.components.view.ViewPackage; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntryKind; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.SingleClickTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.TreeDescription; @@ -59,6 +60,13 @@ public class TreePackageImpl extends EPackageImpl implements TreePackage { */ private EClass ifTreeItemLabelElementDescriptionEClass = null; + /** + * + * + * @generated + */ + private EClass forTreeItemLabelElementDescriptionEClass = null; + /** * * @@ -389,6 +397,46 @@ public EReference getIfTreeItemLabelElementDescription_Children() { return (EReference) this.ifTreeItemLabelElementDescriptionEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EClass getForTreeItemLabelElementDescription() { + return this.forTreeItemLabelElementDescriptionEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getForTreeItemLabelElementDescription_Iterator() { + return (EAttribute) this.forTreeItemLabelElementDescriptionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getForTreeItemLabelElementDescription_IterableExpression() { + return (EAttribute) this.forTreeItemLabelElementDescriptionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EReference getForTreeItemLabelElementDescription_Children() { + return (EReference) this.forTreeItemLabelElementDescriptionEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -585,6 +633,11 @@ public void createPackageContents() { this.createEAttribute(this.ifTreeItemLabelElementDescriptionEClass, IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__PREDICATE_EXPRESSION); this.createEReference(this.ifTreeItemLabelElementDescriptionEClass, IF_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN); + this.forTreeItemLabelElementDescriptionEClass = this.createEClass(FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION); + this.createEAttribute(this.forTreeItemLabelElementDescriptionEClass, FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERATOR); + this.createEAttribute(this.forTreeItemLabelElementDescriptionEClass, FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__ITERABLE_EXPRESSION); + this.createEReference(this.forTreeItemLabelElementDescriptionEClass, FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION__CHILDREN); + this.treeItemLabelFragmentDescriptionEClass = this.createEClass(TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION); this.createEAttribute(this.treeItemLabelFragmentDescriptionEClass, TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION); this.createEReference(this.treeItemLabelFragmentDescriptionEClass, TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE); @@ -634,6 +687,7 @@ public void initializePackageContents() { // Add supertypes to classes this.treeDescriptionEClass.getESuperTypes().add(theViewPackage.getRepresentationDescription()); this.ifTreeItemLabelElementDescriptionEClass.getESuperTypes().add(this.getTreeItemLabelElementDescription()); + this.forTreeItemLabelElementDescriptionEClass.getESuperTypes().add(this.getTreeItemLabelElementDescription()); this.treeItemLabelFragmentDescriptionEClass.getESuperTypes().add(this.getTreeItemLabelElementDescription()); this.singleClickTreeItemContextMenuEntryEClass.getESuperTypes().add(this.getTreeItemContextMenuEntry()); this.fetchTreeItemContextMenuEntryEClass.getESuperTypes().add(this.getTreeItemContextMenuEntry()); @@ -683,6 +737,15 @@ public void initializePackageContents() { this.initEReference(this.getIfTreeItemLabelElementDescription_Children(), this.getTreeItemLabelElementDescription(), null, "children", null, 1, -1, IfTreeItemLabelElementDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEClass(this.forTreeItemLabelElementDescriptionEClass, ForTreeItemLabelElementDescription.class, "ForTreeItemLabelElementDescription", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getForTreeItemLabelElementDescription_Iterator(), this.ecorePackage.getEString(), "iterator", null, 0, 1, ForTreeItemLabelElementDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getForTreeItemLabelElementDescription_IterableExpression(), theViewPackage.getInterpretedExpression(), "iterableExpression", null, 0, 1, + ForTreeItemLabelElementDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getForTreeItemLabelElementDescription_Children(), this.getTreeItemLabelElementDescription(), null, "children", null, 1, -1, ForTreeItemLabelElementDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEClass(this.treeItemLabelFragmentDescriptionEClass, TreeItemLabelFragmentDescription.class, "TreeItemLabelFragmentDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getTreeItemLabelFragmentDescription_LabelExpression(), theViewPackage.getInterpretedExpression(), "labelExpression", null, 0, 1, diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java index 534700ad89..1edc00d7b4 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java @@ -18,6 +18,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntry; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.SingleClickTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.TreeDescription; @@ -64,6 +65,11 @@ public Adapter caseIfTreeItemLabelElementDescription(IfTreeItemLabelElementDescr return TreeAdapterFactory.this.createIfTreeItemLabelElementDescriptionAdapter(); } + @Override + public Adapter caseForTreeItemLabelElementDescription(ForTreeItemLabelElementDescription object) { + return TreeAdapterFactory.this.createForTreeItemLabelElementDescriptionAdapter(); + } + @Override public Adapter caseTreeItemLabelFragmentDescription(TreeItemLabelFragmentDescription object) { return TreeAdapterFactory.this.createTreeItemLabelFragmentDescriptionAdapter(); @@ -185,6 +191,21 @@ public Adapter createIfTreeItemLabelElementDescriptionAdapter() { return null; } + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription For Tree Item Label + * Element Description}'. This default implementation returns null so that we can + * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription + * @generated + */ + public Adapter createForTreeItemLabelElementDescriptionAdapter() { + return null; + } + /** * Creates a new adapter for an object of class * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription Item Label Fragment diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java index 5c19fdee8d..179835e09a 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java @@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.util.Switch; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.tree.FetchTreeItemContextMenuEntry; +import org.eclipse.sirius.components.view.tree.ForTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.IfTreeItemLabelElementDescription; import org.eclipse.sirius.components.view.tree.SingleClickTreeItemContextMenuEntry; import org.eclipse.sirius.components.view.tree.TreeDescription; @@ -103,6 +104,15 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case TreePackage.FOR_TREE_ITEM_LABEL_ELEMENT_DESCRIPTION: { + ForTreeItemLabelElementDescription forTreeItemLabelElementDescription = (ForTreeItemLabelElementDescription) theEObject; + T result = this.caseForTreeItemLabelElementDescription(forTreeItemLabelElementDescription); + if (result == null) + result = this.caseTreeItemLabelElementDescription(forTreeItemLabelElementDescription); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION: { TreeItemLabelFragmentDescription treeItemLabelFragmentDescription = (TreeItemLabelFragmentDescription) theEObject; T result = this.caseTreeItemLabelFragmentDescription(treeItemLabelFragmentDescription); @@ -194,6 +204,22 @@ public T caseIfTreeItemLabelElementDescription(IfTreeItemLabelElementDescription return null; } + /** + * Returns the result of interpreting the object as an instance of 'For Tree Item Label Element + * Description'. This implementation returns null; returning a non-null result will + * terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'For Tree Item Label Element + * Description'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseForTreeItemLabelElementDescription(ForTreeItemLabelElementDescription object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Item Label Fragment Description'. This implementation returns null; returning a non-null result will terminate the switch.