From b6f2a74b6ea7e99e1a9b30102ef3b07c0efadb21 Mon Sep 17 00:00:00 2001 From: Jerome Gout Date: Wed, 15 Jan 2025 09:18:15 +0100 Subject: [PATCH] [4403] Add support of row actions in table view DSL Bug: https://github.com/eclipse-sirius/sirius-web/issues/4403 Signed-off-by: Jerome Gout --- ...yaViewTableControllerIntegrationTests.java | 121 +++++- .../tables/ViewTableDescriptionProvider.java | 16 +- .../tables/descriptions/LineDescription.java | 12 +- .../tables/descriptions/TableDescription.java | 7 +- .../table/RowContextMenuEntryBuilder.java | 95 +++++ .../table/RowDescriptionBuilder.java | 14 +- .../generated/table/TableBuilders.java | 12 +- .../ViewRowContextMenuEntryExecutor.java | 140 ++++++ .../ViewRowContextMenuEntryProvider.java | 139 ++++++ .../provider/CellDescriptionItemProvider.java | 77 ++-- ...ellLabelWidgetDescriptionItemProvider.java | 53 +-- ...extfieldWidgetDescriptionItemProvider.java | 74 ++-- .../ColumnDescriptionItemProvider.java | 117 ++--- .../RowContextMenuEntryItemProvider.java | 244 +++++++++++ .../provider/RowDescriptionItemProvider.java | 135 +++--- .../TableDescriptionItemProvider.java | 80 ++-- .../view/table/provider/TableEditPlugin.java | 31 +- .../TableElementDescriptionItemProvider.java | 91 ++-- .../TableItemProviderAdapterFactory.java | 152 ++++--- .../icons/full/obj16/RowContextMenuEntry.svg | 1 + .../src/main/resources/plugin.properties | 102 ++--- .../view/table/ColumnDescription.java | 50 +-- .../view/table/RowContextMenuEntry.java | 146 +++++++ .../components/view/table/RowDescription.java | 60 ++- .../view/table/TableDescription.java | 18 +- .../components/view/table/TableFactory.java | 10 +- .../components/view/table/TablePackage.java | 319 +++++++++++--- .../table/impl/ColumnDescriptionImpl.java | 105 +++-- .../table/impl/RowContextMenuEntryImpl.java | 402 ++++++++++++++++++ .../view/table/impl/RowDescriptionImpl.java | 151 +++++-- .../view/table/impl/TableDescriptionImpl.java | 20 +- .../view/table/impl/TableFactoryImpl.java | 16 +- .../view/table/impl/TablePackageImpl.java | 104 ++++- .../view/table/util/TableAdapterFactory.java | 22 +- .../view/table/util/TableSwitch.java | 25 +- .../src/main/resources/model/table.ecore | 11 + .../src/main/resources/model/table.genmodel | 10 +- 37 files changed, 2446 insertions(+), 736 deletions(-) create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowContextMenuEntryBuilder.java create mode 100644 packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryExecutor.java create mode 100644 packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryProvider.java create mode 100644 packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowContextMenuEntryItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-table-edit/src/main/resources/icons/full/obj16/RowContextMenuEntry.svg create mode 100644 packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowContextMenuEntry.java create mode 100644 packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowContextMenuEntryImpl.java diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/tables/PapayaViewTableControllerIntegrationTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/tables/PapayaViewTableControllerIntegrationTests.java index 5108c96034..d044e11338 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/tables/PapayaViewTableControllerIntegrationTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/tables/PapayaViewTableControllerIntegrationTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -15,14 +15,25 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; + import java.time.Duration; +import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; import org.eclipse.sirius.components.collaborative.dto.CreateRepresentationInput; import org.eclipse.sirius.components.collaborative.tables.TableRefreshedEventPayload; +import org.eclipse.sirius.components.collaborative.tables.dto.InvokeRowContextMenuEntryInput; +import org.eclipse.sirius.components.core.api.SuccessPayload; +import org.eclipse.sirius.components.tables.Table; import org.eclipse.sirius.components.tables.TextfieldCell; +import org.eclipse.sirius.components.tables.tests.graphql.InvokeRowContextMenuEntryMutationRunner; +import org.eclipse.sirius.components.tables.tests.graphql.RowContextMenuQueryRunner; import org.eclipse.sirius.web.AbstractIntegrationTests; import org.eclipse.sirius.web.data.PapayaIdentifiers; import org.eclipse.sirius.web.services.tables.ViewTableDescriptionProvider; @@ -59,6 +70,11 @@ public class PapayaViewTableControllerIntegrationTests extends AbstractIntegrati @Autowired private ViewTableDescriptionProvider viewTableDescriptionProvider; + @Autowired + private RowContextMenuQueryRunner rowContextMenuQueryRunner; + + @Autowired + private InvokeRowContextMenuEntryMutationRunner invokeRowContextMenuEntryMutationRunner; @BeforeEach public void beforeEach() { @@ -83,28 +99,97 @@ private Flux givenSubscriptionToViewTableRepresentation() { public void givenSimpleViewTableDescriptionWhenSubscriptionIsCreatedThenTableIsRender() { var flux = this.givenSubscriptionToViewTableRepresentation(); - Consumer tableContentConsumer = payload -> Optional.of(payload) - .filter(TableRefreshedEventPayload.class::isInstance) - .map(TableRefreshedEventPayload.class::cast) - .map(TableRefreshedEventPayload::table) - .ifPresentOrElse(table -> { - assertThat(table).isNotNull(); - assertThat(table.getColumns()).hasSize(1); - assertThat(table.getColumns().get(0).getHeaderLabel()).isEqualTo("Name"); - assertThat(table.getColumns().get(0).getHeaderIndexLabel()).isEqualTo("0"); - assertThat(table.getLines()).hasSize(2); - assertThat(table.getLines().get(0).getHeaderIndexLabel()).isEqualTo("0"); - assertThat(table.getLines().get(0).getCells().get(0)).isInstanceOf(TextfieldCell.class); - assertThat(((TextfieldCell) table.getLines().get(0).getCells().get(0)).getValue()).isEqualTo("Success"); - assertThat(table.getLines().get(1).getHeaderIndexLabel()).isEqualTo("1"); - assertThat(table.getLines().get(1).getCells().get(0)).isInstanceOf(TextfieldCell.class); - assertThat(((TextfieldCell) table.getLines().get(1).getCells().get(0)).getValue()).isEqualTo("Failure"); - }, () -> fail("Missing table")); + Consumer tableContentConsumer = this.getTableSubscriptionConsumer(table -> { + assertThat(table).isNotNull(); + assertThat(table.getColumns()).hasSize(1); + assertThat(table.getColumns().get(0).getHeaderLabel()).isEqualTo("Name"); + assertThat(table.getColumns().get(0).getHeaderIndexLabel()).isEqualTo("0"); + assertThat(table.getLines()).hasSize(2); + assertThat(table.getLines().get(0).getHeaderIndexLabel()).isEqualTo("0"); + assertThat(table.getLines().get(0).getCells().get(0)).isInstanceOf(TextfieldCell.class); + assertThat(((TextfieldCell) table.getLines().get(0).getCells().get(0)).getValue()).isEqualTo("Success"); + assertThat(table.getLines().get(1).getHeaderIndexLabel()).isEqualTo("1"); + assertThat(table.getLines().get(1).getCells().get(0)).isInstanceOf(TextfieldCell.class); + assertThat(((TextfieldCell) table.getLines().get(1).getCells().get(0)).getValue()).isEqualTo("Failure"); + }); + + StepVerifier.create(flux) + .consumeNextWith(tableContentConsumer) + .thenCancel() + .verify(Duration.ofSeconds(10)); + } + + @Test + @DisplayName("Given a simple view table description, when a row context menu entry is retrieved and invoked, then the row context menu entry is correctly executed") + @Sql(scripts = {"/scripts/papaya.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) + @Sql(scripts = {"/scripts/cleanup.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) + public void givenSimpleViewTableDescriptionWhenRowContextMenuEntryIsInvokedThenRowContextMenuEntryIsCorrectlyExecuted() { + var flux = this.givenSubscriptionToViewTableRepresentation(); + + var tableId = new AtomicReference(); + var rowId = new AtomicReference(); + var rowLabel = new AtomicReference(); + Consumer tableContentConsumer = this.getTableSubscriptionConsumer(table -> { + assertThat(table).isNotNull(); + assertThat(table.getLines()).hasSize(2); + tableId.set(table.getId()); + rowId.set(table.getLines().get(0).getId()); + rowLabel.set(table.getLines().get(0).getHeaderLabel()); + }); + + var actionId = new AtomicReference(); + Runnable getContextMenuEntriesTask = () -> { + Map variables = Map.of( + "editingContextId", PapayaIdentifiers.PAPAYA_PROJECT.toString(), + "representationId", tableId.get(), + "tableId", tableId.get(), + "rowId", rowId.get().toString()); + var result = this.rowContextMenuQueryRunner.run(variables); + Object document = Configuration.defaultConfiguration().jsonProvider().parse(result); + + List actionLabels = JsonPath.read(document, "$.data.viewer.editingContext.representation.description.contextMenuEntries[*].label"); + assertThat(actionLabels).isNotEmpty().hasSize(1); + assertThat(actionLabels.get(0)).isEqualTo("Change name"); + + List actionIds = JsonPath.read(document, "$.data.viewer.editingContext.representation.description.contextMenuEntries[*].id"); + actionId.set(actionIds.get(0)); + }; + + Runnable invokeChangeNameAction = () -> { + var invokeRowContextMenuEntryInput = new InvokeRowContextMenuEntryInput( + UUID.randomUUID(), + PapayaIdentifiers.PAPAYA_PROJECT.toString(), + tableId.get(), + tableId.get(), + rowId.get(), + actionId.get() + ); + var result = this.invokeRowContextMenuEntryMutationRunner.run(invokeRowContextMenuEntryInput); + + String typename = JsonPath.read(result, "$.data.invokeRowContextMenuEntry.__typename"); + assertThat(typename).isEqualTo(SuccessPayload.class.getSimpleName()); + }; + + Consumer updatedTableContentConsumer = this.getTableSubscriptionConsumer(table -> { + assertThat(table).isNotNull(); + assertThat(table.getLines().get(0).getHeaderLabel()).isEqualTo(rowLabel + "Updated"); + }); StepVerifier.create(flux) .consumeNextWith(tableContentConsumer) + .then(getContextMenuEntriesTask) + .then(invokeChangeNameAction) + .consumeNextWith(updatedTableContentConsumer) .thenCancel() .verify(Duration.ofSeconds(10)); } + private Consumer getTableSubscriptionConsumer(Consumer tableConsumer) { + return payload -> Optional.of(payload) + .filter(TableRefreshedEventPayload.class::isInstance) + .map(TableRefreshedEventPayload.class::cast) + .map(TableRefreshedEventPayload::table) + .ifPresentOrElse(tableConsumer, () -> fail("Missing table")); + } + } diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/tables/ViewTableDescriptionProvider.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/tables/ViewTableDescriptionProvider.java index b7aea7cf0d..7b1d51d053 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/tables/ViewTableDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/tables/ViewTableDescriptionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -24,6 +24,7 @@ import org.eclipse.sirius.components.view.View; import org.eclipse.sirius.components.view.builder.generated.table.TableBuilders; import org.eclipse.sirius.components.view.builder.generated.view.ViewBuilder; +import org.eclipse.sirius.components.view.builder.generated.view.ViewBuilders; import org.eclipse.sirius.components.view.emf.table.TableIdProvider; import org.eclipse.sirius.components.view.table.TableDescription; import org.eclipse.sirius.emfjson.resource.JsonResource; @@ -88,9 +89,22 @@ private TableDescription createTableDescription() { .headerIndexLabelExpression("aql:columnIndex") .build(); + var callService = new ViewBuilders().newSetValue() + .featureName("name") + .valueExpression("aql:self.name + 'Updated'"); + + var contextMenuEntry = new TableBuilders().newRowContextMenuEntry() + .name("change-name") + .labelExpression("Change name") + .preconditionExpression("aql:true") + .body(callService.build()) + .build(); + var rowDescription = new TableBuilders().newRowDescription() .semanticCandidatesExpression("aql:self.types") .headerIndexLabelExpression("aql:rowIndex") + .headerLabelExpression("aql:self.name") + .contextMenuEntries(contextMenuEntry) .build(); var cellDescription = new TableBuilders().newCellDescription() diff --git a/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/LineDescription.java b/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/LineDescription.java index 2d983d52d5..1fdc645352 100644 --- a/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/LineDescription.java +++ b/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/LineDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 Obeo. + * Copyright (c) 2024, 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 @@ -29,6 +29,16 @@ @Immutable public final class LineDescription { + /** + * The variable name used to store a reference to a row. + */ + public static final String SELECTED_ROW = "selectedRow"; + + /** + * The variable name used for the id of a row. + */ + public static final String ID = "id"; + private String id; private Function targetObjectIdProvider; diff --git a/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/TableDescription.java b/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/TableDescription.java index fa6dc3d251..14c59668e9 100644 --- a/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/TableDescription.java +++ b/packages/tables/backend/sirius-components-tables/src/main/java/org/eclipse/sirius/components/tables/descriptions/TableDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 Obeo. + * Copyright (c) 2024, 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 @@ -33,6 +33,11 @@ public final class TableDescription implements IRepresentationDescription { public static final String LABEL = "label"; + /** + * The variable name used to store a reference to a table. + */ + public static final String TABLE = "table"; + private String id; private String label; diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowContextMenuEntryBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowContextMenuEntryBuilder.java new file mode 100644 index 0000000000..8f9a09ac14 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowContextMenuEntryBuilder.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * 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.table; + +/** + * Builder for RowContextMenuEntryBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class RowContextMenuEntryBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.table.RowContextMenuEntry. + * @generated + */ + private org.eclipse.sirius.components.view.table.RowContextMenuEntry rowContextMenuEntry = org.eclipse.sirius.components.view.table.TableFactory.eINSTANCE.createRowContextMenuEntry(); + + /** + * Return instance org.eclipse.sirius.components.view.table.RowContextMenuEntry. + * @generated + */ + protected org.eclipse.sirius.components.view.table.RowContextMenuEntry getRowContextMenuEntry() { + return this.rowContextMenuEntry; + } + + /** + * Return instance org.eclipse.sirius.components.view.table.RowContextMenuEntry. + * @generated + */ + public org.eclipse.sirius.components.view.table.RowContextMenuEntry build() { + return this.getRowContextMenuEntry(); + } + + /** + * Setter for Name. + * + * @generated + */ + public RowContextMenuEntryBuilder name(java.lang.String value) { + this.getRowContextMenuEntry().setName(value); + return this; + } + /** + * Setter for LabelExpression. + * + * @generated + */ + public RowContextMenuEntryBuilder labelExpression(java.lang.String value) { + this.getRowContextMenuEntry().setLabelExpression(value); + return this; + } + /** + * Setter for IconURLExpression. + * + * @generated + */ + public RowContextMenuEntryBuilder iconURLExpression(java.lang.String value) { + this.getRowContextMenuEntry().setIconURLExpression(value); + return this; + } + /** + * Setter for PreconditionExpression. + * + * @generated + */ + public RowContextMenuEntryBuilder preconditionExpression(java.lang.String value) { + this.getRowContextMenuEntry().setPreconditionExpression(value); + return this; + } + /** + * Setter for Body. + * + * @generated + */ + public RowContextMenuEntryBuilder body(org.eclipse.sirius.components.view.Operation ... values) { + for (org.eclipse.sirius.components.view.Operation value : values) { + this.getRowContextMenuEntry().getBody().add(value); + } + return this; + } + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowDescriptionBuilder.java index cff660bcc8..3f246ef92f 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/RowDescriptionBuilder.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 @@ -124,5 +124,17 @@ public RowDescriptionBuilder isResizableExpression(java.lang.String value) { return this; } + /** + * Setter for ContextMenuEntries. + * + * @generated + */ + public RowDescriptionBuilder contextMenuEntries(org.eclipse.sirius.components.view.table.RowContextMenuEntry ... values) { + for (org.eclipse.sirius.components.view.table.RowContextMenuEntry value : values) { + this.getRowDescription().getContextMenuEntries().add(value); + } + return this; + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/TableBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/TableBuilders.java index 4d7ee2a773..3e10db94df 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/TableBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/table/TableBuilders.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 @@ -79,5 +79,15 @@ public CellLabelWidgetDescriptionBuilder newCellLabelWidgetDescription() { return new CellLabelWidgetDescriptionBuilder(); } + /** + * Instantiate a RowContextMenuEntryBuilder . + * + * @author BuilderGenerator + * @generated + */ + public RowContextMenuEntryBuilder newRowContextMenuEntry() { + return new RowContextMenuEntryBuilder(); + } + } diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryExecutor.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryExecutor.java new file mode 100644 index 0000000000..ac52dd9137 --- /dev/null +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryExecutor.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2025 CEA LIST. + * 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.emf.table; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; +import java.util.function.Function; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.components.collaborative.api.ChangeKind; +import org.eclipse.sirius.components.collaborative.tables.api.IRowContextMenuEntryExecutor; +import org.eclipse.sirius.components.core.api.IEditService; +import org.eclipse.sirius.components.core.api.IEditingContext; +import org.eclipse.sirius.components.core.api.IFeedbackMessageService; +import org.eclipse.sirius.components.core.api.IObjectSearchService; +import org.eclipse.sirius.components.interpreter.AQLInterpreter; +import org.eclipse.sirius.components.representations.Failure; +import org.eclipse.sirius.components.representations.IStatus; +import org.eclipse.sirius.components.representations.Message; +import org.eclipse.sirius.components.representations.MessageLevel; +import org.eclipse.sirius.components.representations.Success; +import org.eclipse.sirius.components.representations.VariableManager; +import org.eclipse.sirius.components.tables.Line; +import org.eclipse.sirius.components.tables.Table; +import org.eclipse.sirius.components.tables.descriptions.LineDescription; +import org.eclipse.sirius.components.tables.descriptions.TableDescription; +import org.eclipse.sirius.components.view.Operation; +import org.eclipse.sirius.components.view.View; +import org.eclipse.sirius.components.view.emf.IViewRepresentationDescriptionSearchService; +import org.eclipse.sirius.components.view.emf.OperationInterpreter; +import org.eclipse.sirius.components.view.emf.ViewRepresentationDescriptionPredicate; +import org.eclipse.sirius.components.view.emf.api.IViewAQLInterpreterFactory; +import org.springframework.stereotype.Service; + +/** + * This class is in charge of delegate row context menu entry invocation for table view DSL. + * + * @author Jerome Gout + */ +@Service +public class ViewRowContextMenuEntryExecutor implements IRowContextMenuEntryExecutor { + + private final ViewRepresentationDescriptionPredicate viewRepresentationDescriptionPredicate; + + private final IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService; + + private final IViewAQLInterpreterFactory aqlInterpreterFactory; + + private final IFeedbackMessageService feedbackMessageService; + + private final IEditService editService; + + private final IObjectSearchService objectSearchService; + + private final Function idProvider = (eObject) -> UUID.nameUUIDFromBytes(EcoreUtil.getURI(eObject).toString().getBytes()); + + public ViewRowContextMenuEntryExecutor(ViewRepresentationDescriptionPredicate viewRepresentationDescriptionPredicate, + IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService, IViewAQLInterpreterFactory aqlInterpreterFactory, IFeedbackMessageService feedbackMessageService, + IEditService editService, IObjectSearchService objectSearchService) { + this.viewRepresentationDescriptionPredicate = Objects.requireNonNull(viewRepresentationDescriptionPredicate); + this.viewRepresentationDescriptionSearchService = Objects.requireNonNull(viewRepresentationDescriptionSearchService); + this.aqlInterpreterFactory = Objects.requireNonNull(aqlInterpreterFactory); + this.feedbackMessageService = Objects.requireNonNull(feedbackMessageService); + this.editService = Objects.requireNonNull(editService); + this.objectSearchService = Objects.requireNonNull(objectSearchService); + } + + @Override + public boolean canExecute(TableDescription tableDescription, String tableId, String rowId, String rowMenuContextEntryId) { + return this.viewRepresentationDescriptionPredicate.test(tableDescription); + } + + @Override + public IStatus execute(IEditingContext editingContext, TableDescription tableDescription, Table table, Line row, String rowMenuContextEntryId) { + var optionalTableDescription = this.viewRepresentationDescriptionSearchService + .findById(editingContext, tableDescription.getId()) + .filter(org.eclipse.sirius.components.view.table.TableDescription.class::isInstance) + .map(org.eclipse.sirius.components.view.table.TableDescription.class::cast); + if (optionalTableDescription.isPresent()) { + var viewTableDescription = optionalTableDescription.get(); + + AQLInterpreter interpreter = this.aqlInterpreterFactory.createInterpreter(editingContext, (View) viewTableDescription.eContainer()); + + VariableManager variableManager = new VariableManager(); + variableManager.put(IEditingContext.EDITING_CONTEXT, editingContext); + variableManager.put(TableDescription.TABLE, table); + variableManager.put(LineDescription.SELECTED_ROW, row); + variableManager.put(LineDescription.ID, row.getId()); + var optionalSemanticObject = this.objectSearchService.getObject(editingContext, row.getTargetObjectId()); + if (optionalSemanticObject.isPresent()) { + var semanticObject = optionalSemanticObject.get(); + variableManager.put(VariableManager.SELF, semanticObject); + var contextMenuEntry = viewTableDescription.getRowDescription().getContextMenuEntries().stream() + .filter(entry -> Objects.equals(rowMenuContextEntryId, this.idProvider.apply(entry).toString())) + .findFirst(); + if (contextMenuEntry.isPresent()) { + return this.executeOperations(variableManager, interpreter, contextMenuEntry.get().getBody()); + } + } + } + return this.buildFailureWithFeedbackMessages("Something went wrong while handling the context menu action"); + } + + private IStatus executeOperations(VariableManager variableManager, AQLInterpreter interpreter, List operations) { + OperationInterpreter operationInterpreter = new OperationInterpreter(interpreter, this.editService); + Optional optionalVariableManager = operationInterpreter.executeOperations(operations, variableManager); + if (optionalVariableManager.isEmpty()) { + return this.buildFailureWithFeedbackMessages("Something went wrong while handling the context menu action"); + } else { + return this.buildSuccessWithSemanticChangeAndFeedbackMessages(); + } + } + + private Failure buildFailureWithFeedbackMessages(String message) { + List errorMessages = new ArrayList<>(); + errorMessages.add(new Message(message, MessageLevel.ERROR)); + errorMessages.addAll(this.feedbackMessageService.getFeedbackMessages()); + return new Failure(errorMessages); + } + + private Success buildSuccessWithSemanticChangeAndFeedbackMessages() { + return new Success(ChangeKind.SEMANTIC_CHANGE, Map.of(), this.feedbackMessageService.getFeedbackMessages()); + } +} diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryProvider.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryProvider.java new file mode 100644 index 0000000000..6e81f19495 --- /dev/null +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/table/ViewRowContextMenuEntryProvider.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2025 CEA LIST. + * 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.emf.table; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; +import java.util.function.Function; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.components.collaborative.tables.api.IRowContextMenuEntryProvider; +import org.eclipse.sirius.components.collaborative.tables.dto.RowContextMenuEntry; +import org.eclipse.sirius.components.core.api.IEditingContext; +import org.eclipse.sirius.components.core.api.IObjectSearchService; +import org.eclipse.sirius.components.interpreter.AQLInterpreter; +import org.eclipse.sirius.components.representations.VariableManager; +import org.eclipse.sirius.components.tables.Line; +import org.eclipse.sirius.components.tables.Table; +import org.eclipse.sirius.components.tables.descriptions.LineDescription; +import org.eclipse.sirius.components.tables.descriptions.TableDescription; +import org.eclipse.sirius.components.view.View; +import org.eclipse.sirius.components.view.emf.IViewRepresentationDescriptionSearchService; +import org.eclipse.sirius.components.view.emf.ViewRepresentationDescriptionPredicate; +import org.eclipse.sirius.components.view.emf.api.IViewAQLInterpreterFactory; +import org.springframework.stereotype.Service; + +/** + * Table row context menu entries provider for view table model. + * + * @author Jerome Gout + */ +@Service +public class ViewRowContextMenuEntryProvider implements IRowContextMenuEntryProvider { + + private final ViewRepresentationDescriptionPredicate viewRepresentationDescriptionPredicate; + + private final IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService; + + private final IViewAQLInterpreterFactory aqlInterpreterFactory; + + private final IObjectSearchService objectSearchService; + + private final Function idProvider = (eObject) -> UUID.nameUUIDFromBytes(EcoreUtil.getURI(eObject).toString().getBytes()); + + public ViewRowContextMenuEntryProvider(ViewRepresentationDescriptionPredicate viewRepresentationDescriptionPredicate, + IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService, IViewAQLInterpreterFactory aqlInterpreterFactory, IObjectSearchService objectSearchService) { + this.viewRepresentationDescriptionPredicate = Objects.requireNonNull(viewRepresentationDescriptionPredicate); + this.viewRepresentationDescriptionSearchService = Objects.requireNonNull(viewRepresentationDescriptionSearchService); + this.aqlInterpreterFactory = Objects.requireNonNull(aqlInterpreterFactory); + this.objectSearchService = Objects.requireNonNull(objectSearchService); + } + + @Override + public boolean canHandle(IEditingContext editingContext, TableDescription tableDescription, Table table, Line row) { + return this.viewRepresentationDescriptionPredicate.test(tableDescription); + } + + @Override + public List getRowContextMenuEntries(IEditingContext editingContext, TableDescription tableDescription, Table table, Line row) { + var optionalTableDescription = this.viewRepresentationDescriptionSearchService + .findById(editingContext, tableDescription.getId()) + .filter(org.eclipse.sirius.components.view.table.TableDescription.class::isInstance) + .map(org.eclipse.sirius.components.view.table.TableDescription.class::cast); + if (optionalTableDescription.isPresent()) { + var viewTableDescription = optionalTableDescription.get(); + + AQLInterpreter interpreter = this.aqlInterpreterFactory.createInterpreter(editingContext, (View) viewTableDescription.eContainer()); + + VariableManager variableManager = new VariableManager(); + variableManager.put(IEditingContext.EDITING_CONTEXT, editingContext); + variableManager.put(TableDescription.TABLE, table); + variableManager.put(LineDescription.SELECTED_ROW, row); + variableManager.put(LineDescription.ID, row.getId()); + var optionalSemanticObject = this.objectSearchService.getObject(editingContext, row.getTargetObjectId()); + if (optionalSemanticObject.isPresent()) { + var semanticObject = optionalSemanticObject.get(); + variableManager.put(VariableManager.SELF, semanticObject); + return viewTableDescription.getRowDescription().getContextMenuEntries().stream() + .filter(viewAction -> this.isValidActionPrecondition(viewAction, variableManager, interpreter)) + .map(rowContextMenuEntry -> this.convertContextAction(rowContextMenuEntry, variableManager, interpreter)) + .toList(); + } + } + return List.of(); + } + + private boolean isValidActionPrecondition(org.eclipse.sirius.components.view.table.RowContextMenuEntry viewContextAction, VariableManager variableManager, AQLInterpreter interpreter) { + var precondition = viewContextAction.getPreconditionExpression(); + if (precondition != null && !precondition.isBlank()) { + return this.evaluateBoolean(variableManager, interpreter, precondition); + } + return false; + } + + private RowContextMenuEntry convertContextAction(org.eclipse.sirius.components.view.table.RowContextMenuEntry viewTreeItemContextAction, VariableManager variableManager, AQLInterpreter interpreter) { + var id = this.idProvider.apply(viewTreeItemContextAction).toString(); + var label = this.evaluateString(variableManager, interpreter, viewTreeItemContextAction.getLabelExpression()); + var iconURL = this.evaluateStringList(variableManager, interpreter, viewTreeItemContextAction.getIconURLExpression()); + + return new RowContextMenuEntry(id, label, iconURL); + } + + private String evaluateString(VariableManager variableManager, AQLInterpreter interpreter, String expression) { + return interpreter.evaluateExpression(variableManager.getVariables(), expression) + .asString() + .orElse(""); + } + + private List evaluateStringList(VariableManager variableManager, AQLInterpreter interpreter, String expression) { + List values = new ArrayList<>(); + if (expression != null && !expression.isBlank()) { + Optional> optionalResult = interpreter.evaluateExpression(variableManager.getVariables(), expression).asObjects(); + if (optionalResult.isPresent()) { + values = optionalResult.get().stream().filter(String.class::isInstance).map(String.class::cast).toList(); + } + } + return values; + } + + private Boolean evaluateBoolean(VariableManager variableManager, AQLInterpreter interpreter, String expression) { + return interpreter.evaluateExpression(variableManager.getVariables(), expression) + .asBoolean() + .orElse(true); + } +} diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellDescriptionItemProvider.java index 92525cd72c..a815f26237 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -27,8 +27,7 @@ import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.CellDescription} object. * * @generated @@ -36,8 +35,7 @@ public class CellDescriptionItemProvider extends TableElementDescriptionItemProvider { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -46,8 +44,7 @@ public CellDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -63,43 +60,34 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Value Expression feature. + * This adds a property descriptor for the Value Expression feature. * * @generated */ protected void addValueExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_CellDescription_valueExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_CellDescription_valueExpression_feature", - "_UI_CellDescription_type"), - TablePackage.Literals.CELL_DESCRIPTION__VALUE_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_CellDescription_valueExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_CellDescription_valueExpression_feature", "_UI_CellDescription_type"), + TablePackage.Literals.CELL_DESCRIPTION__VALUE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Tooltip Expression feature. + * This adds a property descriptor for the Tooltip Expression feature. * * @generated */ protected void addTooltipExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_CellDescription_tooltipExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_CellDescription_tooltipExpression_feature", - "_UI_CellDescription_type"), - TablePackage.Literals.CELL_DESCRIPTION__TOOLTIP_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_CellDescription_tooltipExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_CellDescription_tooltipExpression_feature", "_UI_CellDescription_type"), + TablePackage.Literals.CELL_DESCRIPTION__TOOLTIP_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}. - * + * 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 */ @@ -119,16 +107,14 @@ public Collection getChildrenFeatures(Object objec */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to - // use for + // 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 CellDescription.gif. + * This returns CellDescription.gif. * * @generated NOT */ @@ -148,22 +134,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((CellDescription) object).getName(); - return label == null || label.length() == 0 ? this.getString("_UI_CellDescription_type") - : this.getString("_UI_CellDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_CellDescription_type") : this.getString("_UI_CellDescription_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}. + * 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 */ @@ -184,9 +168,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated */ @@ -194,11 +177,9 @@ public void notifyChanged(Notification notification) { protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_DESCRIPTION__CELL_WIDGET_DESCRIPTION, - TableFactory.eINSTANCE.createCellTextfieldWidgetDescription())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_DESCRIPTION__CELL_WIDGET_DESCRIPTION, TableFactory.eINSTANCE.createCellTextfieldWidgetDescription())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_DESCRIPTION__CELL_WIDGET_DESCRIPTION, - TableFactory.eINSTANCE.createCellLabelWidgetDescription())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_DESCRIPTION__CELL_WIDGET_DESCRIPTION, TableFactory.eINSTANCE.createCellLabelWidgetDescription())); } } diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellLabelWidgetDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellLabelWidgetDescriptionItemProvider.java index a2927eb4d2..318a5037b0 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellLabelWidgetDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellLabelWidgetDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -33,18 +33,16 @@ import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription} + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription} * object. * * @generated */ -public class CellLabelWidgetDescriptionItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, - IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { +public class CellLabelWidgetDescriptionItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -53,8 +51,7 @@ public CellLabelWidgetDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -69,31 +66,25 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Icon Expression feature. + * This adds a property descriptor for the Icon Expression feature. * * @generated */ protected void addIconExpressionPropertyDescriptor(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_CellLabelWidgetDescription_iconExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_CellLabelWidgetDescription_iconExpression_feature", - "_UI_CellLabelWidgetDescription_type"), - TablePackage.Literals.CELL_LABEL_WIDGET_DESCRIPTION__ICON_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_CellLabelWidgetDescription_iconExpression_feature", "_UI_CellLabelWidgetDescription_type"), + TablePackage.Literals.CELL_LABEL_WIDGET_DESCRIPTION__ICON_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This returns CellLabelWidgetDescription.gif. + * This returns CellLabelWidgetDescription.gif. * * @generated NOT */ @Override public Object getImage(Object object) { - return this.overlayImage(object, - this.getResourceLocator().getImage("full/obj16/CellLabelWidgetDescription.svg")); + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/CellLabelWidgetDescription.svg")); } /** @@ -107,22 +98,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((CellLabelWidgetDescription) object).getIconExpression(); - return label == null || label.length() == 0 ? this.getString("_UI_CellLabelWidgetDescription_type") - : this.getString("_UI_CellLabelWidgetDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_CellLabelWidgetDescription_type") : this.getString("_UI_CellLabelWidgetDescription_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}. + * 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 */ @@ -139,9 +128,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated */ @@ -151,8 +139,7 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors } /** - * Return the resource locator for this item provider's resources. + * Return the resource locator for this item provider's resources. * * @generated */ diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellTextfieldWidgetDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellTextfieldWidgetDescriptionItemProvider.java index fd85f6a8bd..7cadecba78 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellTextfieldWidgetDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/CellTextfieldWidgetDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -34,18 +34,16 @@ /** * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription} - * object. + * {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription} object. * * @generated */ public class CellTextfieldWidgetDescriptionItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, - IItemLabelProvider, IItemPropertySource { + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -54,8 +52,7 @@ public CellTextfieldWidgetDescriptionItemProvider(AdapterFactory adapterFactory) } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -69,11 +66,10 @@ public List getPropertyDescriptors(Object object) { } /** - * 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}. - * + * 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 */ @@ -93,23 +89,20 @@ public Collection getChildrenFeatures(Object objec */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to - // use for + // 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 CellTextfieldWidgetDescription.gif. + * This returns CellTextfieldWidgetDescription.gif. * * @generated NOT */ @Override public Object getImage(Object object) { - return this.overlayImage(object, - this.getResourceLocator().getImage("full/obj16/CellTextfieldWidgetDescription.svg")); + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/CellTextfieldWidgetDescription.svg")); } /** @@ -123,8 +116,7 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @@ -134,9 +126,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}. + * 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 */ @@ -153,9 +145,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated */ @@ -163,34 +154,25 @@ public void notifyChanged(Notification notification) { protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createChangeContext())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createChangeContext())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createCreateInstance())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createCreateInstance())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createSetValue())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createSetValue())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createUnsetValue())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createUnsetValue())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createDeleteElement())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createDeleteElement())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createLet())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createLet())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createIf())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createIf())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, - ViewFactory.eINSTANCE.createFor())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.CELL_TEXTFIELD_WIDGET_DESCRIPTION__BODY, ViewFactory.eINSTANCE.createFor())); } /** - * Return the resource locator for this item provider's resources. + * Return the resource locator for this item provider's resources. * * @generated */ diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/ColumnDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/ColumnDescriptionItemProvider.java index 9cf4a9b09f..f87cdf172f 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/ColumnDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/ColumnDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -25,8 +25,7 @@ import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.ColumnDescription} object. + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.table.ColumnDescription} object. * * * @generated @@ -34,8 +33,7 @@ public class ColumnDescriptionItemProvider extends TableElementDescriptionItemProvider { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -44,8 +42,7 @@ public ColumnDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -65,104 +62,85 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Header Index Label Expression - * feature. + * This adds a property descriptor for the Header Index Label Expression feature. * * @generated */ protected void addHeaderIndexLabelExpressionPropertyDescriptor(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_ColumnDescription_headerIndexLabelExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_ColumnDescription_headerIndexLabelExpression_feature", "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_INDEX_LABEL_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_headerIndexLabelExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_INDEX_LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Header Label Expression feature. + * This adds a property descriptor for the Header Label Expression feature. * * @generated */ protected void addHeaderLabelExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_ColumnDescription_headerLabelExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_ColumnDescription_headerLabelExpression_feature", "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_LABEL_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ColumnDescription_headerLabelExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_headerLabelExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Header Icon Expression feature. + * This adds a property descriptor for the Header Icon Expression feature. * * @generated */ protected void addHeaderIconExpressionPropertyDescriptor(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_ColumnDescription_headerIconExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_headerIconExpression_feature", - "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_ICON_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_headerIconExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__HEADER_ICON_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Initial Width Expression feature. - * + * This adds a property descriptor for the Initial Width Expression feature. * * @generated */ protected void addInitialWidthExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_ColumnDescription_initialWidthExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_ColumnDescription_initialWidthExpression_feature", "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__INITIAL_WIDTH_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ColumnDescription_initialWidthExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_initialWidthExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__INITIAL_WIDTH_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Is Resizable Expression feature. + * This adds a property descriptor for the Is Resizable Expression feature. * * @generated */ protected void addIsResizableExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_ColumnDescription_isResizableExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_ColumnDescription_isResizableExpression_feature", "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__IS_RESIZABLE_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ColumnDescription_isResizableExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_isResizableExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__IS_RESIZABLE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Filter Widget Expression feature. - * + * This adds a property descriptor for the Filter Widget Expression feature. * * @generated */ protected void addFilterWidgetExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_ColumnDescription_filterWidgetExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_ColumnDescription_filterWidgetExpression_feature", "_UI_ColumnDescription_type"), - TablePackage.Literals.COLUMN_DESCRIPTION__FILTER_WIDGET_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_ColumnDescription_filterWidgetExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_ColumnDescription_filterWidgetExpression_feature", "_UI_ColumnDescription_type"), + TablePackage.Literals.COLUMN_DESCRIPTION__FILTER_WIDGET_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This returns ColumnDescription.gif. + * This returns ColumnDescription.gif. * * @generated NOT */ @@ -182,22 +160,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((ColumnDescription) object).getName(); - return label == null || label.length() == 0 ? this.getString("_UI_ColumnDescription_type") - : this.getString("_UI_ColumnDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_ColumnDescription_type") : this.getString("_UI_ColumnDescription_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}. + * 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 */ @@ -219,9 +195,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated */ diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowContextMenuEntryItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowContextMenuEntryItemProvider.java new file mode 100644 index 0000000000..919b9d4600 --- /dev/null +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowContextMenuEntryItemProvider.java @@ -0,0 +1,244 @@ +/******************************************************************************* + * 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.table.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.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IChildCreationExtender; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.components.view.ViewFactory; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; +import org.eclipse.sirius.components.view.table.TablePackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry} object. + * + * + * @generated + */ +public class RowContextMenuEntryItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public RowContextMenuEntryItemProvider(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.addNamePropertyDescriptor(object); + this.addLabelExpressionPropertyDescriptor(object); + this.addIconURLExpressionPropertyDescriptor(object); + this.addPreconditionExpressionPropertyDescriptor(object); + } + return this.itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_RowContextMenuEntry_name_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_RowContextMenuEntry_name_feature", "_UI_RowContextMenuEntry_type"), + TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Label Expression feature. + * + * @generated + */ + protected void addLabelExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_RowContextMenuEntry_labelExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_RowContextMenuEntry_labelExpression_feature", "_UI_RowContextMenuEntry_type"), + TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Icon URL Expression feature. + * + * @generated + */ + protected void addIconURLExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_RowContextMenuEntry_iconURLExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_RowContextMenuEntry_iconURLExpression_feature", "_UI_RowContextMenuEntry_type"), + TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Precondition Expression feature. + * + * @generated + */ + protected void addPreconditionExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_RowContextMenuEntry_preconditionExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_RowContextMenuEntry_preconditionExpression_feature", "_UI_RowContextMenuEntry_type"), + TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_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(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY); + } + 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 RowContextMenuEntry.gif. + * + * @generated + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/RowContextMenuEntry.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 = ((RowContextMenuEntry) object).getName(); + return label == null || label.length() == 0 ? this.getString("_UI_RowContextMenuEntry_type") : this.getString("_UI_RowContextMenuEntry_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(RowContextMenuEntry.class)) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME: + case TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION: + case TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION: + case TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + 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(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createChangeContext())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createCreateInstance())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createSetValue())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createUnsetValue())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createDeleteElement())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createLet())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createIf())); + + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY__BODY, ViewFactory.eINSTANCE.createFor())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) this.adapterFactory).getResourceLocator(); + } + +} diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowDescriptionItemProvider.java index 0e302117b2..4b39cfdab0 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/RowDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -17,16 +17,17 @@ 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.table.RowDescription; +import org.eclipse.sirius.components.view.table.TableFactory; import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.RowDescription} object. * * @generated @@ -34,8 +35,7 @@ public class RowDescriptionItemProvider extends TableElementDescriptionItemProvider { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -44,8 +44,7 @@ public RowDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -64,88 +63,102 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Header Label Expression feature. + * This adds a property descriptor for the Header Label Expression feature. * * @generated */ protected void addHeaderLabelExpressionPropertyDescriptor(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_RowDescription_headerLabelExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_headerLabelExpression_feature", - "_UI_RowDescription_type"), - TablePackage.Literals.ROW_DESCRIPTION__HEADER_LABEL_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_headerLabelExpression_feature", "_UI_RowDescription_type"), + TablePackage.Literals.ROW_DESCRIPTION__HEADER_LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Header Icon Expression feature. + * This adds a property descriptor for the Header Icon Expression feature. * * @generated */ protected void addHeaderIconExpressionPropertyDescriptor(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_RowDescription_headerIconExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_headerIconExpression_feature", - "_UI_RowDescription_type"), - TablePackage.Literals.ROW_DESCRIPTION__HEADER_ICON_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_headerIconExpression_feature", "_UI_RowDescription_type"), + TablePackage.Literals.ROW_DESCRIPTION__HEADER_ICON_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Header Index Label Expression - * feature. + * This adds a property descriptor for the Header Index Label Expression feature. * * @generated */ protected void addHeaderIndexLabelExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_RowDescription_headerIndexLabelExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_RowDescription_headerIndexLabelExpression_feature", "_UI_RowDescription_type"), - TablePackage.Literals.ROW_DESCRIPTION__HEADER_INDEX_LABEL_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_RowDescription_headerIndexLabelExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_headerIndexLabelExpression_feature", "_UI_RowDescription_type"), + TablePackage.Literals.ROW_DESCRIPTION__HEADER_INDEX_LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Initial Height Expression feature. - * + * This adds a property descriptor for the Initial Height Expression feature. * * @generated */ protected void addInitialHeightExpressionPropertyDescriptor(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_RowDescription_initialHeightExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_initialHeightExpression_feature", - "_UI_RowDescription_type"), - TablePackage.Literals.ROW_DESCRIPTION__INITIAL_HEIGHT_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_initialHeightExpression_feature", "_UI_RowDescription_type"), + TablePackage.Literals.ROW_DESCRIPTION__INITIAL_HEIGHT_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Is Resizable Expression feature. + * This adds a property descriptor for the Is Resizable Expression feature. * * @generated */ protected void addIsResizableExpressionPropertyDescriptor(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_RowDescription_isResizableExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_isResizableExpression_feature", - "_UI_RowDescription_type"), - TablePackage.Literals.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_RowDescription_isResizableExpression_feature", "_UI_RowDescription_type"), + TablePackage.Literals.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This returns RowDescription.gif. + * 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(TablePackage.Literals.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES); + } + 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 RowDescription.gif. * * @generated NOT */ @@ -165,22 +178,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((RowDescription) object).getName(); - return label == null || label.length() == 0 ? this.getString("_UI_RowDescription_type") - : this.getString("_UI_RowDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_RowDescription_type") : this.getString("_UI_RowDescription_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}. + * 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 */ @@ -196,20 +207,24 @@ public void notifyChanged(Notification notification) { case TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + 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. - * + * 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(TablePackage.Literals.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES, TableFactory.eINSTANCE.createRowContextMenuEntry())); } } diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableDescriptionItemProvider.java index beea0a8abc..edf17412a7 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -29,8 +29,7 @@ import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.TableDescription} object. + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.table.TableDescription} object. * * * @generated @@ -38,8 +37,7 @@ public class TableDescriptionItemProvider extends RepresentationDescriptionItemProvider { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -48,8 +46,7 @@ public TableDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -65,42 +62,35 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Use Striped Rows Expression feature. - * + * This adds a property descriptor for the Use Striped Rows Expression feature. * * @generated */ protected void addUseStripedRowsExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_TableDescription_useStripedRowsExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_TableDescription_useStripedRowsExpression_feature", "_UI_TableDescription_type"), - TablePackage.Literals.TABLE_DESCRIPTION__USE_STRIPED_ROWS_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TableDescription_useStripedRowsExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TableDescription_useStripedRowsExpression_feature", "_UI_TableDescription_type"), + TablePackage.Literals.TABLE_DESCRIPTION__USE_STRIPED_ROWS_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Row Description feature. + * This adds a property descriptor for the Row Description feature. * * @generated */ protected void addRowDescriptionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_TableDescription_rowDescription_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_TableDescription_rowDescription_feature", - "_UI_TableDescription_type"), - TablePackage.Literals.TABLE_DESCRIPTION__ROW_DESCRIPTION, true, false, true, null, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TableDescription_rowDescription_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TableDescription_rowDescription_feature", "_UI_TableDescription_type"), + TablePackage.Literals.TABLE_DESCRIPTION__ROW_DESCRIPTION, true, false, true, null, 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}. - * + * 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 */ @@ -122,16 +112,14 @@ public Collection getChildrenFeatures(Object objec */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper feature to - // use for + // 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 TableDescription.gif. + * This returns TableDescription.gif. * * @generated NOT */ @@ -151,22 +139,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((TableDescription) object).getName(); - return label == null || label.length() == 0 ? this.getString("_UI_TableDescription_type") - : this.getString("_UI_TableDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_TableDescription_type") : this.getString("_UI_TableDescription_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}. + * 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 */ @@ -188,9 +174,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated NOT */ @@ -198,16 +183,13 @@ public void notifyChanged(Notification notification) { protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__COLUMN_DESCRIPTIONS, - TableFactory.eINSTANCE.createColumnDescription())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__COLUMN_DESCRIPTIONS, TableFactory.eINSTANCE.createColumnDescription())); - newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__ROW_DESCRIPTION, - TableFactory.eINSTANCE.createRowDescription())); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__ROW_DESCRIPTION, TableFactory.eINSTANCE.createRowDescription())); CellDescription cellDescription = TableFactory.eINSTANCE.createCellDescription(); cellDescription.setCellWidgetDescription(TableFactory.eINSTANCE.createCellTextfieldWidgetDescription()); - newChildDescriptors.add( - this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__CELL_DESCRIPTIONS, cellDescription)); + newChildDescriptors.add(this.createChildParameter(TablePackage.Literals.TABLE_DESCRIPTION__CELL_DESCRIPTIONS, cellDescription)); } } diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableEditPlugin.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableEditPlugin.java index f883077af2..e6df263055 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableEditPlugin.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableEditPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -21,8 +21,7 @@ import org.eclipse.sirius.components.view.provider.ViewEditPlugin; /** - * This is the central singleton for the Table edit plugin. + * This is the central singleton for the Table edit plugin. * * @generated */ @@ -48,12 +47,11 @@ public final class TableEditPlugin extends EMFPlugin { * @generated */ public TableEditPlugin() { - super(new ResourceLocator[] {ViewEditPlugin.INSTANCE,}); + super(new ResourceLocator[] { ViewEditPlugin.INSTANCE, }); } /** - * Returns the singleton instance of the Eclipse plugin. - * + * Returns the singleton instance of the Eclipse plugin. * * @return the singleton instance. * @generated @@ -64,8 +62,7 @@ public ResourceLocator getPluginResourceLocator() { } /** - * Returns the singleton instance of the Eclipse plugin. - * + * Returns the singleton instance of the Eclipse plugin. * * @return the singleton instance. * @generated @@ -83,24 +80,19 @@ protected Object doGetImage(String key) throws IOException { } /** - * Computes the file extension to be used with the key to specify an image - * resource. + * Computes the file extension to be used with the key to specify an image resource. * * @param key - * the key for the imagine. - * @return the file extension to be used with the key to specify an image - * resource. + * the key for the imagine. + * @return the file extension to be used with the key to specify an image resource. */ protected static String extensionFor(String key) { String result = ".gif"; int index = key.lastIndexOf('.'); if (index != -1) { String extension = key.substring(index + 1); - if ("png".equalsIgnoreCase(extension) || "gif".equalsIgnoreCase(extension) - || "bmp".equalsIgnoreCase(extension) || "ico".equalsIgnoreCase(extension) - || "jpg".equalsIgnoreCase(extension) || "jpeg".equalsIgnoreCase(extension) - || "tif".equalsIgnoreCase(extension) || "tiff".equalsIgnoreCase(extension) - || "svg".equalsIgnoreCase(extension)) { + if ("png".equalsIgnoreCase(extension) || "gif".equalsIgnoreCase(extension) || "bmp".equalsIgnoreCase(extension) || "ico".equalsIgnoreCase(extension) || "jpg".equalsIgnoreCase(extension) + || "jpeg".equalsIgnoreCase(extension) || "tif".equalsIgnoreCase(extension) || "tiff".equalsIgnoreCase(extension) || "svg".equalsIgnoreCase(extension)) { result = ""; } } @@ -108,8 +100,7 @@ protected static String extensionFor(String key) { } /** - * The actual implementation of the Eclipse Plugin. + * The actual implementation of the Eclipse Plugin. * * @generated */ diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableElementDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableElementDescriptionItemProvider.java index f81afca48e..178a4c75f1 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableElementDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableElementDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -33,18 +33,16 @@ import org.eclipse.sirius.components.view.table.TablePackage; /** - * This is the item provider adapter for a - * {@link org.eclipse.sirius.components.view.table.TableElementDescription} + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.table.TableElementDescription} * object. * * @generated */ -public class TableElementDescriptionItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, - IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { +public class TableElementDescriptionItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** - * This constructs an instance from a factory and a notifier. + * This constructs an instance from a factory and a notifier. * * @generated */ @@ -53,8 +51,7 @@ public TableElementDescriptionItemProvider(AdapterFactory adapterFactory) { } /** - * This returns the property descriptors for the adapted class. + * This returns the property descriptors for the adapted class. * * @generated */ @@ -72,69 +69,53 @@ public List getPropertyDescriptors(Object object) { } /** - * This adds a property descriptor for the Name feature. - * + * This adds a property descriptor for the Name feature. * * @generated */ protected void addNamePropertyDescriptor(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_TableElementDescription_name_feature"), - this.getString("_UI_PropertyDescriptor_description", "_UI_TableElementDescription_name_feature", - "_UI_TableElementDescription_type"), - TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__NAME, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_TableElementDescription_name_feature", "_UI_TableElementDescription_type"), + TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Domain Type feature. + * 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_TableElementDescription_domainType_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_TableElementDescription_domainType_feature", "_UI_TableElementDescription_type"), - TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__DOMAIN_TYPE, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TableElementDescription_domainType_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TableElementDescription_domainType_feature", "_UI_TableElementDescription_type"), + TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__DOMAIN_TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Semantic Candidates Expression - * feature. + * This adds a property descriptor for the Semantic Candidates Expression feature. * * @generated */ protected void addSemanticCandidatesExpressionPropertyDescriptor(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_TableElementDescription_semanticCandidatesExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_TableElementDescription_semanticCandidatesExpression_feature", - "_UI_TableElementDescription_type"), - TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.getString("_UI_PropertyDescriptor_description", "_UI_TableElementDescription_semanticCandidatesExpression_feature", "_UI_TableElementDescription_type"), + TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** - * This adds a property descriptor for the Precondition Expression feature. + * This adds a property descriptor for the Precondition Expression feature. * * @generated */ protected void addPreconditionExpressionPropertyDescriptor(Object object) { - this.itemPropertyDescriptors - .add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), - this.getResourceLocator(), this.getString("_UI_TableElementDescription_preconditionExpression_feature"), - this.getString("_UI_PropertyDescriptor_description", - "_UI_TableElementDescription_preconditionExpression_feature", - "_UI_TableElementDescription_type"), - TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__PRECONDITION_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TableElementDescription_preconditionExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TableElementDescription_preconditionExpression_feature", "_UI_TableElementDescription_type"), + TablePackage.Literals.TABLE_ELEMENT_DESCRIPTION__PRECONDITION_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** @@ -148,22 +129,20 @@ protected boolean shouldComposeCreationImage() { } /** - * This returns the label text for the adapted class. - * + * This returns the label text for the adapted class. * * @generated */ @Override public String getText(Object object) { String label = ((TableElementDescription) object).getName(); - return label == null || label.length() == 0 ? this.getString("_UI_TableElementDescription_type") - : this.getString("_UI_TableElementDescription_type") + " " + label; + return label == null || label.length() == 0 ? this.getString("_UI_TableElementDescription_type") : this.getString("_UI_TableElementDescription_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}. + * 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 */ @@ -183,9 +162,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. - * + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. * * @generated */ @@ -195,8 +173,7 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors } /** - * Return the resource locator for this item provider's resources. + * Return the resource locator for this item provider's resources. * * @generated */ diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableItemProviderAdapterFactory.java index 8c0fe63310..56c73c2f42 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/java/org/eclipse/sirius/components/view/table/provider/TableItemProviderAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -45,96 +45,93 @@ import org.eclipse.sirius.components.view.util.ViewSwitch; /** - * This is the factory that is used to provide the interfaces needed to support - * Viewers. The adapters generated by this factory convert EMF adapter - * notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. The - * adapters also support Eclipse property sheets. Note that most of the adapters - * are shared among multiple instances. + * This is the factory that is used to provide the interfaces needed to support Viewers. The adapters generated by this + * factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. The adapters + * also support Eclipse property sheets. Note that most of the adapters are shared among multiple instances. * * @generated */ -public class TableItemProviderAdapterFactory extends TableAdapterFactory - implements ComposeableAdapterFactory, IChangeNotifier, IDisposable, IChildCreationExtender { +public class TableItemProviderAdapterFactory extends TableAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable, IChildCreationExtender { /** - * This keeps track of the root adapter factory that delegates to this adapter - * factory. + * This keeps track of the root adapter factory that delegates to this adapter factory. * * @generated */ protected ComposedAdapterFactory parentAdapterFactory; /** - * This is used to implement - * {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. * * @generated */ protected IChangeNotifier changeNotifier = new ChangeNotifier(); /** - * This helps manage the child creation extenders. + * This helps manage the child creation extenders. * * @generated */ - protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager( - TableEditPlugin.INSTANCE, TablePackage.eNS_URI); + protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager(TableEditPlugin.INSTANCE, TablePackage.eNS_URI); /** - * This keeps track of all the supported types checked by - * {@link #isFactoryForType isFactoryForType}. + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. * * @generated */ protected Collection supportedTypes = new ArrayList<>(); + /** * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.TableDescription} instances. - * + * {@link org.eclipse.sirius.components.view.table.TableDescription} instances. * * @generated */ protected TableDescriptionItemProvider tableDescriptionItemProvider; + /** * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.ColumnDescription} instances. - * + * {@link org.eclipse.sirius.components.view.table.ColumnDescription} instances. * * @generated */ protected ColumnDescriptionItemProvider columnDescriptionItemProvider; + /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.RowDescription} instances. - * + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.table.RowDescription} + * instances. * * @generated */ protected RowDescriptionItemProvider rowDescriptionItemProvider; + /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.CellDescription} instances. - * + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.table.CellDescription} + * instances. * * @generated */ protected CellDescriptionItemProvider cellDescriptionItemProvider; + /** * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription} - * instances. + * {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription} instances. * * @generated */ protected CellTextfieldWidgetDescriptionItemProvider cellTextfieldWidgetDescriptionItemProvider; + /** * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription} - * instances. + * {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription} instances. + * * * @generated */ @@ -154,8 +151,7 @@ public TableItemProviderAdapterFactory() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.TableDescription}. * * @generated @@ -170,8 +166,7 @@ public Adapter createTableDescriptionAdapter() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.ColumnDescription}. * * @generated @@ -186,8 +181,7 @@ public Adapter createColumnDescriptionAdapter() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.RowDescription}. * * @generated @@ -202,8 +196,7 @@ public Adapter createRowDescriptionAdapter() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.CellDescription}. * * @generated @@ -218,8 +211,7 @@ public Adapter createCellDescriptionAdapter() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription}. + * This creates an adapter for a {@link org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription}. * * * @generated @@ -234,9 +226,8 @@ public Adapter createCellTextfieldWidgetDescriptionAdapter() { } /** - * This creates an adapter for a - * {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription}. - * + * This creates an adapter for a {@link org.eclipse.sirius.components.view.table.CellLabelWidgetDescription}. * * @generated */ @@ -250,19 +241,41 @@ public Adapter createCellLabelWidgetDescriptionAdapter() { } /** - * This returns the root adapter factory that contains this factory. + * + * @generated + */ + protected RowContextMenuEntryItemProvider rowContextMenuEntryItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry}. * * @generated */ @Override + public Adapter createRowContextMenuEntryAdapter() { + if (this.rowContextMenuEntryItemProvider == null) { + this.rowContextMenuEntryItemProvider = new RowContextMenuEntryItemProvider(this); + } + + return this.rowContextMenuEntryItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * @generated + */ + @Override public ComposeableAdapterFactory getRootAdapterFactory() { return this.parentAdapterFactory == null ? this : this.parentAdapterFactory.getRootAdapterFactory(); } /** - * This sets the composed adapter factory that contains this factory. + * This sets the composed adapter factory that contains this factory. * * @generated */ @@ -282,8 +295,8 @@ public boolean isFactoryForType(Object type) { } /** - * This implementation substitutes the factory itself as the key for the - * adapter. + * This implementation substitutes the factory itself as the key for the adapter. * * @generated */ @@ -323,6 +336,7 @@ public List getChildCreationExtenders() { * * @generated */ + @Override public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain) { return this.childCreationExtenderManager.getNewChildDescriptors(object, editingDomain); } @@ -332,6 +346,7 @@ public Collection getNewChildDescriptors(Object object, EditingDomain editing * * @generated */ + @Override public ResourceLocator getResourceLocator() { return this.childCreationExtenderManager; } @@ -357,8 +372,8 @@ public void removeListener(INotifyChangedListener notifyChangedListener) { } /** - * This delegates to {@link #changeNotifier} and to - * {@link #parentAdapterFactory}. + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. * * @generated */ @@ -372,8 +387,7 @@ public void fireNotifyChanged(Notification notification) { } /** - * This disposes all of the item providers created by this factory. + * This disposes all of the item providers created by this factory. * * @generated */ @@ -391,11 +405,12 @@ public void dispose() { this.cellTextfieldWidgetDescriptionItemProvider.dispose(); if (this.cellLabelWidgetDescriptionItemProvider != null) this.cellLabelWidgetDescriptionItemProvider.dispose(); + if (this.rowContextMenuEntryItemProvider != null) + this.rowContextMenuEntryItemProvider.dispose(); } /** - * A child creation extender for the {@link ViewPackage}. + * A child creation extender for the {@link ViewPackage}. * * @generated */ @@ -406,6 +421,7 @@ public static class ViewChildCreationExtender implements IChildCreationExtender * * @generated */ + @Override public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain) { ArrayList result = new ArrayList<>(); new CreationSwitch(result, editingDomain).doSwitch((EObject) object); @@ -417,37 +433,36 @@ public Collection getNewChildDescriptors(Object object, EditingDomain ed * * @generated */ + @Override public ResourceLocator getResourceLocator() { return TableEditPlugin.INSTANCE; } /** - * The switch for creating child descriptors specific to each extended class. - * + * The switch for creating child descriptors specific to each extended class. * * @generated */ protected static class CreationSwitch extends ViewSwitch { /** - * The child descriptors being populated. + * The child descriptors being populated. * * @generated */ protected List newChildDescriptors; /** - * The domain in which to create the children. + * The domain in which to create the children. * * @generated */ protected EditingDomain editingDomain; /** - * Creates the a switch for populating child descriptors in the given domain. - * + * Creates the a switch for populating child descriptors in the given domain. * * @generated */ @@ -465,8 +480,7 @@ protected static class CreationSwitch extends ViewSwitch { public Object caseView(View object) { TableDescription tableDescription = TableFactory.eINSTANCE.createTableDescription(); tableDescription.setName("New Table Description"); - this.newChildDescriptors - .add(this.createChildParameter(ViewPackage.Literals.VIEW__DESCRIPTIONS, tableDescription)); + this.newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.VIEW__DESCRIPTIONS, tableDescription)); return null; } diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/resources/icons/full/obj16/RowContextMenuEntry.svg b/packages/view/backend/sirius-components-view-table-edit/src/main/resources/icons/full/obj16/RowContextMenuEntry.svg new file mode 100644 index 0000000000..e87fea7d03 --- /dev/null +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/resources/icons/full/obj16/RowContextMenuEntry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/view/backend/sirius-components-view-table-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-table-edit/src/main/resources/plugin.properties index b03260e896..26a02f175d 100644 --- a/packages/view/backend/sirius-components-view-table-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-table-edit/src/main/resources/plugin.properties @@ -1,62 +1,68 @@ -################################################################################ # Copyright (c) 2024 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 -################################################################################# -pluginName=Table Edit Support -providerName=www.example.org +pluginName = Table Edit Support +providerName = www.example.org -_UI_CreateChild_text={0} -_UI_CreateChild_text2={1} {0} -_UI_CreateChild_text3={1} -_UI_CreateChild_tooltip=Create New {0} Under {1} Feature -_UI_CreateChild_description=Create a new child of type {0} for the {1} feature of the selected {2}. -_UI_CreateSibling_description=Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. -_UI_PropertyDescriptor_description=The {0} of the {1} +_UI_PropertyDescriptor_description = The {0} of the {1} -_UI_TableDescription_type=Table Description -_UI_TableElementDescription_type=Element Description -_UI_ColumnDescription_type=Column Description -_UI_RowDescription_type=Row Description -_UI_CellDescription_type=Cell Description -_UI_CellWidgetDescription_type=Cell Widget Description -_UI_CellTextfieldWidgetDescription_type=Cell Textfield Widget Description -_UI_CellLabelWidgetDescription_type=Cell Label Widget Description -_UI_Unknown_type=Object +_UI_TableDescription_type = Description +_UI_TableElementDescription_type = Element Description +_UI_ColumnDescription_type = Column Description +_UI_RowDescription_type = Row Description +_UI_CellDescription_type = Cell Description +_UI_CellWidgetDescription_type = Cell Widget Description +_UI_CellTextfieldWidgetDescription_type = Cell Textfield Widget Description +_UI_CellLabelWidgetDescription_type = Cell Label Widget Description +_UI_RowContextMenuEntry_type = Row Context Menu Entry +_UI_Unknown_type = Object -_UI_Unknown_datatype=Value +_UI_Unknown_datatype= Value + +_UI_TableDescription_useStripedRowsExpression_feature = Use Striped Rows Expression +_UI_TableDescription_columnDescriptions_feature = Column Descriptions +_UI_TableDescription_rowDescription_feature = Row Description +_UI_TableDescription_cellDescriptions_feature = Cell Descriptions +_UI_TableElementDescription_name_feature = Name +_UI_TableElementDescription_domainType_feature = Domain Type +_UI_TableElementDescription_semanticCandidatesExpression_feature = Semantic Candidates Expression +_UI_TableElementDescription_preconditionExpression_feature = Precondition Expression +_UI_ColumnDescription_headerIndexLabelExpression_feature = Header Index Label Expression +_UI_ColumnDescription_headerLabelExpression_feature = Header Label Expression +_UI_ColumnDescription_headerIconExpression_feature = Header Icon Expression +_UI_ColumnDescription_initialWidthExpression_feature = Initial Width Expression +_UI_ColumnDescription_isResizableExpression_feature = Is Resizable Expression +_UI_ColumnDescription_filterWidgetExpression_feature = Filter Widget Expression +_UI_RowDescription_headerLabelExpression_feature = Header Label Expression +_UI_RowDescription_headerIconExpression_feature = Header Icon Expression +_UI_RowDescription_headerIndexLabelExpression_feature = Header Index Label Expression +_UI_RowDescription_initialHeightExpression_feature = Initial Height Expression +_UI_RowDescription_isResizableExpression_feature = Is Resizable Expression +_UI_RowDescription_contextMenuEntries_feature = Context Menu Entries +_UI_CellDescription_valueExpression_feature = Value Expression +_UI_CellDescription_tooltipExpression_feature = Tooltip Expression +_UI_CellDescription_cellWidgetDescription_feature = Cell Widget Description +_UI_CellTextfieldWidgetDescription_body_feature = Body +_UI_CellLabelWidgetDescription_iconExpression_feature = Icon Expression +_UI_RowContextMenuEntry_name_feature = Name +_UI_RowContextMenuEntry_labelExpression_feature = Label Expression +_UI_RowContextMenuEntry_iconURLExpression_feature = Icon URL Expression +_UI_RowContextMenuEntry_preconditionExpression_feature = Precondition Expression +_UI_RowContextMenuEntry_body_feature = Body +_UI_Unknown_feature = Unspecified -_UI_TableDescription_useStripedRowsExpression_feature=Use Striped Rows Expression -_UI_TableDescription_columnDescriptions_feature=Column Descriptions -_UI_TableDescription_rowDescription_feature=Row Description -_UI_TableDescription_cellDescriptions_feature=Cell Descriptions -_UI_TableElementDescription_name_feature=Name -_UI_TableElementDescription_domainType_feature=Domain Type -_UI_TableElementDescription_semanticCandidatesExpression_feature=Semantic Candidates Expression -_UI_TableElementDescription_preconditionExpression_feature=Precondition Expression -_UI_ColumnDescription_headerIndexLabelExpression_feature=Header Index Label Expression -_UI_ColumnDescription_headerLabelExpression_feature=Header Label Expression -_UI_ColumnDescription_headerIconExpression_feature=Header Icon Expression -_UI_ColumnDescription_initialWidthExpression_feature=Initial Width Expression -_UI_ColumnDescription_isResizableExpression_feature=Is Resizable Expression -_UI_ColumnDescription_filterWidgetExpression_feature=Filter Widget Expression -_UI_RowDescription_headerLabelExpression_feature=Header Label Expression -_UI_RowDescription_headerIconExpression_feature=Header Icon Expression -_UI_RowDescription_headerIndexLabelExpression_feature=Header Index Label Expression -_UI_RowDescription_initialHeightExpression_feature=Initial Height Expression -_UI_RowDescription_isResizableExpression_feature=Is Resizable Expression -_UI_CellDescription_valueExpression_feature=Value Expression -_UI_CellDescription_tooltipExpression_feature=Tooltip Expression -_UI_CellDescription_cellWidgetDescription_feature=Cell Widget Description -_UI_CellTextfieldWidgetDescription_body_feature=Body -_UI_CellLabelWidgetDescription_iconExpression_feature=Icon Expression -_UI_Unknown_feature=Unspecified diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/ColumnDescription.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/ColumnDescription.java index 3326f576d0..eb258c8cb6 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/ColumnDescription.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/ColumnDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -45,10 +45,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Header Index Label Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderIndexLabelExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_HeaderIndexLabelExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderIndexLabelExpression(); @@ -58,9 +58,9 @@ public interface ColumnDescription extends TableElementDescription { * Label Expression}' attribute. * * @param value - * the new value of the 'Header Index Label Expression' attribute. - * @generated + * the new value of the 'Header Index Label Expression' attribute. * @see #getHeaderIndexLabelExpression() + * @generated */ void setHeaderIndexLabelExpression(String value); @@ -69,10 +69,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Header Label Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderLabelExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_HeaderLabelExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderLabelExpression(); @@ -81,9 +81,9 @@ public interface ColumnDescription extends TableElementDescription { * Header Label Expression}' attribute. * * @param value - * the new value of the 'Header Label Expression' attribute. - * @generated + * the new value of the 'Header Label Expression' attribute. * @see #getHeaderLabelExpression() + * @generated */ void setHeaderLabelExpression(String value); @@ -92,10 +92,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Header Icon Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderIconExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_HeaderIconExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderIconExpression(); @@ -104,9 +104,9 @@ public interface ColumnDescription extends TableElementDescription { * Header Icon Expression}' attribute. * * @param value - * the new value of the 'Header Icon Expression' attribute. - * @generated + * the new value of the 'Header Icon Expression' attribute. * @see #getHeaderIconExpression() + * @generated */ void setHeaderIconExpression(String value); @@ -115,10 +115,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Initial Width Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setInitialWidthExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_InitialWidthExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getInitialWidthExpression(); @@ -128,9 +128,9 @@ public interface ColumnDescription extends TableElementDescription { * Expression}' attribute. * * @param value - * the new value of the 'Initial Width Expression' attribute. - * @generated + * the new value of the 'Initial Width Expression' attribute. * @see #getInitialWidthExpression() + * @generated */ void setInitialWidthExpression(String value); @@ -139,10 +139,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Is Resizable Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setIsResizableExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_IsResizableExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getIsResizableExpression(); @@ -151,9 +151,9 @@ public interface ColumnDescription extends TableElementDescription { * Is Resizable Expression}' attribute. * * @param value - * the new value of the 'Is Resizable Expression' attribute. - * @generated + * the new value of the 'Is Resizable Expression' attribute. * @see #getIsResizableExpression() + * @generated */ void setIsResizableExpression(String value); @@ -162,10 +162,10 @@ public interface ColumnDescription extends TableElementDescription { * "". * * @return the value of the 'Filter Widget Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setFilterWidgetExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getColumnDescription_FilterWidgetExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getFilterWidgetExpression(); @@ -175,9 +175,9 @@ public interface ColumnDescription extends TableElementDescription { * Expression}' attribute. * * @param value - * the new value of the 'Filter Widget Expression' attribute. - * @generated + * the new value of the 'Filter Widget Expression' attribute. * @see #getFilterWidgetExpression() + * @generated */ void setFilterWidgetExpression(String value); diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowContextMenuEntry.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowContextMenuEntry.java new file mode 100644 index 0000000000..4b275b1021 --- /dev/null +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowContextMenuEntry.java @@ -0,0 +1,146 @@ +/******************************************************************************* + * 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.table; + + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.components.view.Operation; + +/** + * A representation of the model object 'Row Context Menu Entry'. + * + *

+ * The following features are supported: + *

+ *
    + *
  • {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getName Name}
  • + *
  • {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getLabelExpression Label + * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getIconURLExpression Icon URL + * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getPreconditionExpression Precondition + * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getBody Body}
  • + *
+ * + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry() + * @model + * @generated + */ +public interface RowContextMenuEntry extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry_Name() + * @model dataType="org.eclipse.sirius.components.view.Identifier" required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getName + * Name}' attribute. + * + * @param value + * the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Label Expression' attribute. + * + * @return the value of the 'Label Expression' attribute. + * @see #setLabelExpression(String) + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry_LabelExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getLabelExpression(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getLabelExpression + * Label Expression}' attribute. + * + * @param value + * the new value of the 'Label Expression' attribute. + * @see #getLabelExpression() + * @generated + */ + void setLabelExpression(String value); + + /** + * Returns the value of the 'Icon URL Expression' attribute. + * + * @return the value of the 'Icon URL Expression' attribute. + * @see #setIconURLExpression(String) + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry_IconURLExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getIconURLExpression(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getIconURLExpression + * Icon URL Expression}' attribute. + * + * @param value + * the new value of the 'Icon URL Expression' attribute. + * @see #getIconURLExpression() + * @generated + */ + void setIconURLExpression(String value); + + /** + * Returns the value of the 'Precondition Expression' attribute. + * + * @return the value of the 'Precondition Expression' attribute. + * @see #setPreconditionExpression(String) + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry_PreconditionExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getPreconditionExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getPreconditionExpression Precondition + * Expression}' attribute. + * + * @param value + * the new value of the 'Precondition Expression' attribute. + * @see #getPreconditionExpression() + * @generated + */ + void setPreconditionExpression(String value); + + /** + * Returns the value of the 'Body' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.components.view.Operation}. + * + * @return the value of the 'Body' containment reference list. + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowContextMenuEntry_Body() + * @model containment="true" + * @generated + */ + EList getBody(); + +} // RowContextMenuEntry diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowDescription.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowDescription.java index 51e603f956..a1c5a91d24 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowDescription.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/RowDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.components.view.table; +import org.eclipse.emf.common.util.EList; + /** * A representation of the model object 'Row Description'. * @@ -29,11 +31,13 @@ * Expression} *
  • {@link org.eclipse.sirius.components.view.table.RowDescription#getIsResizableExpression Is Resizable * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.table.RowDescription#getContextMenuEntries Context Menu + * Entries}
  • * * + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription() * @model * @generated - * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription() */ public interface RowDescription extends TableElementDescription { @@ -42,10 +46,10 @@ public interface RowDescription extends TableElementDescription { * "". * * @return the value of the 'Header Label Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderLabelExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_HeaderLabelExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderLabelExpression(); @@ -54,9 +58,9 @@ public interface RowDescription extends TableElementDescription { * Header Label Expression}' attribute. * * @param value - * the new value of the 'Header Label Expression' attribute. - * @generated + * the new value of the 'Header Label Expression' attribute. * @see #getHeaderLabelExpression() + * @generated */ void setHeaderLabelExpression(String value); @@ -65,10 +69,10 @@ public interface RowDescription extends TableElementDescription { * "". * * @return the value of the 'Header Icon Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderIconExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_HeaderIconExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderIconExpression(); @@ -77,9 +81,9 @@ public interface RowDescription extends TableElementDescription { * Header Icon Expression}' attribute. * * @param value - * the new value of the 'Header Icon Expression' attribute. - * @generated + * the new value of the 'Header Icon Expression' attribute. * @see #getHeaderIconExpression() + * @generated */ void setHeaderIconExpression(String value); @@ -88,10 +92,10 @@ public interface RowDescription extends TableElementDescription { * end-user-doc --> * * @return the value of the 'Header Index Label Expression' attribute. - * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setHeaderIndexLabelExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_HeaderIndexLabelExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getHeaderIndexLabelExpression(); @@ -101,9 +105,9 @@ public interface RowDescription extends TableElementDescription { * Label Expression}' attribute. * * @param value - * the new value of the 'Header Index Label Expression' attribute. - * @generated + * the new value of the 'Header Index Label Expression' attribute. * @see #getHeaderIndexLabelExpression() + * @generated */ void setHeaderIndexLabelExpression(String value); @@ -112,10 +116,10 @@ public interface RowDescription extends TableElementDescription { * "". * * @return the value of the 'Initial Height Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setInitialHeightExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_InitialHeightExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getInitialHeightExpression(); @@ -124,9 +128,9 @@ public interface RowDescription extends TableElementDescription { * Initial Height Expression}' attribute. * * @param value - * the new value of the 'Initial Height Expression' attribute. - * @generated + * the new value of the 'Initial Height Expression' attribute. * @see #getInitialHeightExpression() + * @generated */ void setInitialHeightExpression(String value); @@ -135,10 +139,10 @@ public interface RowDescription extends TableElementDescription { * "". * * @return the value of the 'Is Resizable Expression' attribute. - * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setIsResizableExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_IsResizableExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getIsResizableExpression(); @@ -147,10 +151,22 @@ public interface RowDescription extends TableElementDescription { * Is Resizable Expression}' attribute. * * @param value - * the new value of the 'Is Resizable Expression' attribute. - * @generated + * the new value of the 'Is Resizable Expression' attribute. * @see #getIsResizableExpression() + * @generated */ void setIsResizableExpression(String value); + /** + * Returns the value of the 'Context Menu Entries' containment reference list. The list contents are + * of type {@link org.eclipse.sirius.components.view.table.RowContextMenuEntry}. + * + * @return the value of the 'Context Menu Entries' containment reference list. + * @see org.eclipse.sirius.components.view.table.TablePackage#getRowDescription_ContextMenuEntries() + * @model containment="true" + * @generated + */ + EList getContextMenuEntries(); + } // RowDescription diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableDescription.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableDescription.java index 1b180f993b..23ab419bc4 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableDescription.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -31,9 +31,9 @@ * Descriptions} * * + * @see org.eclipse.sirius.components.view.table.TablePackage#getTableDescription() * @model * @generated - * @see org.eclipse.sirius.components.view.table.TablePackage#getTableDescription() */ public interface TableDescription extends RepresentationDescription { @@ -42,10 +42,10 @@ public interface TableDescription extends RepresentationDescription { * end-user-doc --> * * @return the value of the 'Use Striped Rows Expression' attribute. - * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated * @see #setUseStripedRowsExpression(String) * @see org.eclipse.sirius.components.view.table.TablePackage#getTableDescription_UseStripedRowsExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated */ String getUseStripedRowsExpression(); @@ -55,9 +55,9 @@ public interface TableDescription extends RepresentationDescription { * Rows Expression}' attribute. * * @param value - * the new value of the 'Use Striped Rows Expression' attribute. - * @generated + * the new value of the 'Use Striped Rows Expression' attribute. * @see #getUseStripedRowsExpression() + * @generated */ void setUseStripedRowsExpression(String value); @@ -67,9 +67,9 @@ public interface TableDescription extends RepresentationDescription { * end-user-doc --> * * @return the value of the 'Column Descriptions' containment reference list. + * @see org.eclipse.sirius.components.view.table.TablePackage#getTableDescription_ColumnDescriptions() * @model containment="true" keys="name" * @generated - * @see org.eclipse.sirius.components.view.table.TablePackage#getTableDescription_ColumnDescriptions() */ EList getColumnDescriptions(); @@ -90,9 +90,9 @@ public interface TableDescription extends RepresentationDescription { * Description}' containment reference. * * @param value - * the new value of the 'Row Description' containment reference. - * @generated + * the new value of the 'Row Description' containment reference. * @see #getRowDescription() + * @generated */ void setRowDescription(RowDescription value); diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableFactory.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableFactory.java index 8705460386..712b692fd3 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableFactory.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TableFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -80,6 +80,14 @@ public interface TableFactory extends EFactory { */ CellLabelWidgetDescription createCellLabelWidgetDescription(); + /** + * Returns a new object of class 'Row Context Menu Entry'. + * + * @return a new object of class 'Row Context Menu Entry'. + * @generated + */ + RowContextMenuEntry createRowContextMenuEntry(); + /** * Returns the package supported by this factory. * diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TablePackage.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TablePackage.java index 47bdb31d7e..5b8d38d276 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TablePackage.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/TablePackage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -29,9 +29,9 @@ * * * + * @see org.eclipse.sirius.components.view.table.TableFactory * @model kind="package" * @generated - * @see org.eclipse.sirius.components.view.table.TableFactory */ public interface TablePackage extends EPackage { @@ -60,9 +60,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.TableDescriptionImpl * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.TableDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getTableDescription() + * @generated */ int TABLE_DESCRIPTION = 0; @@ -165,9 +165,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.TableElementDescriptionImpl * Element Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.TableElementDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getTableElementDescription() + * @generated */ int TABLE_ELEMENT_DESCRIPTION = 1; @@ -227,9 +227,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.ColumnDescriptionImpl Column * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.ColumnDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getColumnDescription() + * @generated */ int COLUMN_DESCRIPTION = 2; @@ -343,9 +343,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.RowDescriptionImpl Row * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.RowDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getRowDescription() + * @generated */ int ROW_DESCRIPTION = 3; @@ -428,6 +428,15 @@ public interface TablePackage extends EPackage { */ int ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION = TABLE_ELEMENT_DESCRIPTION_FEATURE_COUNT + 4; + /** + * The feature id for the 'Context Menu Entries' containment reference list. + * + * + * @generated + * @ordered + */ + int ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES = TABLE_ELEMENT_DESCRIPTION_FEATURE_COUNT + 5; + /** * The number of structural features of the 'Row Description' class. @@ -435,7 +444,7 @@ public interface TablePackage extends EPackage { * @generated * @ordered */ - int ROW_DESCRIPTION_FEATURE_COUNT = TABLE_ELEMENT_DESCRIPTION_FEATURE_COUNT + 5; + int ROW_DESCRIPTION_FEATURE_COUNT = TABLE_ELEMENT_DESCRIPTION_FEATURE_COUNT + 6; /** * The number of operations of the 'Row Description' class. @@ -449,9 +458,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.CellDescriptionImpl Cell * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellDescription() + * @generated */ int CELL_DESCRIPTION = 4; @@ -537,9 +546,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.CellWidgetDescription Cell Widget * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.CellWidgetDescription * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellWidgetDescription() + * @generated */ int CELL_WIDGET_DESCRIPTION = 5; @@ -566,9 +575,9 @@ public interface TablePackage extends EPackage { * '{@link org.eclipse.sirius.components.view.table.impl.CellTextfieldWidgetDescriptionImpl Cell Textfield * Widget Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellTextfieldWidgetDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellTextfieldWidgetDescription() + * @generated */ int CELL_TEXTFIELD_WIDGET_DESCRIPTION = 6; @@ -603,9 +612,9 @@ public interface TablePackage extends EPackage { * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.CellLabelWidgetDescriptionImpl * Cell Label Widget Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellLabelWidgetDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellLabelWidgetDescription() + * @generated */ int CELL_LABEL_WIDGET_DESCRIPTION = 7; @@ -642,13 +651,85 @@ public interface TablePackage extends EPackage { */ int CELL_LABEL_WIDGET_DESCRIPTION_OPERATION_COUNT = CELL_WIDGET_DESCRIPTION_OPERATION_COUNT; + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl Row + * Context Menu Entry}' class. + * + * @see org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl + * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getRowContextMenuEntry() + * @generated + */ + int ROW_CONTEXT_MENU_ENTRY = 8; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY__NAME = 0; + + /** + * The feature id for the 'Label Expression' attribute. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION = 1; + + /** + * The feature id for the 'Icon URL Expression' attribute. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION = 2; + + /** + * The feature id for the 'Precondition Expression' attribute. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION = 3; + + /** + * The feature id for the 'Body' containment reference list. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY__BODY = 4; + + /** + * The number of structural features of the 'Row Context Menu Entry' class. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY_FEATURE_COUNT = 5; + + /** + * The number of operations of the 'Row Context Menu Entry' class. + * + * @generated + * @ordered + */ + int ROW_CONTEXT_MENU_ENTRY_OPERATION_COUNT = 0; + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.table.TableDescription * Description}'. * * @return the meta object for class 'Description'. - * @generated * @see org.eclipse.sirius.components.view.table.TableDescription + * @generated */ EClass getTableDescription(); @@ -658,9 +739,9 @@ public interface TablePackage extends EPackage { * Rows Expression}'. * * @return the meta object for the attribute 'Use Striped Rows Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.TableDescription#getUseStripedRowsExpression() * @see #getTableDescription() + * @generated */ EAttribute getTableDescription_UseStripedRowsExpression(); @@ -670,9 +751,9 @@ public interface TablePackage extends EPackage { * Descriptions}'. * * @return the meta object for the containment reference list 'Column Descriptions'. - * @generated * @see org.eclipse.sirius.components.view.table.TableDescription#getColumnDescriptions() * @see #getTableDescription() + * @generated */ EReference getTableDescription_ColumnDescriptions(); @@ -682,9 +763,9 @@ public interface TablePackage extends EPackage { * * * @return the meta object for the containment reference 'Row Description'. - * @generated * @see org.eclipse.sirius.components.view.table.TableDescription#getRowDescription() * @see #getTableDescription() + * @generated */ EReference getTableDescription_RowDescription(); @@ -694,9 +775,9 @@ public interface TablePackage extends EPackage { * Descriptions}'. * * @return the meta object for the containment reference list 'Cell Descriptions'. - * @generated * @see org.eclipse.sirius.components.view.table.TableDescription#getCellDescriptions() * @see #getTableDescription() + * @generated */ EReference getTableDescription_CellDescriptions(); @@ -705,8 +786,8 @@ public interface TablePackage extends EPackage { * Element Description}'. * * @return the meta object for class 'Element Description'. - * @generated * @see org.eclipse.sirius.components.view.table.TableElementDescription + * @generated */ EClass getTableElementDescription(); @@ -728,9 +809,9 @@ public interface TablePackage extends EPackage { * * * @return the meta object for the attribute 'Domain Type'. - * @generated * @see org.eclipse.sirius.components.view.table.TableElementDescription#getDomainType() * @see #getTableElementDescription() + * @generated */ EAttribute getTableElementDescription_DomainType(); @@ -740,9 +821,9 @@ public interface TablePackage extends EPackage { * Semantic Candidates Expression}'. * * @return the meta object for the attribute 'Semantic Candidates Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.TableElementDescription#getSemanticCandidatesExpression() * @see #getTableElementDescription() + * @generated */ EAttribute getTableElementDescription_SemanticCandidatesExpression(); @@ -752,9 +833,9 @@ public interface TablePackage extends EPackage { * Precondition Expression}'. * * @return the meta object for the attribute 'Precondition Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.TableElementDescription#getPreconditionExpression() * @see #getTableElementDescription() + * @generated */ EAttribute getTableElementDescription_PreconditionExpression(); @@ -763,8 +844,8 @@ public interface TablePackage extends EPackage { * Description}'. * * @return the meta object for class 'Column Description'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription + * @generated */ EClass getColumnDescription(); @@ -774,9 +855,9 @@ public interface TablePackage extends EPackage { * Label Expression}'. * * @return the meta object for the attribute 'Header Index Label Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getHeaderIndexLabelExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_HeaderIndexLabelExpression(); @@ -786,9 +867,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Header Label Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getHeaderLabelExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_HeaderLabelExpression(); @@ -798,9 +879,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Header Icon Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getHeaderIconExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_HeaderIconExpression(); @@ -810,9 +891,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Initial Width Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getInitialWidthExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_InitialWidthExpression(); @@ -822,9 +903,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Is Resizable Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getIsResizableExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_IsResizableExpression(); @@ -834,9 +915,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Filter Widget Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.ColumnDescription#getFilterWidgetExpression() * @see #getColumnDescription() + * @generated */ EAttribute getColumnDescription_FilterWidgetExpression(); @@ -845,8 +926,8 @@ public interface TablePackage extends EPackage { * Description}'. * * @return the meta object for class 'Row Description'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription + * @generated */ EClass getRowDescription(); @@ -856,9 +937,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Header Label Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription#getHeaderLabelExpression() * @see #getRowDescription() + * @generated */ EAttribute getRowDescription_HeaderLabelExpression(); @@ -868,9 +949,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Header Icon Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription#getHeaderIconExpression() * @see #getRowDescription() + * @generated */ EAttribute getRowDescription_HeaderIconExpression(); @@ -880,9 +961,9 @@ public interface TablePackage extends EPackage { * Label Expression}'. * * @return the meta object for the attribute 'Header Index Label Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription#getHeaderIndexLabelExpression() * @see #getRowDescription() + * @generated */ EAttribute getRowDescription_HeaderIndexLabelExpression(); @@ -892,9 +973,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Initial Height Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription#getInitialHeightExpression() * @see #getRowDescription() + * @generated */ EAttribute getRowDescription_InitialHeightExpression(); @@ -904,19 +985,31 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Is Resizable Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.RowDescription#getIsResizableExpression() * @see #getRowDescription() + * @generated */ EAttribute getRowDescription_IsResizableExpression(); + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.table.RowDescription#getContextMenuEntries Context Menu + * Entries}'. + * + * @return the meta object for the containment reference list 'Context Menu Entries'. + * @see org.eclipse.sirius.components.view.table.RowDescription#getContextMenuEntries() + * @see #getRowDescription() + * @generated + */ + EReference getRowDescription_ContextMenuEntries(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.table.CellDescription Cell * Description}'. * * @return the meta object for class 'Cell Description'. - * @generated * @see org.eclipse.sirius.components.view.table.CellDescription + * @generated */ EClass getCellDescription(); @@ -926,9 +1019,9 @@ public interface TablePackage extends EPackage { * * * @return the meta object for the attribute 'Value Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.CellDescription#getValueExpression() * @see #getCellDescription() + * @generated */ EAttribute getCellDescription_ValueExpression(); @@ -938,9 +1031,9 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Tooltip Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.CellDescription#getTooltipExpression() * @see #getCellDescription() + * @generated */ EAttribute getCellDescription_TooltipExpression(); @@ -950,9 +1043,9 @@ public interface TablePackage extends EPackage { * Description}'. * * @return the meta object for the containment reference 'Cell Widget Description'. - * @generated * @see org.eclipse.sirius.components.view.table.CellDescription#getCellWidgetDescription() * @see #getCellDescription() + * @generated */ EReference getCellDescription_CellWidgetDescription(); @@ -961,8 +1054,8 @@ public interface TablePackage extends EPackage { * Widget Description}'. * * @return the meta object for class 'Cell Widget Description'. - * @generated * @see org.eclipse.sirius.components.view.table.CellWidgetDescription + * @generated */ EClass getCellWidgetDescription(); @@ -971,8 +1064,8 @@ public interface TablePackage extends EPackage { * Cell Textfield Widget Description}'. * * @return the meta object for class 'Cell Textfield Widget Description'. - * @generated * @see org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription + * @generated */ EClass getCellTextfieldWidgetDescription(); @@ -993,8 +1086,8 @@ public interface TablePackage extends EPackage { * Cell Label Widget Description}'. * * @return the meta object for class 'Cell Label Widget Description'. - * @generated * @see org.eclipse.sirius.components.view.table.CellLabelWidgetDescription + * @generated */ EClass getCellLabelWidgetDescription(); @@ -1004,12 +1097,82 @@ public interface TablePackage extends EPackage { * Expression}'. * * @return the meta object for the attribute 'Icon Expression'. - * @generated * @see org.eclipse.sirius.components.view.table.CellLabelWidgetDescription#getIconExpression() * @see #getCellLabelWidgetDescription() + * @generated */ EAttribute getCellLabelWidgetDescription_IconExpression(); + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry Row + * Context Menu Entry}'. + * + * @return the meta object for class 'Row Context Menu Entry'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry + * @generated + */ + EClass getRowContextMenuEntry(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getName Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry#getName() + * @see #getRowContextMenuEntry() + * @generated + */ + EAttribute getRowContextMenuEntry_Name(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getLabelExpression Label + * Expression}'. + * + * @return the meta object for the attribute 'Label Expression'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry#getLabelExpression() + * @see #getRowContextMenuEntry() + * @generated + */ + EAttribute getRowContextMenuEntry_LabelExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getIconURLExpression Icon URL + * Expression}'. + * + * @return the meta object for the attribute 'Icon URL Expression'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry#getIconURLExpression() + * @see #getRowContextMenuEntry() + * @generated + */ + EAttribute getRowContextMenuEntry_IconURLExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getPreconditionExpression Precondition + * Expression}'. + * + * @return the meta object for the attribute 'Precondition Expression'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry#getPreconditionExpression() + * @see #getRowContextMenuEntry() + * @generated + */ + EAttribute getRowContextMenuEntry_PreconditionExpression(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry#getBody Body}'. + * + * @return the meta object for the containment reference list 'Body'. + * @see org.eclipse.sirius.components.view.table.RowContextMenuEntry#getBody() + * @see #getRowContextMenuEntry() + * @generated + */ + EReference getRowContextMenuEntry_Body(); + /** * Returns the factory that creates the instances of the model. * @@ -1037,9 +1200,9 @@ interface Literals { * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.impl.TableDescriptionImpl * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.TableDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getTableDescription() + * @generated */ EClass TABLE_DESCRIPTION = eINSTANCE.getTableDescription(); @@ -1080,9 +1243,9 @@ interface Literals { * '{@link org.eclipse.sirius.components.view.table.impl.TableElementDescriptionImpl Element * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.TableElementDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getTableElementDescription() + * @generated */ EClass TABLE_ELEMENT_DESCRIPTION = eINSTANCE.getTableElementDescription(); @@ -1122,9 +1285,9 @@ interface Literals { * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.impl.ColumnDescriptionImpl * Column Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.ColumnDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getColumnDescription() + * @generated */ EClass COLUMN_DESCRIPTION = eINSTANCE.getColumnDescription(); @@ -1180,9 +1343,9 @@ interface Literals { * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.impl.RowDescriptionImpl * Row Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.RowDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getRowDescription() + * @generated */ EClass ROW_DESCRIPTION = eINSTANCE.getRowDescription(); @@ -1226,13 +1389,21 @@ interface Literals { */ EAttribute ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION = eINSTANCE.getRowDescription_IsResizableExpression(); + /** + * The meta object literal for the 'Context Menu Entries' containment reference list feature. + * + * + * @generated + */ + EReference ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES = eINSTANCE.getRowDescription_ContextMenuEntries(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.impl.CellDescriptionImpl * Cell Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellDescription() + * @generated */ EClass CELL_DESCRIPTION = eINSTANCE.getCellDescription(); @@ -1264,9 +1435,9 @@ interface Literals { * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.CellWidgetDescription * Cell Widget Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.CellWidgetDescription * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellWidgetDescription() + * @generated */ EClass CELL_WIDGET_DESCRIPTION = eINSTANCE.getCellWidgetDescription(); @@ -1275,9 +1446,9 @@ interface Literals { * '{@link org.eclipse.sirius.components.view.table.impl.CellTextfieldWidgetDescriptionImpl Cell Textfield * Widget Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellTextfieldWidgetDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellTextfieldWidgetDescription() + * @generated */ EClass CELL_TEXTFIELD_WIDGET_DESCRIPTION = eINSTANCE.getCellTextfieldWidgetDescription(); @@ -1294,9 +1465,9 @@ interface Literals { * '{@link org.eclipse.sirius.components.view.table.impl.CellLabelWidgetDescriptionImpl Cell Label Widget * Description}' class. * - * @generated * @see org.eclipse.sirius.components.view.table.impl.CellLabelWidgetDescriptionImpl * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getCellLabelWidgetDescription() + * @generated */ EClass CELL_LABEL_WIDGET_DESCRIPTION = eINSTANCE.getCellLabelWidgetDescription(); @@ -1308,6 +1479,56 @@ interface Literals { */ EAttribute CELL_LABEL_WIDGET_DESCRIPTION__ICON_EXPRESSION = eINSTANCE.getCellLabelWidgetDescription_IconExpression(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl + * Row Context Menu Entry}' class. + * + * @see org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl + * @see org.eclipse.sirius.components.view.table.impl.TablePackageImpl#getRowContextMenuEntry() + * @generated + */ + EClass ROW_CONTEXT_MENU_ENTRY = eINSTANCE.getRowContextMenuEntry(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute ROW_CONTEXT_MENU_ENTRY__NAME = eINSTANCE.getRowContextMenuEntry_Name(); + + /** + * The meta object literal for the 'Label Expression' attribute feature. + * + * + * @generated + */ + EAttribute ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION = eINSTANCE.getRowContextMenuEntry_LabelExpression(); + + /** + * The meta object literal for the 'Icon URL Expression' attribute feature. + * + * @generated + */ + EAttribute ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION = eINSTANCE.getRowContextMenuEntry_IconURLExpression(); + + /** + * The meta object literal for the 'Precondition Expression' attribute feature. + * + * @generated + */ + EAttribute ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION = eINSTANCE.getRowContextMenuEntry_PreconditionExpression(); + + /** + * The meta object literal for the 'Body' containment reference list feature. + * + * @generated + */ + EReference ROW_CONTEXT_MENU_ENTRY__BODY = eINSTANCE.getRowContextMenuEntry_Body(); + } } // TablePackage diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/ColumnDescriptionImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/ColumnDescriptionImpl.java index cf70dd37b9..fd271c5d95 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/ColumnDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/ColumnDescriptionImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -47,101 +47,112 @@ public class ColumnDescriptionImpl extends TableElementDescriptionImpl implement * The default value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' * attribute. * + * @see #getHeaderIndexLabelExpression() * @generated * @ordered - * @see #getHeaderIndexLabelExpression() */ protected static final String HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT = ""; + /** - * The default value of the '{@link #getHeaderLabelExpression() Header Label Expression}' attribute. + * The cached value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' + * attribute. * + * @see #getHeaderIndexLabelExpression() * @generated * @ordered - * @see #getHeaderLabelExpression() */ - protected static final String HEADER_LABEL_EXPRESSION_EDEFAULT = ""; + protected String headerIndexLabelExpression = HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT; + /** - * The default value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. * * @generated * @ordered - * @see #getHeaderIconExpression() + * @see #getHeaderLabelExpression() */ - protected static final String HEADER_ICON_EXPRESSION_EDEFAULT = ""; + protected static final String HEADER_LABEL_EXPRESSION_EDEFAULT = ""; + /** - * The default value of the '{@link #getInitialWidthExpression() Initial Width Expression}' attribute. * * @generated * @ordered - * @see #getInitialWidthExpression() + * @see #getHeaderLabelExpression() */ - protected static final String INITIAL_WIDTH_EXPRESSION_EDEFAULT = ""; + protected String headerLabelExpression = HEADER_LABEL_EXPRESSION_EDEFAULT; + /** - * The default value of the '{@link #getIsResizableExpression() Is Resizable Expression}' attribute. * * @generated * @ordered - * @see #getIsResizableExpression() + * @see #getHeaderIconExpression() */ - protected static final String IS_RESIZABLE_EXPRESSION_EDEFAULT = ""; + protected static final String HEADER_ICON_EXPRESSION_EDEFAULT = ""; + /** - * The default value of the '{@link #getFilterWidgetExpression() Filter Widget Expression}' attribute. * * @generated * @ordered - * @see #getFilterWidgetExpression() + * @see #getHeaderIconExpression() */ - protected static final String FILTER_WIDGET_EXPRESSION_EDEFAULT = ""; + protected String headerIconExpression = HEADER_ICON_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' - * attribute. + * The default value of the '{@link #getInitialWidthExpression() Initial Width Expression}' attribute. * * @generated * @ordered - * @see #getHeaderIndexLabelExpression() + * @see #getInitialWidthExpression() */ - protected String headerIndexLabelExpression = HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT; + protected static final String INITIAL_WIDTH_EXPRESSION_EDEFAULT = ""; + /** - * The cached value of the '{@link #getHeaderLabelExpression() Header Label Expression}' attribute. * * @generated * @ordered - * @see #getHeaderLabelExpression() + * @see #getInitialWidthExpression() */ - protected String headerLabelExpression = HEADER_LABEL_EXPRESSION_EDEFAULT; + protected String initialWidthExpression = INITIAL_WIDTH_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. * * @generated * @ordered - * @see #getHeaderIconExpression() + * @see #getIsResizableExpression() */ - protected String headerIconExpression = HEADER_ICON_EXPRESSION_EDEFAULT; + protected static final String IS_RESIZABLE_EXPRESSION_EDEFAULT = ""; + /** - * The cached value of the '{@link #getInitialWidthExpression() Initial Width Expression}' attribute. * * @generated * @ordered - * @see #getInitialWidthExpression() + * @see #getIsResizableExpression() */ - protected String initialWidthExpression = INITIAL_WIDTH_EXPRESSION_EDEFAULT; + protected String isResizableExpression = IS_RESIZABLE_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getIsResizableExpression() Is Resizable Expression}' attribute. * * @generated * @ordered - * @see #getIsResizableExpression() + * @see #getFilterWidgetExpression() */ - protected String isResizableExpression = IS_RESIZABLE_EXPRESSION_EDEFAULT; + protected static final String FILTER_WIDGET_EXPRESSION_EDEFAULT = ""; + /** * The cached value of the '{@link #getFilterWidgetExpression() Filter Widget Expression}' attribute. @@ -427,19 +438,19 @@ public String toString() { if (this.eIsProxy()) return super.toString(); - String result = super.toString() + " (headerIndexLabelExpression: " + - this.headerIndexLabelExpression + - ", headerLabelExpression: " + - this.headerLabelExpression + - ", headerIconExpression: " + - this.headerIconExpression + - ", initialWidthExpression: " + - this.initialWidthExpression + - ", isResizableExpression: " + - this.isResizableExpression + - ", filterWidgetExpression: " + - this.filterWidgetExpression + - ')'; + String result = super.toString() + " (headerIndexLabelExpression: " + + this.headerIndexLabelExpression + + ", headerLabelExpression: " + + this.headerLabelExpression + + ", headerIconExpression: " + + this.headerIconExpression + + ", initialWidthExpression: " + + this.initialWidthExpression + + ", isResizableExpression: " + + this.isResizableExpression + + ", filterWidgetExpression: " + + this.filterWidgetExpression + + ')'; return result; } diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowContextMenuEntryImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowContextMenuEntryImpl.java new file mode 100644 index 0000000000..365dc61da9 --- /dev/null +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowContextMenuEntryImpl.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * 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.table.impl; + +import java.util.Collection; +import java.util.Objects; + +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.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.components.view.Operation; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; +import org.eclipse.sirius.components.view.table.TablePackage; + +/** + * An implementation of the model object 'Row Context Menu Entry'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl#getLabelExpression Label + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl#getIconURLExpression Icon URL + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl#getPreconditionExpression + * Precondition Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.table.impl.RowContextMenuEntryImpl#getBody Body}
    • + *
    + * + * @generated + */ +public class RowContextMenuEntryImpl extends MinimalEObjectImpl.Container implements RowContextMenuEntry { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getLabelExpression() Label Expression}' attribute. + * + * @see #getLabelExpression() + * @generated + * @ordered + */ + protected static final String LABEL_EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelExpression() Label Expression}' attribute. + * + * @see #getLabelExpression() + * @generated + * @ordered + */ + protected String labelExpression = LABEL_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getIconURLExpression() Icon URL Expression}' attribute. + * + * @see #getIconURLExpression() + * @generated + * @ordered + */ + protected static final String ICON_URL_EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getIconURLExpression() Icon URL Expression}' attribute. + * + * @see #getIconURLExpression() + * @generated + * @ordered + */ + protected String iconURLExpression = ICON_URL_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getPreconditionExpression() Precondition Expression}' attribute. + * + * @see #getPreconditionExpression() + * @generated + * @ordered + */ + protected static final String PRECONDITION_EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getPreconditionExpression() Precondition Expression}' attribute. + * + * @see #getPreconditionExpression() + * @generated + * @ordered + */ + protected String preconditionExpression = PRECONDITION_EXPRESSION_EDEFAULT; + + /** + * The cached value of the '{@link #getBody() Body}' containment reference list. + * + * + * @see #getBody() + * @generated + * @ordered + */ + protected EList body; + + /** + * + * + * @generated + */ + protected RowContextMenuEntryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TablePackage.Literals.ROW_CONTEXT_MENU_ENTRY; + } + + /** + * + * + * @generated + */ + @Override + public String getName() { + return this.name; + } + + /** + * + * + * @generated + */ + @Override + public void setName(String newName) { + String oldName = this.name; + this.name = newName; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME, oldName, this.name)); + } + + /** + * + * + * @generated + */ + @Override + public String getLabelExpression() { + return this.labelExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelExpression(String newLabelExpression) { + String oldLabelExpression = this.labelExpression; + this.labelExpression = newLabelExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION, oldLabelExpression, this.labelExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getIconURLExpression() { + return this.iconURLExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setIconURLExpression(String newIconURLExpression) { + String oldIconURLExpression = this.iconURLExpression; + this.iconURLExpression = newIconURLExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION, oldIconURLExpression, this.iconURLExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getPreconditionExpression() { + return this.preconditionExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setPreconditionExpression(String newPreconditionExpression) { + String oldPreconditionExpression = this.preconditionExpression; + this.preconditionExpression = newPreconditionExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION, oldPreconditionExpression, this.preconditionExpression)); + } + + /** + * + * + * @generated + */ + @Override + public EList getBody() { + if (this.body == null) { + this.body = new EObjectContainmentEList(Operation.class, this, TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY); + } + return this.body; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + return ((InternalEList) this.getBody()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME: + return this.getName(); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION: + return this.getLabelExpression(); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION: + return this.getIconURLExpression(); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION: + return this.getPreconditionExpression(); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + return this.getBody(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME: + this.setName((String) newValue); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION: + this.setLabelExpression((String) newValue); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION: + this.setIconURLExpression((String) newValue); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION: + this.setPreconditionExpression((String) newValue); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + this.getBody().clear(); + this.getBody().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME: + this.setName(NAME_EDEFAULT); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION: + this.setLabelExpression(LABEL_EXPRESSION_EDEFAULT); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION: + this.setIconURLExpression(ICON_URL_EXPRESSION_EDEFAULT); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION: + this.setPreconditionExpression(PRECONDITION_EXPRESSION_EDEFAULT); + return; + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + this.getBody().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TablePackage.ROW_CONTEXT_MENU_ENTRY__NAME: + return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION: + return LABEL_EXPRESSION_EDEFAULT == null ? this.labelExpression != null : !LABEL_EXPRESSION_EDEFAULT.equals(this.labelExpression); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION: + return ICON_URL_EXPRESSION_EDEFAULT == null ? this.iconURLExpression != null : !ICON_URL_EXPRESSION_EDEFAULT.equals(this.iconURLExpression); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION: + return PRECONDITION_EXPRESSION_EDEFAULT == null ? this.preconditionExpression != null : !PRECONDITION_EXPRESSION_EDEFAULT.equals(this.preconditionExpression); + case TablePackage.ROW_CONTEXT_MENU_ENTRY__BODY: + return this.body != null && !this.body.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(this.name); + result.append(", labelExpression: "); + result.append(this.labelExpression); + result.append(", iconURLExpression: "); + result.append(this.iconURLExpression); + result.append(", preconditionExpression: "); + result.append(this.preconditionExpression); + result.append(')'); + return result.toString(); + } + +} // RowContextMenuEntryImpl diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowDescriptionImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowDescriptionImpl.java index 49a63e2a59..576f3f5028 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/RowDescriptionImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -12,11 +12,18 @@ *******************************************************************************/ package org.eclipse.sirius.components.view.table.impl; +import java.util.Collection; import java.util.Objects; 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.table.RowContextMenuEntry; import org.eclipse.sirius.components.view.table.RowDescription; import org.eclipse.sirius.components.view.table.TablePackage; @@ -46,78 +53,87 @@ public class RowDescriptionImpl extends TableElementDescriptionImpl implements R * @see #getHeaderLabelExpression() */ protected static final String HEADER_LABEL_EXPRESSION_EDEFAULT = ""; + /** - * The default value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. * * @generated * @ordered - * @see #getHeaderIconExpression() + * @see #getHeaderLabelExpression() */ - protected static final String HEADER_ICON_EXPRESSION_EDEFAULT = ""; + protected String headerLabelExpression = HEADER_LABEL_EXPRESSION_EDEFAULT; + /** - * The default value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' - * attribute. + * The default value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. * * @generated * @ordered - * @see #getHeaderIndexLabelExpression() + * @see #getHeaderIconExpression() */ - protected static final String HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT = null; + protected static final String HEADER_ICON_EXPRESSION_EDEFAULT = ""; + /** - * The default value of the '{@link #getInitialHeightExpression() Initial Height Expression}' attribute. - * + * The cached value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. * * @generated * @ordered - * @see #getInitialHeightExpression() + * @see #getHeaderIconExpression() */ - protected static final String INITIAL_HEIGHT_EXPRESSION_EDEFAULT = ""; + protected String headerIconExpression = HEADER_ICON_EXPRESSION_EDEFAULT; + /** - * The default value of the '{@link #getIsResizableExpression() Is Resizable Expression}' attribute. + * The default value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' + * attribute. * + * @see #getHeaderIndexLabelExpression() * @generated * @ordered - * @see #getIsResizableExpression() */ - protected static final String IS_RESIZABLE_EXPRESSION_EDEFAULT = ""; + protected static final String HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT = null; + /** - * The cached value of the '{@link #getHeaderLabelExpression() Header Label Expression}' attribute. + * The cached value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' + * attribute. * + * @see #getHeaderIndexLabelExpression() * @generated * @ordered - * @see #getHeaderLabelExpression() */ - protected String headerLabelExpression = HEADER_LABEL_EXPRESSION_EDEFAULT; + protected String headerIndexLabelExpression = HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getHeaderIconExpression() Header Icon Expression}' attribute. + * The default value of the '{@link #getInitialHeightExpression() Initial Height Expression}' attribute. + * * + * @see #getInitialHeightExpression() * @generated * @ordered - * @see #getHeaderIconExpression() */ - protected String headerIconExpression = HEADER_ICON_EXPRESSION_EDEFAULT; + protected static final String INITIAL_HEIGHT_EXPRESSION_EDEFAULT = ""; + /** - * The cached value of the '{@link #getHeaderIndexLabelExpression() Header Index Label Expression}' - * attribute. + * The cached value of the '{@link #getInitialHeightExpression() Initial Height Expression}' attribute. + * * + * @see #getInitialHeightExpression() * @generated * @ordered - * @see #getHeaderIndexLabelExpression() */ - protected String headerIndexLabelExpression = HEADER_INDEX_LABEL_EXPRESSION_EDEFAULT; + protected String initialHeightExpression = INITIAL_HEIGHT_EXPRESSION_EDEFAULT; + /** - * The cached value of the '{@link #getInitialHeightExpression() Initial Height Expression}' attribute. - * + * The default value of the '{@link #getIsResizableExpression() Is Resizable Expression}' attribute. * * @generated * @ordered - * @see #getInitialHeightExpression() + * @see #getIsResizableExpression() */ - protected String initialHeightExpression = INITIAL_HEIGHT_EXPRESSION_EDEFAULT; + protected static final String IS_RESIZABLE_EXPRESSION_EDEFAULT = ""; + /** * The cached value of the '{@link #getIsResizableExpression() Is Resizable Expression}' attribute. @@ -128,6 +144,16 @@ public class RowDescriptionImpl extends TableElementDescriptionImpl implements R */ protected String isResizableExpression = IS_RESIZABLE_EXPRESSION_EDEFAULT; + /** + * The cached value of the '{@link #getContextMenuEntries() Context Menu Entries}' containment reference + * list. + * + * @see #getContextMenuEntries() + * @generated + * @ordered + */ + protected EList contextMenuEntries; + /** * * @@ -262,6 +288,33 @@ public void setIsResizableExpression(String newIsResizableExpression) { this.eNotify(new ENotificationImpl(this, Notification.SET, TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION, oldIsResizableExpression, this.isResizableExpression)); } + /** + * + * + * @generated + */ + @Override + public EList getContextMenuEntries() { + if (this.contextMenuEntries == null) { + this.contextMenuEntries = new EObjectContainmentEList<>(RowContextMenuEntry.class, this, TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES); + } + return this.contextMenuEntries; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + return ((InternalEList) this.getContextMenuEntries()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + /** * * @@ -280,6 +333,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getInitialHeightExpression(); case TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION: return this.getIsResizableExpression(); + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + return this.getContextMenuEntries(); } return super.eGet(featureID, resolve, coreType); } @@ -289,6 +344,7 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -307,6 +363,10 @@ public void eSet(int featureID, Object newValue) { case TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION: this.setIsResizableExpression((String) newValue); return; + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + this.getContextMenuEntries().clear(); + this.getContextMenuEntries().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -334,6 +394,9 @@ public void eUnset(int featureID) { case TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION: this.setIsResizableExpression(IS_RESIZABLE_EXPRESSION_EDEFAULT); return; + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + this.getContextMenuEntries().clear(); + return; } super.eUnset(featureID); } @@ -356,6 +419,8 @@ public boolean eIsSet(int featureID) { return INITIAL_HEIGHT_EXPRESSION_EDEFAULT == null ? this.initialHeightExpression != null : !INITIAL_HEIGHT_EXPRESSION_EDEFAULT.equals(this.initialHeightExpression); case TablePackage.ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION: return IS_RESIZABLE_EXPRESSION_EDEFAULT == null ? this.isResizableExpression != null : !IS_RESIZABLE_EXPRESSION_EDEFAULT.equals(this.isResizableExpression); + case TablePackage.ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES: + return this.contextMenuEntries != null && !this.contextMenuEntries.isEmpty(); } return super.eIsSet(featureID); } @@ -370,17 +435,17 @@ public String toString() { if (this.eIsProxy()) return super.toString(); - String result = super.toString() + " (headerLabelExpression: " + - this.headerLabelExpression + - ", headerIconExpression: " + - this.headerIconExpression + - ", headerIndexLabelExpression: " + - this.headerIndexLabelExpression + - ", initialHeightExpression: " + - this.initialHeightExpression + - ", isResizableExpression: " + - this.isResizableExpression + - ')'; + String result = super.toString() + " (headerLabelExpression: " + + this.headerLabelExpression + + ", headerIconExpression: " + + this.headerIconExpression + + ", headerIndexLabelExpression: " + + this.headerIndexLabelExpression + + ", initialHeightExpression: " + + this.initialHeightExpression + + ", isResizableExpression: " + + this.isResizableExpression + + ')'; return result; } diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableDescriptionImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableDescriptionImpl.java index bb532611a9..7d42e1264e 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableDescriptionImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -54,9 +54,9 @@ public class TableDescriptionImpl extends RepresentationDescriptionImpl implemen * The default value of the '{@link #getUseStripedRowsExpression() Use Striped Rows Expression}' attribute. * * + * @see #getUseStripedRowsExpression() * @generated * @ordered - * @see #getUseStripedRowsExpression() */ protected static final String USE_STRIPED_ROWS_EXPRESSION_EDEFAULT = null; @@ -64,9 +64,9 @@ public class TableDescriptionImpl extends RepresentationDescriptionImpl implemen * The cached value of the '{@link #getUseStripedRowsExpression() Use Striped Rows Expression}' attribute. * * + * @see #getUseStripedRowsExpression() * @generated * @ordered - * @see #getUseStripedRowsExpression() */ protected String useStripedRowsExpression = USE_STRIPED_ROWS_EXPRESSION_EDEFAULT; @@ -74,9 +74,9 @@ public class TableDescriptionImpl extends RepresentationDescriptionImpl implemen * The cached value of the '{@link #getColumnDescriptions() Column Descriptions}' containment reference * list. * + * @see #getColumnDescriptions() * @generated * @ordered - * @see #getColumnDescriptions() */ protected EList columnDescriptions; @@ -94,9 +94,9 @@ public class TableDescriptionImpl extends RepresentationDescriptionImpl implemen * The cached value of the '{@link #getCellDescriptions() Cell Descriptions}' containment reference list. * * + * @see #getCellDescriptions() * @generated * @ordered - * @see #getCellDescriptions() */ protected EList cellDescriptions; @@ -150,7 +150,7 @@ public void setUseStripedRowsExpression(String newUseStripedRowsExpression) { @Override public EList getColumnDescriptions() { if (this.columnDescriptions == null) { - this.columnDescriptions = new EObjectContainmentEList<>(ColumnDescription.class, this, TablePackage.TABLE_DESCRIPTION__COLUMN_DESCRIPTIONS); + this.columnDescriptions = new EObjectContainmentEList(ColumnDescription.class, this, TablePackage.TABLE_DESCRIPTION__COLUMN_DESCRIPTIONS); } return this.columnDescriptions; } @@ -211,7 +211,7 @@ public NotificationChain basicSetRowDescription(RowDescription newRowDescription @Override public EList getCellDescriptions() { if (this.cellDescriptions == null) { - this.cellDescriptions = new EObjectContainmentEList<>(CellDescription.class, this, TablePackage.TABLE_DESCRIPTION__CELL_DESCRIPTIONS); + this.cellDescriptions = new EObjectContainmentEList(CellDescription.class, this, TablePackage.TABLE_DESCRIPTION__CELL_DESCRIPTIONS); } return this.cellDescriptions; } @@ -335,9 +335,9 @@ public String toString() { if (this.eIsProxy()) return super.toString(); - String result = super.toString() + " (useStripedRowsExpression: " + - this.useStripedRowsExpression + - ')'; + String result = super.toString() + " (useStripedRowsExpression: " + + this.useStripedRowsExpression + + ')'; return result; } diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableFactoryImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableFactoryImpl.java index d0f73fbfcf..e747f15a77 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableFactoryImpl.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TableFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -21,6 +21,7 @@ import org.eclipse.sirius.components.view.table.CellLabelWidgetDescription; import org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription; import org.eclipse.sirius.components.view.table.ColumnDescription; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; import org.eclipse.sirius.components.view.table.RowDescription; import org.eclipse.sirius.components.view.table.TableDescription; import org.eclipse.sirius.components.view.table.TableFactory; @@ -79,6 +80,8 @@ public EObject create(EClass eClass) { return this.createCellTextfieldWidgetDescription(); case TablePackage.CELL_LABEL_WIDGET_DESCRIPTION: return this.createCellLabelWidgetDescription(); + case TablePackage.ROW_CONTEXT_MENU_ENTRY: + return this.createRowContextMenuEntry(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -150,6 +153,17 @@ public CellLabelWidgetDescription createCellLabelWidgetDescription() { return cellLabelWidgetDescription; } + /** + * + * + * @generated + */ + @Override + public RowContextMenuEntry createRowContextMenuEntry() { + RowContextMenuEntryImpl rowContextMenuEntry = new RowContextMenuEntryImpl(); + return rowContextMenuEntry; + } + /** * * diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TablePackageImpl.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TablePackageImpl.java index d06cbe2470..9a273d3698 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TablePackageImpl.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/impl/TablePackageImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -23,6 +23,7 @@ import org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription; import org.eclipse.sirius.components.view.table.CellWidgetDescription; import org.eclipse.sirius.components.view.table.ColumnDescription; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; import org.eclipse.sirius.components.view.table.RowDescription; import org.eclipse.sirius.components.view.table.TableDescription; import org.eclipse.sirius.components.view.table.TableElementDescription; @@ -92,6 +93,13 @@ public class TablePackageImpl extends EPackageImpl implements TablePackage { */ private EClass cellLabelWidgetDescriptionEClass = null; + /** + * + * + * @generated + */ + private EClass rowContextMenuEntryEClass = null; + /** * * @@ -138,10 +146,10 @@ private TablePackageImpl() { * invoke it directly. Instead, they should simply access that field to obtain the package. * * - * @generated * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() + * @generated */ public static TablePackage init() { if (isInited) @@ -400,6 +408,16 @@ public EAttribute getRowDescription_IsResizableExpression() { return (EAttribute) this.rowDescriptionEClass.getEStructuralFeatures().get(4); } + /** + * + * + * @generated + */ + @Override + public EReference getRowDescription_ContextMenuEntries() { + return (EReference) this.rowDescriptionEClass.getEStructuralFeatures().get(5); + } + /** * * @@ -490,6 +508,66 @@ public EAttribute getCellLabelWidgetDescription_IconExpression() { return (EAttribute) this.cellLabelWidgetDescriptionEClass.getEStructuralFeatures().get(0); } + /** + * + * + * @generated + */ + @Override + public EClass getRowContextMenuEntry() { + return this.rowContextMenuEntryEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getRowContextMenuEntry_Name() { + return (EAttribute) this.rowContextMenuEntryEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getRowContextMenuEntry_LabelExpression() { + return (EAttribute) this.rowContextMenuEntryEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getRowContextMenuEntry_IconURLExpression() { + return (EAttribute) this.rowContextMenuEntryEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getRowContextMenuEntry_PreconditionExpression() { + return (EAttribute) this.rowContextMenuEntryEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + @Override + public EReference getRowContextMenuEntry_Body() { + return (EReference) this.rowContextMenuEntryEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -538,6 +616,7 @@ public void createPackageContents() { this.createEAttribute(this.rowDescriptionEClass, ROW_DESCRIPTION__HEADER_INDEX_LABEL_EXPRESSION); this.createEAttribute(this.rowDescriptionEClass, ROW_DESCRIPTION__INITIAL_HEIGHT_EXPRESSION); this.createEAttribute(this.rowDescriptionEClass, ROW_DESCRIPTION__IS_RESIZABLE_EXPRESSION); + this.createEReference(this.rowDescriptionEClass, ROW_DESCRIPTION__CONTEXT_MENU_ENTRIES); this.cellDescriptionEClass = this.createEClass(CELL_DESCRIPTION); this.createEAttribute(this.cellDescriptionEClass, CELL_DESCRIPTION__VALUE_EXPRESSION); @@ -551,6 +630,13 @@ public void createPackageContents() { this.cellLabelWidgetDescriptionEClass = this.createEClass(CELL_LABEL_WIDGET_DESCRIPTION); this.createEAttribute(this.cellLabelWidgetDescriptionEClass, CELL_LABEL_WIDGET_DESCRIPTION__ICON_EXPRESSION); + + this.rowContextMenuEntryEClass = this.createEClass(ROW_CONTEXT_MENU_ENTRY); + this.createEAttribute(this.rowContextMenuEntryEClass, ROW_CONTEXT_MENU_ENTRY__NAME); + this.createEAttribute(this.rowContextMenuEntryEClass, ROW_CONTEXT_MENU_ENTRY__LABEL_EXPRESSION); + this.createEAttribute(this.rowContextMenuEntryEClass, ROW_CONTEXT_MENU_ENTRY__ICON_URL_EXPRESSION); + this.createEAttribute(this.rowContextMenuEntryEClass, ROW_CONTEXT_MENU_ENTRY__PRECONDITION_EXPRESSION); + this.createEReference(this.rowContextMenuEntryEClass, ROW_CONTEXT_MENU_ENTRY__BODY); } /** @@ -633,6 +719,8 @@ public void initializePackageContents() { !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getRowDescription_IsResizableExpression(), theViewPackage.getInterpretedExpression(), "isResizableExpression", "", 0, 1, RowDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getRowDescription_ContextMenuEntries(), this.getRowContextMenuEntry(), null, "contextMenuEntries", null, 0, -1, RowDescription.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.cellDescriptionEClass, CellDescription.class, "CellDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getCellDescription_ValueExpression(), theViewPackage.getInterpretedExpression(), "valueExpression", "", 0, 1, CellDescription.class, !IS_TRANSIENT, !IS_VOLATILE, @@ -652,6 +740,18 @@ public void initializePackageContents() { this.initEAttribute(this.getCellLabelWidgetDescription_IconExpression(), theViewPackage.getInterpretedExpression(), "iconExpression", "", 0, 1, CellLabelWidgetDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEClass(this.rowContextMenuEntryEClass, RowContextMenuEntry.class, "RowContextMenuEntry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getRowContextMenuEntry_Name(), theViewPackage.getIdentifier(), "name", null, 1, 1, RowContextMenuEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getRowContextMenuEntry_LabelExpression(), theViewPackage.getInterpretedExpression(), "labelExpression", null, 0, 1, RowContextMenuEntry.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getRowContextMenuEntry_IconURLExpression(), theViewPackage.getInterpretedExpression(), "iconURLExpression", null, 0, 1, RowContextMenuEntry.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getRowContextMenuEntry_PreconditionExpression(), theViewPackage.getInterpretedExpression(), "preconditionExpression", null, 0, 1, RowContextMenuEntry.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getRowContextMenuEntry_Body(), theViewPackage.getOperation(), null, "body", null, 0, -1, RowContextMenuEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Create resource this.createResource(eNS_URI); } diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableAdapterFactory.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableAdapterFactory.java index 9e6e1b5509..f5c1504438 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -22,6 +22,7 @@ import org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription; import org.eclipse.sirius.components.view.table.CellWidgetDescription; import org.eclipse.sirius.components.view.table.ColumnDescription; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; import org.eclipse.sirius.components.view.table.RowDescription; import org.eclipse.sirius.components.view.table.TableDescription; import org.eclipse.sirius.components.view.table.TableElementDescription; @@ -89,6 +90,11 @@ public Adapter caseCellLabelWidgetDescription(CellLabelWidgetDescription object) return TableAdapterFactory.this.createCellLabelWidgetDescriptionAdapter(); } + @Override + public Adapter caseRowContextMenuEntry(RowContextMenuEntry object) { + return TableAdapterFactory.this.createRowContextMenuEntryAdapter(); + } + @Override public Adapter caseRepresentationDescription(RepresentationDescription object) { return TableAdapterFactory.this.createRepresentationDescriptionAdapter(); @@ -255,6 +261,20 @@ public Adapter createCellLabelWidgetDescriptionAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.table.RowContextMenuEntry + * Row Context Menu Entry}'. 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.table.RowContextMenuEntry + * @generated + */ + public Adapter createRowContextMenuEntryAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.RepresentationDescription * Representation Description}'. This default implementation returns null so that diff --git a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableSwitch.java b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableSwitch.java index e15a4a238b..6118a4a569 100644 --- a/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableSwitch.java +++ b/packages/view/backend/sirius-components-view-table/src/main/java/org/eclipse/sirius/components/view/table/util/TableSwitch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 CEA LIST. + * Copyright (c) 2024, 2025 CEA LIST. * 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 @@ -21,6 +21,7 @@ import org.eclipse.sirius.components.view.table.CellTextfieldWidgetDescription; import org.eclipse.sirius.components.view.table.CellWidgetDescription; import org.eclipse.sirius.components.view.table.ColumnDescription; +import org.eclipse.sirius.components.view.table.RowContextMenuEntry; import org.eclipse.sirius.components.view.table.RowDescription; import org.eclipse.sirius.components.view.table.TableDescription; import org.eclipse.sirius.components.view.table.TableElementDescription; @@ -146,6 +147,13 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case TablePackage.ROW_CONTEXT_MENU_ENTRY: { + RowContextMenuEntry rowContextMenuEntry = (RowContextMenuEntry) theEObject; + T result = this.caseRowContextMenuEntry(rowContextMenuEntry); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } default: return this.defaultCase(theEObject); } @@ -270,6 +278,21 @@ public T caseCellLabelWidgetDescription(CellLabelWidgetDescription object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'Row Context Menu Entry'. 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 'Row Context Menu Entry'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseRowContextMenuEntry(RowContextMenuEntry object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Representation Description'. This implementation returns null; returning a non-null result will terminate the switch.