From 7882b3c268ff2683e35a85a6904a639f5c3171c4 Mon Sep 17 00:00:00 2001 From: Jerome Gout Date: Mon, 16 Sep 2024 15:15:39 +0200 Subject: [PATCH] [4000] Add support for styled labels in view model for trees Bug: https://github.com/eclipse-sirius/sirius-web/issues/4000 Signed-off-by: Jerome Gout --- CHANGELOG.adoc | 1 + .../api/labels/StyledStringFragmentStyle.java | 30 ++ .../src/label/StyledLabel.tsx | 2 + .../src/label/StyledLabel.type.ts | 2 + .../emf/services/StyledStringConverter.java | 16 +- .../DomainViewTreeDescriptionProvider.java | 121 ++++- .../trees/DomainExplorerControllerTests.java | 2 +- .../views/ViewControllerIntegrationTests.java | 108 +++++ .../src/main/resources/schema/tree.graphqls | 2 + .../GraphqlTreeEventSubscription.test.ts | 2 + .../src/views/getTreeEventSubscription.ts | 2 + .../builder/generated/tree/TreeBuilders.java | 20 + .../tree/TreeDescriptionBuilder.java | 21 +- .../tree/TreeItemLabelDescriptionBuilder.java | 79 +++ ...reeItemLabelElementDescriptionBuilder.java | 31 ++ ...eeItemLabelFragmentDescriptionBuilder.java | 68 +++ .../view/TextStyleDescriptionBuilder.java | 101 ++++ .../view/TextStylePaletteBuilder.java | 68 +++ .../builder/generated/view/ViewBuilder.java | 12 + .../builder/generated/view/ViewBuilders.java | 20 + .../TextStyleDescriptionItemProvider.java | 223 +++++++++ .../TextStylePaletteItemProvider.java | 186 +++++++ .../view/provider/ViewItemProvider.java | 7 +- .../ViewItemProviderAdapterFactory.java | 50 ++ .../icons/full/obj16/TextStyleDescription.svg | 1 + .../icons/full/obj16/TextStylePalette.svg | 1 + .../src/main/resources/plugin.properties | 15 +- .../view/emf/tree/TreeItemStyleConverter.java | 97 ++++ .../tree/ViewTreeDescriptionConverter.java | 14 +- .../provider/TreeDescriptionItemProvider.java | 35 +- .../TreeItemLabelDescriptionItemProvider.java | 210 ++++++++ ...emLabelElementDescriptionItemProvider.java | 122 +++++ ...mLabelFragmentDescriptionItemProvider.java | 159 ++++++ .../TreeItemProviderAdapterFactory.java | 56 +++ .../TreeItemLabelFragmentDescription.gif | Bin 0 -> 129 bytes .../src/main/resources/plugin.properties | 10 +- .../components/view/tree/TreeDescription.java | 40 +- .../components/view/tree/TreeFactory.java | 17 + .../view/tree/TreeItemLabelDescription.java | 95 ++++ .../tree/TreeItemLabelElementDescription.java | 27 ++ .../TreeItemLabelFragmentDescription.java | 81 ++++ .../components/view/tree/TreePackage.java | 368 ++++++++++++-- .../view/tree/impl/TreeDescriptionImpl.java | 116 ++--- .../view/tree/impl/TreeFactoryImpl.java | 28 ++ .../impl/TreeItemLabelDescriptionImpl.java | 288 +++++++++++ .../TreeItemLabelElementDescriptionImpl.java | 46 ++ .../TreeItemLabelFragmentDescriptionImpl.java | 239 +++++++++ .../view/tree/impl/TreePackageImpl.java | 160 +++++- .../view/tree/util/TreeAdapterFactory.java | 60 +++ .../components/view/tree/util/TreeSwitch.java | 71 +++ .../src/main/resources/model/tree.ecore | 16 +- .../src/main/resources/model/tree.genmodel | 12 +- .../components/view/TextStyleDescription.java | 182 +++++++ .../components/view/TextStylePalette.java | 68 +++ .../eclipse/sirius/components/view/View.java | 13 + .../sirius/components/view/ViewFactory.java | 16 + .../sirius/components/view/ViewPackage.java | 365 +++++++++++++- .../view/impl/TextStyleDescriptionImpl.java | 457 ++++++++++++++++++ .../view/impl/TextStylePaletteImpl.java | 230 +++++++++ .../components/view/impl/ViewFactoryImpl.java | 28 ++ .../sirius/components/view/impl/ViewImpl.java | 38 ++ .../components/view/impl/ViewPackageImpl.java | 163 +++++++ .../view/util/ViewAdapterFactory.java | 40 ++ .../components/view/util/ViewSwitch.java | 46 ++ .../src/main/resources/model/view.ecore | 20 + .../src/main/resources/model/view.genmodel | 13 + scripts/check-coverage.jsh | 4 +- 67 files changed, 5055 insertions(+), 186 deletions(-) create mode 100644 packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/views/ViewControllerIntegrationTests.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelDescriptionBuilder.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelElementDescriptionBuilder.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelFragmentDescriptionBuilder.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStyleDescriptionBuilder.java create mode 100644 packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStylePaletteBuilder.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStyleDescriptionItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStylePaletteItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStyleDescription.svg create mode 100644 packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStylePalette.svg create mode 100644 packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java create mode 100644 packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelElementDescriptionItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelFragmentDescriptionItemProvider.java create mode 100644 packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/TreeItemLabelFragmentDescription.gif create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelDescription.java create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelElementDescription.java create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelFragmentDescription.java create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelDescriptionImpl.java create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelElementDescriptionImpl.java create mode 100644 packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelFragmentDescriptionImpl.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/TextStyleDescription.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/TextStylePalette.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStyleDescriptionImpl.java create mode 100644 packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStylePaletteImpl.java diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index e0a0fae21aa..27dd43b6c29 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -43,6 +43,7 @@ - https://github.com/eclipse-sirius/sirius-web/issues/3882[#3882] [sirius-web] Add a new tree event to handle tree description which are not explorer-related - https://github.com/eclipse-sirius/sirius-web/issues/3961[#3961] [sirius-web] Extend the explorer to support multiple presentations - https://github.com/eclipse-sirius/sirius-web/issues/3856[#3856] [trees] Add tree representation in the view DSL +- https://github.com/eclipse-sirius/sirius-web/issues/4000[#4000] [trees] Add support for styled labels in view model for trees == v2024.9.0 diff --git a/packages/core/backend/sirius-components-core/src/main/java/org/eclipse/sirius/components/core/api/labels/StyledStringFragmentStyle.java b/packages/core/backend/sirius-components-core/src/main/java/org/eclipse/sirius/components/core/api/labels/StyledStringFragmentStyle.java index 8edcb47bc17..5bcc5661023 100644 --- a/packages/core/backend/sirius-components-core/src/main/java/org/eclipse/sirius/components/core/api/labels/StyledStringFragmentStyle.java +++ b/packages/core/backend/sirius-components-core/src/main/java/org/eclipse/sirius/components/core/api/labels/StyledStringFragmentStyle.java @@ -37,6 +37,10 @@ public final class StyledStringFragmentStyle { private boolean struckOut; + private boolean bold; + + private boolean italic; + private UnderLineStyle underlineStyle; private BorderStyle borderStyle; @@ -73,6 +77,14 @@ public boolean isStruckOut() { return this.struckOut; } + public boolean isBold() { + return this.bold; + } + + public boolean isItalic() { + return this.italic; + } + public static Builder newStyledStringFragmentStyle() { return new Builder(); } @@ -86,6 +98,8 @@ public static Builder newDefaultStyledStringFragmentStyle() { .underlineColor("") .borderColor("") .struckOut(false) + .bold(false) + .italic(false) .underlineStyle(UnderLineStyle.NONE) .borderStyle(BorderStyle.NONE); } @@ -119,6 +133,10 @@ public static final class Builder { private boolean struckOut; + private boolean bold; + + private boolean italic; + private UnderLineStyle underlineStyle; private BorderStyle borderStyle; @@ -162,6 +180,16 @@ public Builder struckOut(boolean struckOut) { return this; } + public Builder bold(boolean bold) { + this.bold = bold; + return this; + } + + public Builder italic(boolean italic) { + this.italic = italic; + return this; + } + public Builder underlineStyle(UnderLineStyle underlineStyle) { this.underlineStyle = Objects.requireNonNull(underlineStyle); return this; @@ -183,6 +211,8 @@ public StyledStringFragmentStyle build() { styledStringFragmentStyle.struckOut = Objects.requireNonNull(this.struckOut); styledStringFragmentStyle.underlineStyle = Objects.requireNonNull(this.underlineStyle); styledStringFragmentStyle.borderStyle = Objects.requireNonNull(this.borderStyle); + styledStringFragmentStyle.bold = Objects.requireNonNull(this.bold); + styledStringFragmentStyle.italic = Objects.requireNonNull(this.italic); return styledStringFragmentStyle; } diff --git a/packages/core/frontend/sirius-components-core/src/label/StyledLabel.tsx b/packages/core/frontend/sirius-components-core/src/label/StyledLabel.tsx index cf40e21b07f..29c3e79c71f 100644 --- a/packages/core/frontend/sirius-components-core/src/label/StyledLabel.tsx +++ b/packages/core/frontend/sirius-components-core/src/label/StyledLabel.tsx @@ -102,6 +102,8 @@ const styledLabelStyle = (gqlLabelStyle: GQLStyledStringFragmentStyle): React.CS color: gqlLabelStyle.foregroundColor, textDecoration: textDecorations.join(' '), border: border.join(' '), + fontWeight: gqlLabelStyle.isBold ? 'bold' : 'normal', + fontStyle: gqlLabelStyle.isItalic ? 'italic' : 'normal', }; return style; }; diff --git a/packages/core/frontend/sirius-components-core/src/label/StyledLabel.type.ts b/packages/core/frontend/sirius-components-core/src/label/StyledLabel.type.ts index d2e240ef374..92934cdb513 100644 --- a/packages/core/frontend/sirius-components-core/src/label/StyledLabel.type.ts +++ b/packages/core/frontend/sirius-components-core/src/label/StyledLabel.type.ts @@ -40,6 +40,8 @@ export interface GQLStyledStringFragmentStyle { borderColor: string; borderStyle: GQLBorderStyle; underlineStyle: GQLUnderLineStyle; + isBold: boolean; + isItalic: boolean; } export type GQLUnderLineStyle = 'NONE' | 'SOLID' | 'DOUBLE' | 'DOTTED' | 'DASHED' | 'WAVY'; diff --git a/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/StyledStringConverter.java b/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/StyledStringConverter.java index d91224a5767..1bc8a5cc460 100644 --- a/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/StyledStringConverter.java +++ b/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/StyledStringConverter.java @@ -43,15 +43,15 @@ public StyledString convert(org.eclipse.emf.edit.provider.StyledString styledStr } private StyledStringFragment convertStyledStringFragment(org.eclipse.emf.edit.provider.StyledString.Fragment styledStringFragment) { - String backgroundColor = convertEmfColorToCss(styledStringFragment.getStyle().getBackgoundColor()); - String foregroundColor = convertEmfColorToCss(styledStringFragment.getStyle().getForegroundColor()); - String strikeoutColor = convertEmfColorToCss(styledStringFragment.getStyle().getStrikeoutColor()); - String underlineColor = convertEmfColorToCss(styledStringFragment.getStyle().getUnderlineColor()); - String borderColor = convertEmfColorToCss(styledStringFragment.getStyle().getBorderColor()); + String backgroundColor = this.convertEmfColorToCss(styledStringFragment.getStyle().getBackgoundColor()); + String foregroundColor = this.convertEmfColorToCss(styledStringFragment.getStyle().getForegroundColor()); + String strikeoutColor = this.convertEmfColorToCss(styledStringFragment.getStyle().getStrikeoutColor()); + String underlineColor = this.convertEmfColorToCss(styledStringFragment.getStyle().getUnderlineColor()); + String borderColor = this.convertEmfColorToCss(styledStringFragment.getStyle().getBorderColor()); String font = Optional.ofNullable(styledStringFragment.getStyle().getFont()).map(URI::toString).orElse("Arial"); boolean struckOut = styledStringFragment.getStyle().isStrikedout(); - UnderLineStyle underLineStyle = convertEmfUnderLineToCss(styledStringFragment.getStyle().getUnderlineStyle()); - BorderStyle borderStyle = convertEmfUnderLineToCss(styledStringFragment.getStyle().getBorderStyle()); + UnderLineStyle underLineStyle = this.convertEmfUnderLineToCss(styledStringFragment.getStyle().getUnderlineStyle()); + BorderStyle borderStyle = this.convertEmfUnderLineToCss(styledStringFragment.getStyle().getBorderStyle()); StyledStringFragmentStyle styledStringFragmentStyle = StyledStringFragmentStyle.newStyledStringFragmentStyle() .font(font) @@ -63,6 +63,8 @@ private StyledStringFragment convertStyledStringFragment(org.eclipse.emf.edit.pr .struckOut(struckOut) .underlineStyle(underLineStyle) .borderStyle(borderStyle) + .bold(false) + .italic(false) .build(); return new StyledStringFragment(styledStringFragment.getString(), styledStringFragmentStyle); diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java index 78bd50904c2..2b0eb7d61f6 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/studio/services/representations/DomainViewTreeDescriptionProvider.java @@ -21,11 +21,15 @@ import org.eclipse.sirius.components.emf.ResourceMetadataAdapter; import org.eclipse.sirius.components.emf.services.IDAdapter; import org.eclipse.sirius.components.emf.services.JSONResourceFactory; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.View; import org.eclipse.sirius.components.view.builder.generated.tree.TreeBuilders; import org.eclipse.sirius.components.view.builder.generated.view.ViewBuilders; import org.eclipse.sirius.components.view.emf.tree.ITreeIdProvider; import org.eclipse.sirius.components.view.tree.TreeDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; import org.eclipse.sirius.emfjson.resource.JsonResource; import org.eclipse.sirius.web.application.editingcontext.EditingContext; import org.eclipse.sirius.web.application.studio.services.api.IStudioCapableEditingContextPredicate; @@ -41,6 +45,14 @@ public class DomainViewTreeDescriptionProvider implements IEditingContextProcess public static final String DOMAIN_EXPLORER_DESCRIPTION_NAME = "Domain explorer by DSL"; + private static final String BLUE_ITALIC_TEXT_STYLE_NAME = "blue italic"; + + private static final String BROWN_BOLD_TEXT_STYLE_NAME = "brown bold"; + + private static final String NORMAL_TEXT_STYLE_NAME = "normal"; + + private static final String AQL_TRUE = "aql:true"; + private static final String AQL_FALSE = "aql:false"; private static final String DOMAIN_VIEW_EXPLORER_ID = "DomainExplorer"; @@ -67,13 +79,16 @@ public void preProcess(IEditingContext editingContext) { } private View createView() { - var domainExplorerDescription = this.domainExplorerDescription(); + var domainTextStylePalette = this.createTextStylePalette(); + var domainExplorerDescription = this.domainExplorerDescription(domainTextStylePalette); var domainView = new ViewBuilders() .newView() - .descriptions(domainExplorerDescription) + .textStylePalettes(domainTextStylePalette) .build(); + domainView.getDescriptions().add(domainExplorerDescription); + domainView.eAllContents().forEachRemaining(eObject -> { var id = UUID.nameUUIDFromBytes(EcoreUtil.getURI(eObject).toString().getBytes()); eObject.eAdapters().add(new IDAdapter(id)); @@ -91,7 +106,7 @@ public String getRepresentationDescriptionId() { return this.treeIdProvider.getId(this.viewDescription); } - private TreeDescription domainExplorerDescription() { + private TreeDescription domainExplorerDescription(TextStylePalette domainTextStylePalette) { this.viewDescription = new TreeBuilders() .newTreeDescription() .name(DOMAIN_EXPLORER_DESCRIPTION_NAME) @@ -106,11 +121,109 @@ private TreeDescription domainExplorerDescription() { .elementsExpression("aql:editingContext.getElements()") .childrenExpression("aql:self.getChildren(editingContext, expanded)") .parentExpression("aql:self.getParent(editingContext, id)") - .treeItemLabelExpression("aql:self.getTreeItemLabel()") .treeItemIdExpression("aql:self.getTreeItemId()") .treeItemObjectExpression("aql:editingContext.getTreeItemObject(id)") .preconditionExpression(AQL_FALSE) // -> set canCreate to false to avoid to be display in New representation menu + .treeItemLabelDescriptions(this.entityStyle(domainTextStylePalette), this.attributeStyle(domainTextStylePalette), this.defaultStyle()) .build(); return this.viewDescription; } + + + private TextStylePalette createTextStylePalette() { + return new ViewBuilders() + .newTextStylePalette() + .name("Domain Text Style Palette") + .styles(this.getBrownBoldStyle(), this.getBlueItalicStyle(), this.getNormalStyle()) + .build(); + } + + private TreeItemLabelDescription attributeStyle(TextStylePalette textStylePalette) { + return new TreeBuilders() + .newTreeItemLabelDescription() + .name("attribute style") + .preconditionExpression("aql:self.oclIsKindOf(domain::Attribute)") + .children(this.getAttributeKeyFragment(textStylePalette), this.getAttributeValueFragment(textStylePalette)) + .build(); + } + + private TreeItemLabelDescription entityStyle(TextStylePalette textStylePalette) { + return new TreeBuilders() + .newTreeItemLabelDescription() + .name("entity style") + .preconditionExpression("aql:self.oclIsKindOf(domain::Entity)") + .children(this.getEntityKeyFragment(textStylePalette), this.getEntityValueFragment(textStylePalette)) + .build(); + } + + private TreeItemLabelDescription defaultStyle() { + return new TreeBuilders() + .newTreeItemLabelDescription() + .name("default style") + .preconditionExpression("aql:true") + .children(new TreeBuilders() + .newTreeItemLabelFragmentDescription() + .labelExpression("aql:self.getTreeItemLabel()") + // no style specified => default one will be chosen + .build() + ) + .build(); + } + + private TreeItemLabelElementDescription getEntityValueFragment(TextStylePalette textStylePalette) { + return new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:self.getTreeItemLabel()") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build(); + } + + private TreeItemLabelElementDescription getEntityKeyFragment(TextStylePalette textStylePalette) { + return new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:'[Entity] '") + .style(this.getTextStyleByName(textStylePalette, BROWN_BOLD_TEXT_STYLE_NAME)) + .build(); + } + + private TreeItemLabelElementDescription getAttributeValueFragment(TextStylePalette textStylePalette) { + return new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:self.name") + .style(this.getTextStyleByName(textStylePalette, NORMAL_TEXT_STYLE_NAME)) + .build(); + } + + private TreeItemLabelElementDescription getAttributeKeyFragment(TextStylePalette textStylePalette) { + return new TreeBuilders().newTreeItemLabelFragmentDescription() + .labelExpression("aql:'[Attribute] '") + .style(this.getTextStyleByName(textStylePalette, BLUE_ITALIC_TEXT_STYLE_NAME)) + .build(); + } + + private TextStyleDescription getBlueItalicStyle() { + return new ViewBuilders().newTextStyleDescription() + .name(BLUE_ITALIC_TEXT_STYLE_NAME) + .foregroundColorExpression("aql:'#6584e2'") + .isItalicExpression(AQL_TRUE) + .build(); + } + + private TextStyleDescription getBrownBoldStyle() { + return new ViewBuilders().newTextStyleDescription() + .name(BROWN_BOLD_TEXT_STYLE_NAME) + .foregroundColorExpression("aql:'#c29e00'") + .isBoldExpression(AQL_TRUE) + .build(); + } + + private TextStyleDescription getNormalStyle() { + return new ViewBuilders().newTextStyleDescription() + .name(NORMAL_TEXT_STYLE_NAME) + .build(); + } + + private TextStyleDescription getTextStyleByName(TextStylePalette textStylePalette, String styleName) { + return textStylePalette.getStyles().stream() + .filter(tsd -> tsd.getName().equals(styleName)) + .findFirst() + .orElse(null); + } } diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java index e3ed17f7976..baa44e3d5b0 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/trees/DomainExplorerControllerTests.java @@ -150,7 +150,7 @@ public void givenAnExplorerRepresentationWhenWeSubscribeToItsEventThenTheReprese assertThat(tree.getChildren().get(1).getChildren()).hasSize(1); assertThat(tree.getChildren().get(1).getChildren().get(0).getLabel().toString()).isEqualTo("buck"); assertThat(tree.getChildren().get(1).getChildren().get(0).getChildren()).hasSize(3); - assertThat(tree.getChildren().get(1).getChildren().get(0).getChildren().get(2).getLabel().toString()).isEqualTo("Human"); + assertThat(tree.getChildren().get(1).getChildren().get(0).getChildren().get(2).getLabel().toString()).isEqualTo("[Entity] Human"); assertThat(tree.getChildren().get(1).getChildren().get(0).getChildren().get(2).getChildren()).hasSize(4); assertThat(tree.getChildren().get(1).getChildren().get(0).getChildren().get(2).getChildren().get(0).getLabel().toString()).isEqualTo("superTypes"); settingId.set(tree.getChildren().get(1).getChildren().get(0).getChildren().get(2).getChildren().get(0).getId()); diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/views/ViewControllerIntegrationTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/views/ViewControllerIntegrationTests.java new file mode 100644 index 00000000000..3286746898b --- /dev/null +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/views/ViewControllerIntegrationTests.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.web.application.controllers.views; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.jayway.jsonpath.JsonPath; + +import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; + +import org.eclipse.sirius.components.collaborative.dto.CreateChildInput; +import org.eclipse.sirius.components.collaborative.dto.CreateChildSuccessPayload; +import org.eclipse.sirius.web.AbstractIntegrationTests; +import org.eclipse.sirius.web.data.StudioIdentifiers; +import org.eclipse.sirius.web.tests.graphql.CreateChildMutationRunner; +import org.eclipse.sirius.web.tests.services.api.IGivenCommittedTransaction; +import org.eclipse.sirius.web.tests.services.api.IGivenInitialServerState; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.jdbc.SqlConfig; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests of View controllers. + * + * @author Jerome Gout + */ +@Transactional +@SuppressWarnings("checkstyle:MultipleStringLiterals") +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ViewControllerIntegrationTests extends AbstractIntegrationTests { + + @Autowired + private IGivenInitialServerState givenInitialServerState; + + @Autowired + private IGivenCommittedTransaction givenCommittedTransaction; + + @Autowired + private CreateChildMutationRunner createChildMutationRunner; + + @BeforeEach + public void beforeEach() { + this.givenInitialServerState.initialize(); + } + + @Test + @DisplayName("Given a view, when a text style palette is created, then it is created properly") + @Sql(scripts = {"/scripts/studio.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 givenAViewWhenATextStylePaletteIsCreatedThenItIsCreatedProperly() { + this.givenCommittedTransaction.commit(); + + var inputPalette = new CreateChildInput( + UUID.randomUUID(), + StudioIdentifiers.SAMPLE_STUDIO_PROJECT.toString(), + "c4591605-8ea8-4e92-bb17-05c4538248f8", + "textStylePalettes-TextStylePalette" + ); + var result = this.createChildMutationRunner.run(inputPalette); + + String typename = JsonPath.read(result, "$.data.createChild.__typename"); + assertThat(typename).isEqualTo(CreateChildSuccessPayload.class.getSimpleName()); + + var paletteId = new AtomicReference(); + + String objectId = JsonPath.read(result, "$.data.createChild.object.id"); + assertThat(objectId).isNotBlank(); + paletteId.set(objectId); + + String objectLabel = JsonPath.read(result, "$.data.createChild.object.label"); + assertThat(objectLabel).isNotBlank(); + + String objectKind = JsonPath.read(result, "$.data.createChild.object.kind"); + assertThat(objectKind).isEqualTo("siriusComponents://semantic?domain=view&entity=TextStylePalette"); + + var inputStyleDescription = new CreateChildInput( + UUID.randomUUID(), + StudioIdentifiers.SAMPLE_STUDIO_PROJECT.toString(), + paletteId.get(), + "styles-TextStyleDescription" + ); + result = this.createChildMutationRunner.run(inputStyleDescription); + + objectId = JsonPath.read(result, "$.data.createChild.object.id"); + assertThat(objectId).isNotBlank(); + + objectKind = JsonPath.read(result, "$.data.createChild.object.kind"); + assertThat(objectKind).isEqualTo("siriusComponents://semantic?domain=view&entity=TextStyleDescription"); + } + + +} diff --git a/packages/trees/backend/sirius-components-collaborative-trees/src/main/resources/schema/tree.graphqls b/packages/trees/backend/sirius-components-collaborative-trees/src/main/resources/schema/tree.graphqls index 5afbbf69ba3..292b9ada87d 100644 --- a/packages/trees/backend/sirius-components-collaborative-trees/src/main/resources/schema/tree.graphqls +++ b/packages/trees/backend/sirius-components-collaborative-trees/src/main/resources/schema/tree.graphqls @@ -64,6 +64,8 @@ type StyledStringFragmentStyle { strikeoutColor: String underlineColor: String borderColor: String + isBold: Boolean + isItalic: Boolean } enum UnderLineStyle { diff --git a/packages/trees/frontend/sirius-components-trees/src/views/__tests__/GraphqlTreeEventSubscription.test.ts b/packages/trees/frontend/sirius-components-trees/src/views/__tests__/GraphqlTreeEventSubscription.test.ts index 326cb8c904c..76713b3e779 100644 --- a/packages/trees/frontend/sirius-components-trees/src/views/__tests__/GraphqlTreeEventSubscription.test.ts +++ b/packages/trees/frontend/sirius-components-trees/src/views/__tests__/GraphqlTreeEventSubscription.test.ts @@ -53,6 +53,8 @@ const getDocumentSubscription = gql` strikeoutColor underlineColor borderColor + isBold + isItalic } } } diff --git a/packages/trees/frontend/sirius-components-trees/src/views/getTreeEventSubscription.ts b/packages/trees/frontend/sirius-components-trees/src/views/getTreeEventSubscription.ts index 402846c946d..4c9bfab8131 100644 --- a/packages/trees/frontend/sirius-components-trees/src/views/getTreeEventSubscription.ts +++ b/packages/trees/frontend/sirius-components-trees/src/views/getTreeEventSubscription.ts @@ -49,6 +49,8 @@ fragment treeItemFields on TreeItem { strikeoutColor underlineColor borderColor + isBold + isItalic } } } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java index 4edc33eab68..26a1a2b99e8 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeBuilders.java @@ -29,5 +29,25 @@ public TreeDescriptionBuilder newTreeDescription() { return new TreeDescriptionBuilder(); } + /** + * Instantiate a TreeItemLabelDescriptionBuilder . + * + * @author BuilderGenerator + * @generated + */ + public TreeItemLabelDescriptionBuilder newTreeItemLabelDescription() { + return new TreeItemLabelDescriptionBuilder(); + } + + /** + * Instantiate a TreeItemLabelFragmentDescriptionBuilder . + * + * @author BuilderGenerator + * @generated + */ + public TreeItemLabelFragmentDescriptionBuilder newTreeItemLabelFragmentDescription() { + return new TreeItemLabelFragmentDescriptionBuilder(); + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeDescriptionBuilder.java index d80a34fd98a..1de907a3974 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeDescriptionBuilder.java @@ -105,15 +105,6 @@ public TreeDescriptionBuilder treeItemIdExpression(java.lang.String value) { this.getTreeDescription().setTreeItemIdExpression(value); return this; } - /** - * Setter for TreeItemLabelExpression. - * - * @generated - */ - public TreeDescriptionBuilder treeItemLabelExpression(java.lang.String value) { - this.getTreeDescription().setTreeItemLabelExpression(value); - return this; - } /** * Setter for TreeItemObjectExpression. * @@ -187,5 +178,17 @@ public TreeDescriptionBuilder deletableExpression(java.lang.String value) { return this; } + /** + * Setter for TreeItemLabelDescriptions. + * + * @generated + */ + public TreeDescriptionBuilder treeItemLabelDescriptions(org.eclipse.sirius.components.view.tree.TreeItemLabelDescription ... values) { + for (org.eclipse.sirius.components.view.tree.TreeItemLabelDescription value : values) { + this.getTreeDescription().getTreeItemLabelDescriptions().add(value); + } + return this; + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelDescriptionBuilder.java new file mode 100644 index 00000000000..5958b767396 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelDescriptionBuilder.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2023, 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.tree; + +/** + * Builder for org.eclipse.sirius.components.view.tree.TreeItemLabelDescription. + * + * @author BuilderGenerator + * @generated + */ +public class TreeItemLabelDescriptionBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.tree.TreeItemLabelDescription. + * @generated + */ + private org.eclipse.sirius.components.view.tree.TreeItemLabelDescription treeItemLabelDescription = org.eclipse.sirius.components.view.tree.TreeFactory.eINSTANCE.createTreeItemLabelDescription(); + + /** + * Builder for org.eclipse.sirius.components.view.tree.TreeItemLabelDescription. + * @generated + */ + protected org.eclipse.sirius.components.view.tree.TreeItemLabelDescription getTreeItemLabelDescription() { + return this.treeItemLabelDescription; + } + + /** + * Return instance org.eclipse.sirius.components.view.tree.TreeItemLabelDescription. + * @generated + */ + public org.eclipse.sirius.components.view.tree.TreeItemLabelDescription build() { + return this.getTreeItemLabelDescription(); + } + + /** + * Setter for Name. + * + * @generated + */ + public TreeItemLabelDescriptionBuilder name(java.lang.String value) { + this.getTreeItemLabelDescription().setName(value); + return this; + } + + /** + * Setter for PreconditionExpression. + * + * @generated + */ + public TreeItemLabelDescriptionBuilder preconditionExpression(java.lang.String value) { + this.getTreeItemLabelDescription().setPreconditionExpression(value); + return this; + } + + /** + * Setter for Children. + * + * @generated + */ + public TreeItemLabelDescriptionBuilder children(org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription ... values) { + for (org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription value : values) { + this.getTreeItemLabelDescription().getChildren().add(value); + } + return this; + } + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelElementDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelElementDescriptionBuilder.java new file mode 100644 index 00000000000..94bb34e1dd4 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelElementDescriptionBuilder.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2023, 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.tree; + +/** + * Builder for org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription. + * + * @author BuilderGenerator + * @generated + */ +public abstract class TreeItemLabelElementDescriptionBuilder { + + /** + * Builder for org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription. + * @generated + */ + protected abstract org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription getTreeItemLabelElementDescription(); + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelFragmentDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelFragmentDescriptionBuilder.java new file mode 100644 index 00000000000..e2759071f04 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/tree/TreeItemLabelFragmentDescriptionBuilder.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2023, 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.tree; + +/** + * Builder for TreeItemLabelFragmentDescriptionBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class TreeItemLabelFragmentDescriptionBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription. + * @generated + */ + private org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription treeItemLabelFragmentDescription = org.eclipse.sirius.components.view.tree.TreeFactory.eINSTANCE.createTreeItemLabelFragmentDescription(); + + /** + * Return instance org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription. + * @generated + */ + protected org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription getTreeItemLabelFragmentDescription() { + return this.treeItemLabelFragmentDescription; + } + + /** + * Return instance org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription. + * @generated + */ + public org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription build() { + return this.getTreeItemLabelFragmentDescription(); + } + + /** + * Setter for LabelExpression. + * + * @generated + */ + public TreeItemLabelFragmentDescriptionBuilder labelExpression(java.lang.String value) { + this.getTreeItemLabelFragmentDescription().setLabelExpression(value); + return this; + } + + /** + * Setter for Style. + * + * @generated + */ + public TreeItemLabelFragmentDescriptionBuilder style(org.eclipse.sirius.components.view.TextStyleDescription value) { + this.getTreeItemLabelFragmentDescription().setStyle(value); + return this; + } + + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStyleDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStyleDescriptionBuilder.java new file mode 100644 index 00000000000..72feeb2cacf --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStyleDescriptionBuilder.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2023, 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.view; + +/** + * Builder for TextStyleDescriptionBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class TextStyleDescriptionBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.TextStyleDescription. + * @generated + */ + private org.eclipse.sirius.components.view.TextStyleDescription textStyleDescription = org.eclipse.sirius.components.view.ViewFactory.eINSTANCE.createTextStyleDescription(); + + /** + * Return instance org.eclipse.sirius.components.view.TextStyleDescription. + * @generated + */ + protected org.eclipse.sirius.components.view.TextStyleDescription getTextStyleDescription() { + return this.textStyleDescription; + } + + /** + * Return instance org.eclipse.sirius.components.view.TextStyleDescription. + * @generated + */ + public org.eclipse.sirius.components.view.TextStyleDescription build() { + return this.getTextStyleDescription(); + } + + /** + * Setter for Name. + * + * @generated + */ + public TextStyleDescriptionBuilder name(java.lang.String value) { + this.getTextStyleDescription().setName(value); + return this; + } + /** + * Setter for ForegroundColorExpression. + * + * @generated + */ + public TextStyleDescriptionBuilder foregroundColorExpression(java.lang.String value) { + this.getTextStyleDescription().setForegroundColorExpression(value); + return this; + } + /** + * Setter for BackgroundColorExpression. + * + * @generated + */ + public TextStyleDescriptionBuilder backgroundColorExpression(java.lang.String value) { + this.getTextStyleDescription().setBackgroundColorExpression(value); + return this; + } + /** + * Setter for IsBoldExpression. + * + * @generated + */ + public TextStyleDescriptionBuilder isBoldExpression(java.lang.String value) { + this.getTextStyleDescription().setIsBoldExpression(value); + return this; + } + /** + * Setter for IsItalicExpression. + * + * @generated + */ + public TextStyleDescriptionBuilder isItalicExpression(java.lang.String value) { + this.getTextStyleDescription().setIsItalicExpression(value); + return this; + } + /** + * Setter for IsUnderlineExpression. + * + * @generated + */ + public TextStyleDescriptionBuilder isUnderlineExpression(java.lang.String value) { + this.getTextStyleDescription().setIsUnderlineExpression(value); + return this; + } + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStylePaletteBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStylePaletteBuilder.java new file mode 100644 index 00000000000..75f691b9799 --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/TextStylePaletteBuilder.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2023, 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.builder.generated.view; + +/** + * Builder for TextStylePaletteBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class TextStylePaletteBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.TextStylePalette. + * @generated + */ + private org.eclipse.sirius.components.view.TextStylePalette textStylePalette = org.eclipse.sirius.components.view.ViewFactory.eINSTANCE.createTextStylePalette(); + + /** + * Return instance org.eclipse.sirius.components.view.TextStylePalette. + * @generated + */ + protected org.eclipse.sirius.components.view.TextStylePalette getTextStylePalette() { + return this.textStylePalette; + } + + /** + * Return instance org.eclipse.sirius.components.view.TextStylePalette. + * @generated + */ + public org.eclipse.sirius.components.view.TextStylePalette build() { + return this.getTextStylePalette(); + } + + /** + * Setter for Name. + * + * @generated + */ + public TextStylePaletteBuilder name(java.lang.String value) { + this.getTextStylePalette().setName(value); + return this; + } + /** + * Setter for Styles. + * + * @generated + */ + public TextStylePaletteBuilder styles(org.eclipse.sirius.components.view.TextStyleDescription ... values) { + for (org.eclipse.sirius.components.view.TextStyleDescription value : values) { + this.getTextStylePalette().getStyles().add(value); + } + return this; + } + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilder.java index 97d0840c64c..517b991c5e1 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilder.java @@ -66,6 +66,18 @@ public ViewBuilder colorPalettes(org.eclipse.sirius.components.view.ColorPalette return this; } + /** + * Setter for TextStylePalettes. + * + * @generated + */ + public ViewBuilder textStylePalettes(org.eclipse.sirius.components.view.TextStylePalette ... values) { + for (org.eclipse.sirius.components.view.TextStylePalette value : values) { + this.getView().getTextStylePalettes().add(value); + } + return this; + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilders.java index d0514dc4d1d..c3f96208e7d 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/view/ViewBuilders.java @@ -129,5 +129,25 @@ public ForBuilder newFor() { return new ForBuilder(); } + /** + * Instantiate a TextStylePaletteBuilder . + * + * @author BuilderGenerator + * @generated + */ + public TextStylePaletteBuilder newTextStylePalette() { + return new TextStylePaletteBuilder(); + } + + /** + * Instantiate a TextStyleDescriptionBuilder . + * + * @author BuilderGenerator + * @generated + */ + public TextStyleDescriptionBuilder newTextStyleDescription() { + return new TextStyleDescriptionBuilder(); + } + } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStyleDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStyleDescriptionItemProvider.java new file mode 100644 index 00000000000..c8cba68b6de --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStyleDescriptionItemProvider.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.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.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.TextStyleDescription; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.TextStyleDescription} object. + * + * @generated + */ +public class TextStyleDescriptionItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public TextStyleDescriptionItemProvider(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.addForegroundColorExpressionPropertyDescriptor(object); + this.addBackgroundColorExpressionPropertyDescriptor(object); + this.addIsBoldExpressionPropertyDescriptor(object); + this.addIsItalicExpressionPropertyDescriptor(object); + this.addIsUnderlineExpressionPropertyDescriptor(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_TextStyleDescription_name_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_name_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Foreground Color Expression feature. + * + * @generated + */ + protected void addForegroundColorExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TextStyleDescription_foregroundColorExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_foregroundColorExpression_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Background Color Expression feature. + * + * @generated + */ + protected void addBackgroundColorExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TextStyleDescription_backgroundColorExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_backgroundColorExpression_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Is Bold Expression feature. + * + * @generated + */ + protected void addIsBoldExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TextStyleDescription_isBoldExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_isBoldExpression_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Is Italic Expression feature. + * + * @generated + */ + protected void addIsItalicExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TextStyleDescription_isItalicExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_isItalicExpression_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Is Underline Expression feature. + * + * @generated + */ + protected void addIsUnderlineExpressionPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_TextStyleDescription_isUnderlineExpression_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_TextStyleDescription_isUnderlineExpression_feature", "_UI_TextStyleDescription_type"), + ViewPackage.Literals.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This returns TextStyleDescription.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/TextStyleDescription.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 = ((TextStyleDescription) object).getName(); + return label == null || label.length() == 0 ? this.getString("_UI_TextStyleDescription_type") : this.getString("_UI_TextStyleDescription_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(TextStyleDescription.class)) { + case ViewPackage.TEXT_STYLE_DESCRIPTION__NAME: + case ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION: + case ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION: + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION: + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION: + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + 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); + } + + /** + * 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-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStylePaletteItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStylePaletteItemProvider.java new file mode 100644 index 00000000000..07a85e26ade --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/TextStylePaletteItemProvider.java @@ -0,0 +1,186 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.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.TextStylePalette; +import org.eclipse.sirius.components.view.ViewFactory; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.TextStylePalette} object. + * + * @generated + */ +public class TextStylePaletteItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public TextStylePaletteItemProvider(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); + } + 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_TextStylePalette_name_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_TextStylePalette_name_feature", "_UI_TextStylePalette_type"), + ViewPackage.Literals.TEXT_STYLE_PALETTE__NAME, 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(ViewPackage.Literals.TEXT_STYLE_PALETTE__STYLES); + } + 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 TextStylePalette.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/TextStylePalette.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 = ((TextStylePalette) object).getName(); + return label == null || label.length() == 0 ? this.getString("_UI_TextStylePalette_type") : this.getString("_UI_TextStylePalette_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(TextStylePalette.class)) { + case ViewPackage.TEXT_STYLE_PALETTE__NAME: + this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + 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(ViewPackage.Literals.TEXT_STYLE_PALETTE__STYLES, ViewFactory.eINSTANCE.createTextStyleDescription())); + } + + /** + * 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-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProvider.java index 59385c59bd6..58d36789d93 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProvider.java @@ -29,6 +29,7 @@ import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.sirius.components.view.ColorPalette; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.View; import org.eclipse.sirius.components.view.ViewFactory; import org.eclipse.sirius.components.view.ViewPackage; @@ -77,6 +78,7 @@ public Collection getChildrenFeatures(Object objec super.getChildrenFeatures(object); this.childrenFeatures.add(ViewPackage.Literals.VIEW__DESCRIPTIONS); this.childrenFeatures.add(ViewPackage.Literals.VIEW__COLOR_PALETTES); + this.childrenFeatures.add(ViewPackage.Literals.VIEW__TEXT_STYLE_PALETTES); } return this.childrenFeatures; } @@ -138,6 +140,7 @@ public void notifyChanged(Notification notification) { switch (notification.getFeatureID(View.class)) { case ViewPackage.VIEW__DESCRIPTIONS: case ViewPackage.VIEW__COLOR_PALETTES: + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -157,7 +160,9 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors ColorPalette newColorPalette = ViewFactory.eINSTANCE.createColorPalette(); newColorPalette.setName("New Color Palette"); newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.VIEW__COLOR_PALETTES, newColorPalette)); - + TextStylePalette newTextStylePalette = ViewFactory.eINSTANCE.createTextStylePalette(); + newTextStylePalette.setName("New Text Style Palette"); + newChildDescriptors.add(this.createChildParameter(ViewPackage.Literals.VIEW__TEXT_STYLE_PALETTES, newTextStylePalette)); } /** diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java index 46612c840f7..b45e1c0e959 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ViewItemProviderAdapterFactory.java @@ -343,6 +343,52 @@ public Adapter createForAdapter() { return this.forItemProvider; } + /** + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.TextStylePalette} + * instances. + * + * @generated + */ + protected TextStylePaletteItemProvider textStylePaletteItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.TextStylePalette}. + * + * @generated + */ + @Override + public Adapter createTextStylePaletteAdapter() { + if (this.textStylePaletteItemProvider == null) { + this.textStylePaletteItemProvider = new TextStylePaletteItemProvider(this); + } + + return this.textStylePaletteItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.sirius.components.view.TextStyleDescription} + * instances. + * + * @generated + */ + protected TextStyleDescriptionItemProvider textStyleDescriptionItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.TextStyleDescription}. + * + * @generated + */ + @Override + public Adapter createTextStyleDescriptionAdapter() { + if (this.textStyleDescriptionItemProvider == null) { + this.textStyleDescriptionItemProvider = new TextStyleDescriptionItemProvider(this); + } + + return this.textStyleDescriptionItemProvider; + } + /** * This returns the root adapter factory that contains this factory. * @@ -494,6 +540,10 @@ public void dispose() { this.ifItemProvider.dispose(); if (this.forItemProvider != null) this.forItemProvider.dispose(); + if (this.textStylePaletteItemProvider != null) + this.textStylePaletteItemProvider.dispose(); + if (this.textStyleDescriptionItemProvider != null) + this.textStyleDescriptionItemProvider.dispose(); } } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStyleDescription.svg b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStyleDescription.svg new file mode 100644 index 00000000000..c057cbe2597 --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStyleDescription.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStylePalette.svg b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStylePalette.svg new file mode 100644 index 00000000000..2093d814b99 --- /dev/null +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/icons/full/obj16/TextStylePalette.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties index 06b6e40308d..55c063d9e08 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-edit/src/main/resources/plugin.properties @@ -1,4 +1,4 @@ -# Copyright (c) 2021, 2023 Obeo. +# Copyright (c) 2021, 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 @@ -7,7 +7,7 @@ # SPDX-License-Identifier: EPL-2.0 # # Contributors: -# Obeo - initial API and implementation +# Obeo - initial API and implementation pluginName = View Edit Support providerName = www.example.org @@ -37,12 +37,15 @@ _UI_Let_type = Let _UI_If_type = If _UI_Conditional_type = Conditional _UI_For_type = For +_UI_TextStylePalette_type = Text Style Palette +_UI_TextStyleDescription_type = Text Style Description _UI_Unknown_type = Object _UI_Unknown_datatype= Value _UI_View_descriptions_feature = Descriptions _UI_View_colorPalettes_feature = Color Palettes +_UI_View_textStylePalettes_feature = Text Style Palettes _UI_ColorPalette_name_feature = Name _UI_ColorPalette_colors_feature = Colors _UI_FixedColor_value_feature = Value @@ -71,5 +74,13 @@ _UI_If_conditionExpression_feature = Condition Expression _UI_Conditional_condition_feature = Condition _UI_For_expression_feature = Expression _UI_For_iteratorName_feature = Iterator Name +_UI_TextStylePalette_name_feature = Name +_UI_TextStylePalette_styles_feature = Styles +_UI_TextStyleDescription_name_feature = Name +_UI_TextStyleDescription_foregroundColorExpression_feature = Foreground Color Expression +_UI_TextStyleDescription_backgroundColorExpression_feature = Background Color Expression +_UI_TextStyleDescription_isBoldExpression_feature = Is Bold Expression +_UI_TextStyleDescription_isItalicExpression_feature = Is Italic Expression +_UI_TextStyleDescription_isUnderlineExpression_feature = Is Underline Expression _UI_Unknown_feature = Unspecified diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java new file mode 100644 index 00000000000..083a388228e --- /dev/null +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/TreeItemStyleConverter.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.emf.tree; + +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +import org.eclipse.sirius.components.core.api.labels.StyledString; +import org.eclipse.sirius.components.core.api.labels.StyledStringFragment; +import org.eclipse.sirius.components.core.api.labels.StyledStringFragmentStyle; +import org.eclipse.sirius.components.core.api.labels.UnderLineStyle; +import org.eclipse.sirius.components.interpreter.AQLInterpreter; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; + +/** + * Used to convert view tree DSL tree item styles in Sirius label styles {@link StyledString}. + * + * @author Jerome Gout + */ +public class TreeItemStyleConverter { + + private final AQLInterpreter interpreter; + + private final Map variables; + + public TreeItemStyleConverter(AQLInterpreter interpreter, Map variables) { + this.interpreter = Objects.requireNonNull(interpreter); + this.variables = Objects.requireNonNull(variables); + } + + public StyledString convert(TreeItemLabelDescription tild) { + var fragments = tild.getChildren().stream() + .map(this::convertElement) + .filter(Objects::nonNull) + .toList(); + return new StyledString(fragments); + } + + private StyledStringFragment convertElement(TreeItemLabelElementDescription element) { + if (element instanceof TreeItemLabelFragmentDescription fragment) { + return this.convertFragment(fragment); + } + return null; + } + + private StyledStringFragment convertFragment(TreeItemLabelFragmentDescription fragment) { + var text = this.evaluateString(fragment.getLabelExpression()).orElse(""); + var style = fragment.getStyle(); + var styleBuilder = StyledStringFragmentStyle.newDefaultStyledStringFragmentStyle(); + + if (style != null) { + String backgroundColor = this.evaluateString(style.getBackgroundColorExpression()).orElse(""); + String foregroundColor = this.evaluateString(style.getForegroundColorExpression()).orElse(""); + boolean isUnderline = this.evaluateBoolean(style.getIsUnderlineExpression()).orElse(false); + boolean isBold = this.evaluateBoolean(style.getIsBoldExpression()).orElse(false); + boolean isItalic = this.evaluateBoolean(style.getIsItalicExpression()).orElse(false); + UnderLineStyle underLineStyle = UnderLineStyle.NONE; + if (isUnderline) { + underLineStyle = UnderLineStyle.SOLID; + } + styleBuilder + .backgroundColor(backgroundColor) + .foregroundColor(foregroundColor) + .struckOut(false) + .underlineStyle(underLineStyle) + .bold(isBold) + .italic(isItalic); + } + return new StyledStringFragment(text, styleBuilder.build()); + } + + private Optional evaluateString(String expression) { + return this.interpreter.evaluateExpression(this.variables, expression).asString(); + } + + private Optional evaluateBoolean(String expression) { + if (expression == null) { + return Optional.empty(); + } else { + return this.interpreter.evaluateExpression(this.variables, expression) + .asBoolean(); + } + } +} diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/ViewTreeDescriptionConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/ViewTreeDescriptionConverter.java index 497305af266..a6b2e7b6e1d 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/ViewTreeDescriptionConverter.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/tree/ViewTreeDescriptionConverter.java @@ -81,7 +81,7 @@ public IRepresentationDescription convert(RepresentationDescription representati .targetObjectIdProvider(variableManager -> variableManager.get(IEditingContext.EDITING_CONTEXT, IEditingContext.class).map(IEditingContext::getId).orElse(null)) .treeItemIdProvider(variableManager -> this.evaluateString(interpreter, variableManager, viewTreeDescription.getTreeItemIdExpression())) .treeItemObjectProvider(variableManager -> this.evaluateObject(interpreter, variableManager, viewTreeDescription.getTreeItemObjectExpression())) - .treeItemLabelProvider(variableManager -> StyledString.of(this.evaluateString(interpreter, variableManager, viewTreeDescription.getTreeItemLabelExpression()))) + .treeItemLabelProvider(variableManager -> this.getTreeItemLabel(interpreter, variableManager, viewTreeDescription)) .iconURLProvider(variableManager -> this.evaluateStringList(interpreter, variableManager, viewTreeDescription.getIconURLExpression())) .editableProvider(variableManager -> this.evaluateBoolean(interpreter, variableManager, viewTreeDescription.getEditableExpression())) .deletableProvider(variableManager -> this.evaluateBoolean(interpreter, variableManager, viewTreeDescription.getDeletableExpression())) @@ -208,4 +208,16 @@ private IStatus getRenameHandler(VariableManager variableManager, String newLabe } return new Failure(""); } + + private StyledString getTreeItemLabel(AQLInterpreter interpreter, VariableManager variableManager, org.eclipse.sirius.components.view.tree.TreeDescription viewTreeDescription) { + TreeItemStyleConverter styleConverter = new TreeItemStyleConverter(interpreter, variableManager.getVariables()); + StyledString result = StyledString.of(""); + var optionalTreeItemLabelDescription = viewTreeDescription.getTreeItemLabelDescriptions().stream() + .filter(tild -> this.evaluateBoolean(interpreter, variableManager, tild.getPreconditionExpression())) + .findFirst(); + if (optionalTreeItemLabelDescription.isPresent()) { + result = styleConverter.convert(optionalTreeItemLabelDescription.get()); + } + return result; + } } diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeDescriptionItemProvider.java index c3d53022f1a..9440e032455 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeDescriptionItemProvider.java @@ -57,7 +57,6 @@ public List getPropertyDescriptors(Object object) { addKindExpressionPropertyDescriptor(object); addIconURLExpressionPropertyDescriptor(object); addTreeItemIdExpressionPropertyDescriptor(object); - addTreeItemLabelExpressionPropertyDescriptor(object); addTreeItemObjectExpressionPropertyDescriptor(object); addElementsExpressionPropertyDescriptor(object); addHasChildrenExpressionPropertyDescriptor(object); @@ -66,6 +65,7 @@ public List getPropertyDescriptors(Object object) { addEditableExpressionPropertyDescriptor(object); addSelectableExpressionPropertyDescriptor(object); addDeletableExpressionPropertyDescriptor(object); + addTreeItemLabelDescriptionsPropertyDescriptor(object); } return itemPropertyDescriptors; } @@ -118,22 +118,6 @@ protected void addTreeItemIdExpressionPropertyDescriptor(Object object) { ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } - /** - * This adds a property descriptor for the Tree Item Label Expression feature. - * - * - * @generated - */ - protected void addTreeItemLabelExpressionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor( - ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), - getString("_UI_TreeDescription_treeItemLabelExpression_feature"), - getString("_UI_PropertyDescriptor_description", "_UI_TreeDescription_treeItemLabelExpression_feature", - "_UI_TreeDescription_type"), - TreePackage.Literals.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION, true, false, false, - ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - /** * This adds a property descriptor for the Tree Item Object Expression feature. * @@ -262,6 +246,22 @@ protected void addDeletableExpressionPropertyDescriptor(Object object) { ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Tree Item Label Descriptions feature. + * + * + * @generated + */ + protected void addTreeItemLabelDescriptionsPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_TreeDescription_treeItemLabelDescriptions_feature"), + getString("_UI_PropertyDescriptor_description", + "_UI_TreeDescription_treeItemLabelDescriptions_feature", "_UI_TreeDescription_type"), + TreePackage.Literals.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS, true, false, true, null, + null, null)); + } + /** * This returns TreeDescription.gif. @@ -311,7 +311,6 @@ public void notifyChanged(Notification notification) { case TreePackage.TREE_DESCRIPTION__KIND_EXPRESSION: case TreePackage.TREE_DESCRIPTION__ICON_URL_EXPRESSION: case TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION: - case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION: case TreePackage.TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION: case TreePackage.TREE_DESCRIPTION__ELEMENTS_EXPRESSION: case TreePackage.TREE_DESCRIPTION__HAS_CHILDREN_EXPRESSION: diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java new file mode 100644 index 00000000000..028da457e82 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelDescriptionItemProvider.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.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.tree.TreeFactory; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription} + * object. + * + * @generated + */ +public class TreeItemLabelDescriptionItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, + IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public TreeItemLabelDescriptionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addPreconditionExpressionPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_TreeItemLabelDescription_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_TreeItemLabelDescription_name_feature", + "_UI_TreeItemLabelDescription_type"), + TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__NAME, 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) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_TreeItemLabelDescription_preconditionExpression_feature"), + getString("_UI_PropertyDescriptor_description", + "_UI_TreeItemLabelDescription_preconditionExpression_feature", + "_UI_TreeItemLabelDescription_type"), + TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__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 (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN); + } + return 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); + } + + /** + * + * + * @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 = ((TreeItemLabelDescription) object).getName(); + return label == null || label.length() == 0 ? getString("_UI_TreeItemLabelDescription_type") + : getString("_UI_TreeItemLabelDescription_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) { + updateChildren(notification); + + switch (notification.getFeatureID(TreeItemLabelDescription.class)) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME: + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + 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(createChildParameter(TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN, + TreeFactory.eINSTANCE.createTreeItemLabelFragmentDescription())); + } + + /** + * Return the resource locator for this item provider's resources. + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelElementDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelElementDescriptionItemProvider.java new file mode 100644 index 00000000000..f05ad8054dd --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelElementDescriptionItemProvider.java @@ -0,0 +1,122 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +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.ItemProviderAdapter; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription} + * object. + * + * @generated + */ +public class TreeItemLabelElementDescriptionItemProvider extends ItemProviderAdapter + implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, + IItemLabelProvider, IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public TreeItemLabelElementDescriptionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_TreeItemLabelElementDescription_type"); + } + + /** + * 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) { + updateChildren(notification); + 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); + } + + /** + * Return the resource locator for this item provider's resources. + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ((IChildCreationExtender) adapterFactory).getResourceLocator(); + } + +} diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelFragmentDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelFragmentDescriptionItemProvider.java new file mode 100644 index 00000000000..fa2830ccc53 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemLabelFragmentDescriptionItemProvider.java @@ -0,0 +1,159 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * This is the item provider adapter for a + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription} + * object. + * + * @generated + */ +public class TreeItemLabelFragmentDescriptionItemProvider extends TreeItemLabelElementDescriptionItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public TreeItemLabelFragmentDescriptionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addLabelExpressionPropertyDescriptor(object); + addStylePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Label Expression feature. + * + * @generated + */ + protected void addLabelExpressionPropertyDescriptor(Object object) { + itemPropertyDescriptors + .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), getString("_UI_TreeItemLabelFragmentDescription_labelExpression_feature"), + getString("_UI_PropertyDescriptor_description", + "_UI_TreeItemLabelFragmentDescription_labelExpression_feature", + "_UI_TreeItemLabelFragmentDescription_type"), + TreePackage.Literals.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION, true, false, false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** + * This adds a property descriptor for the Style feature. + * + * @generated + */ + protected void addStylePropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor( + ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), + getString("_UI_TreeItemLabelFragmentDescription_style_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_TreeItemLabelFragmentDescription_style_feature", + "_UI_TreeItemLabelFragmentDescription_type"), + TreePackage.Literals.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE, true, false, true, null, null, null)); + } + + /** + * This returns TreeItemLabelFragmentDescription.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/TreeItemLabelFragmentDescription")); + } + + /** + * + * + * @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 = ((TreeItemLabelFragmentDescription) object).getLabelExpression(); + return label == null || label.length() == 0 ? getString("_UI_TreeItemLabelFragmentDescription_type") + : getString("_UI_TreeItemLabelFragmentDescription_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) { + updateChildren(notification); + + switch (notification.getFeatureID(TreeItemLabelFragmentDescription.class)) { + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + 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); + } + +} diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java index 887f595cb6a..c69ed6a2d62 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/java/org/eclipse/sirius/components/view/tree/provider/TreeItemProviderAdapterFactory.java @@ -128,6 +128,56 @@ public Adapter createTreeDescriptionAdapter() { return treeDescriptionItemProvider; } + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription} + * instances. + * + * @generated + */ + protected TreeItemLabelDescriptionItemProvider treeItemLabelDescriptionItemProvider; + + /** + * This creates an adapter for a + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription}. + * + * + * @generated + */ + @Override + public Adapter createTreeItemLabelDescriptionAdapter() { + if (treeItemLabelDescriptionItemProvider == null) { + treeItemLabelDescriptionItemProvider = new TreeItemLabelDescriptionItemProvider(this); + } + + return treeItemLabelDescriptionItemProvider; + } + + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription} + * instances. + * + * @generated + */ + protected TreeItemLabelFragmentDescriptionItemProvider treeItemLabelFragmentDescriptionItemProvider; + + /** + * This creates an adapter for a + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription}. + * + * + * @generated + */ + @Override + public Adapter createTreeItemLabelFragmentDescriptionAdapter() { + if (treeItemLabelFragmentDescriptionItemProvider == null) { + treeItemLabelFragmentDescriptionItemProvider = new TreeItemLabelFragmentDescriptionItemProvider(this); + } + + return treeItemLabelFragmentDescriptionItemProvider; + } + /** * This returns the root adapter factory that contains this factory. @@ -263,6 +313,12 @@ public void dispose() { if (treeDescriptionItemProvider != null) { treeDescriptionItemProvider.dispose(); } + if (treeItemLabelDescriptionItemProvider != null) { + treeItemLabelDescriptionItemProvider.dispose(); + } + if (treeItemLabelFragmentDescriptionItemProvider != null) { + treeItemLabelFragmentDescriptionItemProvider.dispose(); + } } /** diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/TreeItemLabelFragmentDescription.gif b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/icons/full/obj16/TreeItemLabelFragmentDescription.gif new file mode 100644 index 0000000000000000000000000000000000000000..338fb8d9a728b682e398849d2038959d01b4e0f2 GIT binary patch literal 129 zcmZ?wbhEHb6krfw*vtS14M4Jip`qcxfddT<4GjN*-2XuK|Nmgt|Np7Tg zFI845{$ycfVBloX0qF#p!N8(taME-2UW?aXzNzp(EOgy&%6cm$!E3?7uQqxgr>R{v WEALsU$*;SdvD59yL?K~D25SIvEHXv_ literal 0 HcmV?d00001 diff --git a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties index 2a08eedc8c1..24786438a55 100644 --- a/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-tree-edit/src/main/resources/plugin.properties @@ -22,6 +22,9 @@ _UI_CreateSibling_description = Create a new sibling of type {0} for the selecte _UI_PropertyDescriptor_description = The {0} of the {1} _UI_TreeDescription_type = Description +_UI_TreeItemLabelDescription_type = Item Label Description +_UI_TreeItemLabelFragmentDescription_type = Item Label Fragment Description +_UI_TreeItemLabelElementDescription_type = Item Label Element Description _UI_Unknown_type = Object _UI_Unknown_datatype= Value @@ -29,7 +32,6 @@ _UI_Unknown_datatype= Value _UI_TreeDescription_kindExpression_feature = Kind Expression _UI_TreeDescription_iconURLExpression_feature = Icon URL Expression _UI_TreeDescription_treeItemIdExpression_feature = Tree Item Id Expression -_UI_TreeDescription_treeItemLabelExpression_feature = Tree Item Label Expression _UI_TreeDescription_treeItemObjectExpression_feature = Tree Item Object Expression _UI_TreeDescription_elementsExpression_feature = Elements Expression _UI_TreeDescription_hasChildrenExpression_feature = Has Children Expression @@ -38,5 +40,11 @@ _UI_TreeDescription_parentExpression_feature = Parent Expression _UI_TreeDescription_editableExpression_feature = Editable Expression _UI_TreeDescription_selectableExpression_feature = Selectable Expression _UI_TreeDescription_deletableExpression_feature = Deletable Expression +_UI_TreeDescription_treeItemLabelDescriptions_feature = Tree Item Label Descriptions +_UI_TreeItemLabelDescription_name_feature = Name +_UI_TreeItemLabelDescription_preconditionExpression_feature = Precondition Expression +_UI_TreeItemLabelDescription_children_feature = Children +_UI_TreeItemLabelFragmentDescription_labelExpression_feature = Label Expression +_UI_TreeItemLabelFragmentDescription_style_feature = Style _UI_Unknown_feature = Unspecified diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeDescription.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeDescription.java index 025340b1b55..9797ef88b4d 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeDescription.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeDescription.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.sirius.components.view.tree; +import org.eclipse.emf.common.util.EList; import org.eclipse.sirius.components.view.RepresentationDescription; /** @@ -26,8 +27,6 @@ * Expression} *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemIdExpression Tree Item Id * Expression}
  • - *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelExpression Tree Item Label - * Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemObjectExpression Tree Item Object * Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getElementsExpression Elements @@ -44,6 +43,8 @@ * Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getDeletableExpression Deletable * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelDescriptions Tree Item Label + * Descriptions}
  • * * * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeDescription() @@ -120,29 +121,6 @@ public interface TreeDescription extends RepresentationDescription { */ void setTreeItemIdExpression(String value); - /** - * Returns the value of the 'Tree Item Label Expression' attribute. - * - * @return the value of the 'Tree Item Label Expression' attribute. - * @see #setTreeItemLabelExpression(String) - * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeDescription_TreeItemLabelExpression() - * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" - * @generated - */ - String getTreeItemLabelExpression(); - - /** - * Sets the value of the '{@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelExpression - * Tree Item Label Expression}' attribute. - * - * @param value - * the new value of the 'Tree Item Label Expression' attribute. - * @see #getTreeItemLabelExpression() - * @generated - */ - void setTreeItemLabelExpression(String value); - /** * Returns the value of the 'Tree Item Object Expression' attribute. @@ -327,4 +305,16 @@ public interface TreeDescription extends RepresentationDescription { */ void setDeletableExpression(String value); + /** + * Returns the value of the 'Tree Item Label Descriptions' containment reference list. The list + * contents are of type {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription}. + * + * @return the value of the 'Tree Item Label Descriptions' containment reference list. + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeDescription_TreeItemLabelDescriptions() + * @model containment="true" + * @generated + */ + EList getTreeItemLabelDescriptions(); + } // TreeDescription diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java index 3906f46a2a2..a87637dc20d 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeFactory.java @@ -37,6 +37,23 @@ public interface TreeFactory extends EFactory { */ TreeDescription createTreeDescription(); + /** + * Returns a new object of class 'Item Label Description'. + * + * @return a new object of class 'Item Label Description'. + * @generated + */ + TreeItemLabelDescription createTreeItemLabelDescription(); + + /** + * Returns a new object of class 'Item Label Fragment Description'. + * + * @return a new object of class 'Item Label Fragment Description'. + * @generated + */ + TreeItemLabelFragmentDescription createTreeItemLabelFragmentDescription(); + /** * Returns the package supported by this factory. * diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelDescription.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelDescription.java new file mode 100644 index 00000000000..d0c2735d92c --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelDescription.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * A representation of the model object 'Item Label Description'. + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getPreconditionExpression + * Precondition Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getChildren Children}
    • + *
    + * + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeItemLabelDescription() + * @model + * @generated + */ +public interface TreeItemLabelDescription 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.tree.TreePackage#getTreeItemLabelDescription_Name() + * @model dataType="org.eclipse.sirius.components.view.Identifier" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getName + * Name}' attribute. + * + * @param value + * the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(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.tree.TreePackage#getTreeItemLabelDescription_PreconditionExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getPreconditionExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#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 'Children' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription}. + * + * @return the value of the 'Children' containment reference list. + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeItemLabelDescription_Children() + * @model containment="true" required="true" + * @generated + */ + EList getChildren(); +} // TreeItemLabelDescription diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelElementDescription.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelElementDescription.java new file mode 100644 index 00000000000..1b58d23f06e --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelElementDescription.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree; + +import org.eclipse.emf.ecore.EObject; + +/** + * A representation of the model object 'Item Label Element Description'. + * + * + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeItemLabelElementDescription() + * @model abstract="true" + * @generated + */ +public interface TreeItemLabelElementDescription extends EObject { +} // TreeItemLabelElementDescription diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelFragmentDescription.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelFragmentDescription.java new file mode 100644 index 00000000000..3f64b0a12ed --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreeItemLabelFragmentDescription.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree; + +import org.eclipse.sirius.components.view.TextStyleDescription; + +/** + * A representation of the model object 'Item Label Fragment Description'. + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getLabelExpression Label + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getStyle Style}
    • + *
    + * + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeItemLabelFragmentDescription() + * @model + * @generated + */ +public interface TreeItemLabelFragmentDescription extends TreeItemLabelElementDescription { + /** + * 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.tree.TreePackage#getTreeItemLabelFragmentDescription_LabelExpression() + * @model dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getLabelExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#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 'Style' reference. + * + * @return the value of the 'Style' reference. + * @see #setStyle(TextStyleDescription) + * @see org.eclipse.sirius.components.view.tree.TreePackage#getTreeItemLabelFragmentDescription_Style() + * @model + * @generated + */ + TextStyleDescription getStyle(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getStyle + * Style}' reference. + * + * @param value + * the new value of the 'Style' reference. + * @see #getStyle() + * @generated + */ + void setStyle(TextStyleDescription value); + +} // TreeItemLabelFragmentDescription diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java index a90114b6ea4..f46f4e2f146 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/TreePackage.java @@ -15,6 +15,7 @@ import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; import org.eclipse.sirius.components.view.ViewPackage; /** @@ -131,15 +132,6 @@ public interface TreePackage extends EPackage { */ int TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 2; - /** - * The feature id for the 'Tree Item Label Expression' attribute. - * - * @generated - * @ordered - */ - int TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 3; - /** * The feature id for the 'Tree Item Object Expression' attribute. @@ -147,7 +139,7 @@ public interface TreePackage extends EPackage { * @generated * @ordered */ - int TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 4; + int TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 3; /** * The feature id for the 'Elements Expression' attribute. + * + * @generated + * @ordered + */ + int TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 11; /** * The number of structural features of the 'Description' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelDescription() + * @generated + */ + int TREE_ITEM_LABEL_DESCRIPTION = 1; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_DESCRIPTION__NAME = 0; + + /** + * The feature id for the 'Precondition Expression' attribute. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION = 1; + + /** + * The feature id for the 'Children' containment reference list. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_DESCRIPTION__CHILDREN = 2; + + /** + * The number of structural features of the 'Item Label Description' class. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_DESCRIPTION_FEATURE_COUNT = 3; + + /** + * The number of operations of the 'Item Label Description' class. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_DESCRIPTION_OPERATION_COUNT = 0; + + /** + * The meta object id for the + * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelElementDescriptionImpl Item Label Element + * Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelElementDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelElementDescription() + * @generated + */ + int TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = 3; + + /** + * The number of structural features of the 'Item Label Element Description' class. + * + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT = 0; + + /** + * The number of operations of the 'Item Label Element Description' class. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT = 0; + + /** + * The meta object id for the + * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl Item Label Fragment + * Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelFragmentDescription() + * @generated + */ + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION = 2; + + /** + * The feature id for the 'Label Expression' attribute. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Style' reference. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Item Label Fragment Description' class. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION_FEATURE_COUNT = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'Item Label Fragment Description' class. + * + * @generated + * @ordered + */ + int TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION_OPERATION_COUNT = TREE_ITEM_LABEL_ELEMENT_DESCRIPTION_OPERATION_COUNT + 0; + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.tree.TreeDescription * Description}'. @@ -275,18 +405,6 @@ public interface TreePackage extends EPackage { */ EAttribute getTreeDescription_TreeItemIdExpression(); - /** - * Returns the meta object for the attribute - * '{@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelExpression Tree Item Label - * Expression}'. - * - * @return the meta object for the attribute 'Tree Item Label Expression'. - * @see org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelExpression() - * @see #getTreeDescription() - * @generated - */ - EAttribute getTreeDescription_TreeItemLabelExpression(); - /** * Returns the meta object for the attribute * '{@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemObjectExpression Tree Item Object @@ -383,6 +501,109 @@ public interface TreePackage extends EPackage { */ EAttribute getTreeDescription_DeletableExpression(); + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelDescriptions Tree Item Label + * Descriptions}'. + * + * @return the meta object for the containment reference list 'Tree Item Label Descriptions'. + * @see org.eclipse.sirius.components.view.tree.TreeDescription#getTreeItemLabelDescriptions() + * @see #getTreeDescription() + * @generated + */ + EReference getTreeDescription_TreeItemLabelDescriptions(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription + * Item Label Description}'. + * + * @return the meta object for class 'Item Label Description'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelDescription + * @generated + */ + EClass getTreeItemLabelDescription(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getName Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getName() + * @see #getTreeItemLabelDescription() + * @generated + */ + EAttribute getTreeItemLabelDescription_Name(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getPreconditionExpression + * Precondition Expression}'. + * + * @return the meta object for the attribute 'Precondition Expression'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getPreconditionExpression() + * @see #getTreeItemLabelDescription() + * @generated + */ + EAttribute getTreeItemLabelDescription_PreconditionExpression(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getChildren Children}'. + * + * @return the meta object for the containment reference list 'Children'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelDescription#getChildren() + * @see #getTreeItemLabelDescription() + * @generated + */ + EReference getTreeItemLabelDescription_Children(); + + /** + * Returns the meta object for class + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription Item Label Fragment + * Description}'. + * + * @return the meta object for class 'Item Label Fragment Description'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription + * @generated + */ + EClass getTreeItemLabelFragmentDescription(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getLabelExpression Label + * Expression}'. + * + * @return the meta object for the attribute 'Label Expression'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getLabelExpression() + * @see #getTreeItemLabelFragmentDescription() + * @generated + */ + EAttribute getTreeItemLabelFragmentDescription_LabelExpression(); + + /** + * Returns the meta object for the reference + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getStyle Style}'. + * + * @return the meta object for the reference 'Style'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription#getStyle() + * @see #getTreeItemLabelFragmentDescription() + * @generated + */ + EReference getTreeItemLabelFragmentDescription_Style(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription + * Item Label Element Description}'. + * + * @return the meta object for class 'Item Label Element Description'. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription + * @generated + */ + EClass getTreeItemLabelElementDescription(); + /** * Returns the factory that creates the instances of the model. * @@ -439,14 +660,6 @@ interface Literals { */ EAttribute TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION = eINSTANCE.getTreeDescription_TreeItemIdExpression(); - /** - * The meta object literal for the 'Tree Item Label Expression' attribute feature. - * - * @generated - */ - EAttribute TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION = eINSTANCE.getTreeDescription_TreeItemLabelExpression(); - /** * The meta object literal for the 'Tree Item Object Expression' attribute feature. @@ -511,6 +724,87 @@ interface Literals { */ EAttribute TREE_DESCRIPTION__DELETABLE_EXPRESSION = eINSTANCE.getTreeDescription_DeletableExpression(); + /** + * The meta object literal for the 'Tree Item Label Descriptions' reference list feature. + * + * @generated + */ + EReference TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS = eINSTANCE.getTreeDescription_TreeItemLabelDescriptions(); + + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl Item Label + * Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelDescription() + * @generated + */ + EClass TREE_ITEM_LABEL_DESCRIPTION = eINSTANCE.getTreeItemLabelDescription(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute TREE_ITEM_LABEL_DESCRIPTION__NAME = eINSTANCE.getTreeItemLabelDescription_Name(); + + /** + * The meta object literal for the 'Precondition Expression' attribute feature. + * + * @generated + */ + EAttribute TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION = eINSTANCE.getTreeItemLabelDescription_PreconditionExpression(); + + /** + * The meta object literal for the 'Children' containment reference list feature. + * + * @generated + */ + EReference TREE_ITEM_LABEL_DESCRIPTION__CHILDREN = eINSTANCE.getTreeItemLabelDescription_Children(); + + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl Item Label + * Fragment Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelFragmentDescription() + * @generated + */ + EClass TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION = eINSTANCE.getTreeItemLabelFragmentDescription(); + + /** + * The meta object literal for the 'Label Expression' attribute feature. + * + * + * @generated + */ + EAttribute TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION = eINSTANCE.getTreeItemLabelFragmentDescription_LabelExpression(); + + /** + * The meta object literal for the 'Style' reference feature. + * + * @generated + */ + EReference TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE = eINSTANCE.getTreeItemLabelFragmentDescription_Style(); + + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelElementDescriptionImpl Item Label + * Element Description}' class. + * + * @see org.eclipse.sirius.components.view.tree.impl.TreeItemLabelElementDescriptionImpl + * @see org.eclipse.sirius.components.view.tree.impl.TreePackageImpl#getTreeItemLabelElementDescription() + * @generated + */ + EClass TREE_ITEM_LABEL_ELEMENT_DESCRIPTION = eINSTANCE.getTreeItemLabelElementDescription(); + } } // TreePackage diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeDescriptionImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeDescriptionImpl.java index 1adb695987a..62272685f58 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeDescriptionImpl.java @@ -12,11 +12,19 @@ *******************************************************************************/ package org.eclipse.sirius.components.view.tree.impl; +import java.util.Collection; + import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.components.view.impl.RepresentationDescriptionImpl; import org.eclipse.sirius.components.view.tree.TreeDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -31,8 +39,6 @@ * Expression} *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getTreeItemIdExpression Tree Item Id * Expression}
  • - *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getTreeItemLabelExpression Tree Item - * Label Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getTreeItemObjectExpression Tree Item * Object Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getElementsExpression Elements @@ -49,6 +55,8 @@ * Expression}
  • *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getDeletableExpression Deletable * Expression}
  • + *
  • {@link org.eclipse.sirius.components.view.tree.impl.TreeDescriptionImpl#getTreeItemLabelDescriptions Tree + * Item Label Descriptions}
  • * * * @generated @@ -114,26 +122,6 @@ public class TreeDescriptionImpl extends RepresentationDescriptionImpl implement */ protected String treeItemIdExpression = TREE_ITEM_ID_EXPRESSION_EDEFAULT; - /** - * The default value of the '{@link #getTreeItemLabelExpression() Tree Item Label Expression}' attribute. - * - * - * @see #getTreeItemLabelExpression() - * @generated - * @ordered - */ - protected static final String TREE_ITEM_LABEL_EXPRESSION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getTreeItemLabelExpression() Tree Item Label Expression}' attribute. - * - * - * @see #getTreeItemLabelExpression() - * @generated - * @ordered - */ - protected String treeItemLabelExpression = TREE_ITEM_LABEL_EXPRESSION_EDEFAULT; - /** * The default value of the '{@link #getTreeItemObjectExpression() Tree Item Object Expression}' attribute. * @@ -294,6 +282,16 @@ public class TreeDescriptionImpl extends RepresentationDescriptionImpl implement */ protected String deletableExpression = DELETABLE_EXPRESSION_EDEFAULT; + /** + * The cached value of the '{@link #getTreeItemLabelDescriptions() Tree Item Label Descriptions}' + * containment reference list. + * + * @see #getTreeItemLabelDescriptions() + * @generated + * @ordered + */ + protected EList treeItemLabelDescriptions; + /** * * @@ -382,29 +380,6 @@ public void setTreeItemIdExpression(String newTreeItemIdExpression) { this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION, oldTreeItemIdExpression, this.treeItemIdExpression)); } - /** - * - * - * @generated - */ - @Override - public String getTreeItemLabelExpression() { - return this.treeItemLabelExpression; - } - - /** - * - * - * @generated - */ - @Override - public void setTreeItemLabelExpression(String newTreeItemLabelExpression) { - String oldTreeItemLabelExpression = this.treeItemLabelExpression; - this.treeItemLabelExpression = newTreeItemLabelExpression; - if (this.eNotificationRequired()) - this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION, oldTreeItemLabelExpression, this.treeItemLabelExpression)); - } - /** * * @@ -589,6 +564,33 @@ public void setDeletableExpression(String newDeletableExpression) { this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_DESCRIPTION__DELETABLE_EXPRESSION, oldDeletableExpression, this.deletableExpression)); } + /** + * + * + * @generated + */ + @Override + public EList getTreeItemLabelDescriptions() { + if (this.treeItemLabelDescriptions == null) { + this.treeItemLabelDescriptions = new EObjectContainmentEList<>(TreeItemLabelDescription.class, this, TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS); + } + return this.treeItemLabelDescriptions; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS: + return ((InternalEList) this.getTreeItemLabelDescriptions()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + /** * * @@ -603,8 +605,6 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getIconURLExpression(); case TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION: return this.getTreeItemIdExpression(); - case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION: - return this.getTreeItemLabelExpression(); case TreePackage.TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION: return this.getTreeItemObjectExpression(); case TreePackage.TREE_DESCRIPTION__ELEMENTS_EXPRESSION: @@ -621,6 +621,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getSelectableExpression(); case TreePackage.TREE_DESCRIPTION__DELETABLE_EXPRESSION: return this.getDeletableExpression(); + case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS: + return this.getTreeItemLabelDescriptions(); } return super.eGet(featureID, resolve, coreType); } @@ -630,6 +632,7 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { * * @generated */ + @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { @@ -642,9 +645,6 @@ public void eSet(int featureID, Object newValue) { case TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION: this.setTreeItemIdExpression((String) newValue); return; - case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION: - this.setTreeItemLabelExpression((String) newValue); - return; case TreePackage.TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION: this.setTreeItemObjectExpression((String) newValue); return; @@ -669,6 +669,10 @@ public void eSet(int featureID, Object newValue) { case TreePackage.TREE_DESCRIPTION__DELETABLE_EXPRESSION: this.setDeletableExpression((String) newValue); return; + case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS: + this.getTreeItemLabelDescriptions().clear(); + this.getTreeItemLabelDescriptions().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -690,9 +694,6 @@ public void eUnset(int featureID) { case TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION: this.setTreeItemIdExpression(TREE_ITEM_ID_EXPRESSION_EDEFAULT); return; - case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION: - this.setTreeItemLabelExpression(TREE_ITEM_LABEL_EXPRESSION_EDEFAULT); - return; case TreePackage.TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION: this.setTreeItemObjectExpression(TREE_ITEM_OBJECT_EXPRESSION_EDEFAULT); return; @@ -717,6 +718,9 @@ public void eUnset(int featureID) { case TreePackage.TREE_DESCRIPTION__DELETABLE_EXPRESSION: this.setDeletableExpression(DELETABLE_EXPRESSION_EDEFAULT); return; + case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS: + this.getTreeItemLabelDescriptions().clear(); + return; } super.eUnset(featureID); } @@ -735,8 +739,6 @@ public boolean eIsSet(int featureID) { return ICON_URL_EXPRESSION_EDEFAULT == null ? this.iconURLExpression != null : !ICON_URL_EXPRESSION_EDEFAULT.equals(this.iconURLExpression); case TreePackage.TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION: return TREE_ITEM_ID_EXPRESSION_EDEFAULT == null ? this.treeItemIdExpression != null : !TREE_ITEM_ID_EXPRESSION_EDEFAULT.equals(this.treeItemIdExpression); - case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION: - return TREE_ITEM_LABEL_EXPRESSION_EDEFAULT == null ? this.treeItemLabelExpression != null : !TREE_ITEM_LABEL_EXPRESSION_EDEFAULT.equals(this.treeItemLabelExpression); case TreePackage.TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION: return TREE_ITEM_OBJECT_EXPRESSION_EDEFAULT == null ? this.treeItemObjectExpression != null : !TREE_ITEM_OBJECT_EXPRESSION_EDEFAULT.equals(this.treeItemObjectExpression); case TreePackage.TREE_DESCRIPTION__ELEMENTS_EXPRESSION: @@ -753,6 +755,8 @@ public boolean eIsSet(int featureID) { return SELECTABLE_EXPRESSION_EDEFAULT == null ? this.selectableExpression != null : !SELECTABLE_EXPRESSION_EDEFAULT.equals(this.selectableExpression); case TreePackage.TREE_DESCRIPTION__DELETABLE_EXPRESSION: return DELETABLE_EXPRESSION_EDEFAULT == null ? this.deletableExpression != null : !DELETABLE_EXPRESSION_EDEFAULT.equals(this.deletableExpression); + case TreePackage.TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS: + return this.treeItemLabelDescriptions != null && !this.treeItemLabelDescriptions.isEmpty(); } return super.eIsSet(featureID); } @@ -774,8 +778,6 @@ public String toString() { result.append(this.iconURLExpression); result.append(", treeItemIdExpression: "); result.append(this.treeItemIdExpression); - result.append(", treeItemLabelExpression: "); - result.append(this.treeItemLabelExpression); result.append(", treeItemObjectExpression: "); result.append(this.treeItemObjectExpression); result.append(", elementsExpression: "); diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java index 68a15ee1efc..820e09ec8d0 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeFactoryImpl.java @@ -19,6 +19,8 @@ import org.eclipse.emf.ecore.plugin.EcorePlugin; import org.eclipse.sirius.components.view.tree.TreeDescription; import org.eclipse.sirius.components.view.tree.TreeFactory; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -63,6 +65,10 @@ public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case TreePackage.TREE_DESCRIPTION: return this.createTreeDescription(); + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION: + return this.createTreeItemLabelDescription(); + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION: + return this.createTreeItemLabelFragmentDescription(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -79,6 +85,28 @@ public TreeDescription createTreeDescription() { return treeDescription; } + /** + * + * + * @generated + */ + @Override + public TreeItemLabelDescription createTreeItemLabelDescription() { + TreeItemLabelDescriptionImpl treeItemLabelDescription = new TreeItemLabelDescriptionImpl(); + return treeItemLabelDescription; + } + + /** + * + * + * @generated + */ + @Override + public TreeItemLabelFragmentDescription createTreeItemLabelFragmentDescription() { + TreeItemLabelFragmentDescriptionImpl treeItemLabelFragmentDescription = new TreeItemLabelFragmentDescriptionImpl(); + return treeItemLabelFragmentDescription; + } + /** * * diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelDescriptionImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelDescriptionImpl.java new file mode 100644 index 00000000000..6b1c8d5ca19 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelDescriptionImpl.java @@ -0,0 +1,288 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * An implementation of the model object 'Item Label Description'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl#getPreconditionExpression + * Precondition Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelDescriptionImpl#getChildren + * Children}
    • + *
    + * + * @generated + */ +public class TreeItemLabelDescriptionImpl extends MinimalEObjectImpl.Container implements TreeItemLabelDescription { + /** + * 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 #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 #getChildren() Children}' containment reference list. + * + * @see #getChildren() + * @generated + * @ordered + */ + protected EList children; + + /** + * + * + * @generated + */ + protected TreeItemLabelDescriptionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreePackage.Literals.TREE_ITEM_LABEL_DESCRIPTION; + } + + /** + * + * + * @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, TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME, oldName, this.name)); + } + + /** + * + * + * @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, TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION, oldPreconditionExpression, this.preconditionExpression)); + } + + /** + * + * + * @generated + */ + @Override + public EList getChildren() { + if (this.children == null) { + this.children = new EObjectContainmentEList<>(TreeItemLabelElementDescription.class, this, TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN); + } + return this.children; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + return ((InternalEList) this.getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME: + return this.getName(); + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION: + return this.getPreconditionExpression(); + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + return this.getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME: + this.setName((String) newValue); + return; + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION: + this.setPreconditionExpression((String) newValue); + return; + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + this.getChildren().clear(); + this.getChildren().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME: + this.setName(NAME_EDEFAULT); + return; + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION: + this.setPreconditionExpression(PRECONDITION_EXPRESSION_EDEFAULT); + return; + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + this.getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__NAME: + return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name); + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION: + return PRECONDITION_EXPRESSION_EDEFAULT == null ? this.preconditionExpression != null : !PRECONDITION_EXPRESSION_EDEFAULT.equals(this.preconditionExpression); + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION__CHILDREN: + return this.children != null && !this.children.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (name: "); + result.append(this.name); + result.append(", preconditionExpression: "); + result.append(this.preconditionExpression); + result.append(')'); + return result.toString(); + } + +} // TreeItemLabelDescriptionImpl diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelElementDescriptionImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelElementDescriptionImpl.java new file mode 100644 index 00000000000..9495a3e85c7 --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelElementDescriptionImpl.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * An implementation of the model object 'Item Label Element Description'. + * + * @generated + */ +public abstract class TreeItemLabelElementDescriptionImpl extends MinimalEObjectImpl.Container implements TreeItemLabelElementDescription { + /** + * + * + * @generated + */ + protected TreeItemLabelElementDescriptionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreePackage.Literals.TREE_ITEM_LABEL_ELEMENT_DESCRIPTION; + } + +} // TreeItemLabelElementDescriptionImpl diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelFragmentDescriptionImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelFragmentDescriptionImpl.java new file mode 100644 index 00000000000..a73f9ab016b --- /dev/null +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreeItemLabelFragmentDescriptionImpl.java @@ -0,0 +1,239 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.tree.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; +import org.eclipse.sirius.components.view.tree.TreePackage; + +/** + * An implementation of the model object 'Item Label Fragment Description'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl#getLabelExpression + * Label Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.tree.impl.TreeItemLabelFragmentDescriptionImpl#getStyle + * Style}
    • + *
    + * + * @generated + */ +public class TreeItemLabelFragmentDescriptionImpl extends TreeItemLabelElementDescriptionImpl implements TreeItemLabelFragmentDescription { + /** + * 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 cached value of the '{@link #getStyle() Style}' reference. + * + * @see #getStyle() + * @generated + * @ordered + */ + protected TextStyleDescription style; + + /** + * + * + * @generated + */ + protected TreeItemLabelFragmentDescriptionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreePackage.Literals.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION; + } + + /** + * + * + * @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, TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION, oldLabelExpression, this.labelExpression)); + } + + /** + * + * + * @generated + */ + @Override + public TextStyleDescription getStyle() { + if (this.style != null && this.style.eIsProxy()) { + InternalEObject oldStyle = (InternalEObject) this.style; + this.style = (TextStyleDescription) this.eResolveProxy(oldStyle); + if (this.style != oldStyle) { + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE, oldStyle, this.style)); + } + } + return this.style; + } + + /** + * + * + * @generated + */ + public TextStyleDescription basicGetStyle() { + return this.style; + } + + /** + * + * + * @generated + */ + @Override + public void setStyle(TextStyleDescription newStyle) { + TextStyleDescription oldStyle = this.style; + this.style = newStyle; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE, oldStyle, this.style)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION: + return this.getLabelExpression(); + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE: + if (resolve) + return this.getStyle(); + return this.basicGetStyle(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION: + this.setLabelExpression((String) newValue); + return; + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE: + this.setStyle((TextStyleDescription) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION: + this.setLabelExpression(LABEL_EXPRESSION_EDEFAULT); + return; + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE: + this.setStyle((TextStyleDescription) null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION: + return LABEL_EXPRESSION_EDEFAULT == null ? this.labelExpression != null : !LABEL_EXPRESSION_EDEFAULT.equals(this.labelExpression); + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE: + return this.style != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (this.eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (labelExpression: "); + result.append(this.labelExpression); + result.append(')'); + return result.toString(); + } + +} // TreeItemLabelFragmentDescriptionImpl diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java index dc16adc94ea..818ab2721d9 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/impl/TreePackageImpl.java @@ -15,10 +15,14 @@ import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; import org.eclipse.sirius.components.view.ViewPackage; import org.eclipse.sirius.components.view.tree.TreeDescription; import org.eclipse.sirius.components.view.tree.TreeFactory; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -34,6 +38,27 @@ public class TreePackageImpl extends EPackageImpl implements TreePackage { */ private EClass treeDescriptionEClass = null; + /** + * + * + * @generated + */ + private EClass treeItemLabelDescriptionEClass = null; + + /** + * + * + * @generated + */ + private EClass treeItemLabelFragmentDescriptionEClass = null; + + /** + * + * + * @generated + */ + private EClass treeItemLabelElementDescriptionEClass = null; + /** * Creates an instance of the model Package, registered with {@link org.eclipse.emf.ecore.EPackage.Registry * EPackage.Registry} by the package package URI value. @@ -144,7 +169,7 @@ public EAttribute getTreeDescription_TreeItemIdExpression() { * @generated */ @Override - public EAttribute getTreeDescription_TreeItemLabelExpression() { + public EAttribute getTreeDescription_TreeItemObjectExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(3); } @@ -154,7 +179,7 @@ public EAttribute getTreeDescription_TreeItemLabelExpression() { * @generated */ @Override - public EAttribute getTreeDescription_TreeItemObjectExpression() { + public EAttribute getTreeDescription_ElementsExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(4); } @@ -164,7 +189,7 @@ public EAttribute getTreeDescription_TreeItemObjectExpression() { * @generated */ @Override - public EAttribute getTreeDescription_ElementsExpression() { + public EAttribute getTreeDescription_HasChildrenExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(5); } @@ -174,7 +199,7 @@ public EAttribute getTreeDescription_ElementsExpression() { * @generated */ @Override - public EAttribute getTreeDescription_HasChildrenExpression() { + public EAttribute getTreeDescription_ChildrenExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(6); } @@ -184,7 +209,7 @@ public EAttribute getTreeDescription_HasChildrenExpression() { * @generated */ @Override - public EAttribute getTreeDescription_ChildrenExpression() { + public EAttribute getTreeDescription_ParentExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(7); } @@ -194,7 +219,7 @@ public EAttribute getTreeDescription_ChildrenExpression() { * @generated */ @Override - public EAttribute getTreeDescription_ParentExpression() { + public EAttribute getTreeDescription_EditableExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(8); } @@ -204,7 +229,7 @@ public EAttribute getTreeDescription_ParentExpression() { * @generated */ @Override - public EAttribute getTreeDescription_EditableExpression() { + public EAttribute getTreeDescription_SelectableExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(9); } @@ -214,7 +239,7 @@ public EAttribute getTreeDescription_EditableExpression() { * @generated */ @Override - public EAttribute getTreeDescription_SelectableExpression() { + public EAttribute getTreeDescription_DeletableExpression() { return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(10); } @@ -224,8 +249,88 @@ public EAttribute getTreeDescription_SelectableExpression() { * @generated */ @Override - public EAttribute getTreeDescription_DeletableExpression() { - return (EAttribute) this.treeDescriptionEClass.getEStructuralFeatures().get(11); + public EReference getTreeDescription_TreeItemLabelDescriptions() { + return (EReference) this.treeDescriptionEClass.getEStructuralFeatures().get(11); + } + + /** + * + * + * @generated + */ + @Override + public EClass getTreeItemLabelDescription() { + return this.treeItemLabelDescriptionEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTreeItemLabelDescription_Name() { + return (EAttribute) this.treeItemLabelDescriptionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTreeItemLabelDescription_PreconditionExpression() { + return (EAttribute) this.treeItemLabelDescriptionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EReference getTreeItemLabelDescription_Children() { + return (EReference) this.treeItemLabelDescriptionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EClass getTreeItemLabelFragmentDescription() { + return this.treeItemLabelFragmentDescriptionEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTreeItemLabelFragmentDescription_LabelExpression() { + return (EAttribute) this.treeItemLabelFragmentDescriptionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EReference getTreeItemLabelFragmentDescription_Style() { + return (EReference) this.treeItemLabelFragmentDescriptionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EClass getTreeItemLabelElementDescription() { + return this.treeItemLabelElementDescriptionEClass; } /** @@ -261,7 +366,6 @@ public void createPackageContents() { this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__KIND_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__ICON_URL_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__TREE_ITEM_ID_EXPRESSION); - this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__TREE_ITEM_LABEL_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__TREE_ITEM_OBJECT_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__ELEMENTS_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__HAS_CHILDREN_EXPRESSION); @@ -270,6 +374,18 @@ public void createPackageContents() { this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__EDITABLE_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__SELECTABLE_EXPRESSION); this.createEAttribute(this.treeDescriptionEClass, TREE_DESCRIPTION__DELETABLE_EXPRESSION); + this.createEReference(this.treeDescriptionEClass, TREE_DESCRIPTION__TREE_ITEM_LABEL_DESCRIPTIONS); + + this.treeItemLabelDescriptionEClass = this.createEClass(TREE_ITEM_LABEL_DESCRIPTION); + this.createEAttribute(this.treeItemLabelDescriptionEClass, TREE_ITEM_LABEL_DESCRIPTION__NAME); + this.createEAttribute(this.treeItemLabelDescriptionEClass, TREE_ITEM_LABEL_DESCRIPTION__PRECONDITION_EXPRESSION); + this.createEReference(this.treeItemLabelDescriptionEClass, TREE_ITEM_LABEL_DESCRIPTION__CHILDREN); + + this.treeItemLabelFragmentDescriptionEClass = this.createEClass(TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION); + this.createEAttribute(this.treeItemLabelFragmentDescriptionEClass, TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__LABEL_EXPRESSION); + this.createEReference(this.treeItemLabelFragmentDescriptionEClass, TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION__STYLE); + + this.treeItemLabelElementDescriptionEClass = this.createEClass(TREE_ITEM_LABEL_ELEMENT_DESCRIPTION); } /** @@ -304,6 +420,7 @@ public void initializePackageContents() { // Add supertypes to classes this.treeDescriptionEClass.getESuperTypes().add(theViewPackage.getRepresentationDescription()); + this.treeItemLabelFragmentDescriptionEClass.getESuperTypes().add(this.getTreeItemLabelElementDescription()); // Initialize classes, features, and operations; add parameters this.initEClass(this.treeDescriptionEClass, TreeDescription.class, "TreeDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -313,8 +430,6 @@ public void initializePackageContents() { IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getTreeDescription_TreeItemIdExpression(), theViewPackage.getInterpretedExpression(), "treeItemIdExpression", null, 0, 1, TreeDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - this.initEAttribute(this.getTreeDescription_TreeItemLabelExpression(), theViewPackage.getInterpretedExpression(), "treeItemLabelExpression", null, 0, 1, TreeDescription.class, !IS_TRANSIENT, - !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getTreeDescription_TreeItemObjectExpression(), theViewPackage.getInterpretedExpression(), "treeItemObjectExpression", null, 0, 1, TreeDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getTreeDescription_ElementsExpression(), theViewPackage.getInterpretedExpression(), "elementsExpression", null, 0, 1, TreeDescription.class, !IS_TRANSIENT, @@ -331,6 +446,25 @@ public void initializePackageContents() { !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getTreeDescription_DeletableExpression(), theViewPackage.getInterpretedExpression(), "deletableExpression", null, 0, 1, TreeDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getTreeDescription_TreeItemLabelDescriptions(), this.getTreeItemLabelDescription(), null, "treeItemLabelDescriptions", null, 0, -1, TreeDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + this.initEClass(this.treeItemLabelDescriptionEClass, TreeItemLabelDescription.class, "TreeItemLabelDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getTreeItemLabelDescription_Name(), theViewPackage.getIdentifier(), "name", null, 0, 1, TreeItemLabelDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTreeItemLabelDescription_PreconditionExpression(), theViewPackage.getInterpretedExpression(), "preconditionExpression", null, 0, 1, TreeItemLabelDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getTreeItemLabelDescription_Children(), this.getTreeItemLabelElementDescription(), null, "children", null, 1, -1, TreeItemLabelDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + this.initEClass(this.treeItemLabelFragmentDescriptionEClass, TreeItemLabelFragmentDescription.class, "TreeItemLabelFragmentDescription", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getTreeItemLabelFragmentDescription_LabelExpression(), theViewPackage.getInterpretedExpression(), "labelExpression", null, 0, 1, + TreeItemLabelFragmentDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getTreeItemLabelFragmentDescription_Style(), theViewPackage.getTextStyleDescription(), null, "style", null, 0, 1, TreeItemLabelFragmentDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + this.initEClass(this.treeItemLabelElementDescriptionEClass, TreeItemLabelElementDescription.class, "TreeItemLabelElementDescription", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); // Create resource this.createResource(eNS_URI); diff --git a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java index d7562d4f78e..67cf971f568 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeAdapterFactory.java @@ -18,6 +18,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.tree.TreeDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -76,6 +79,21 @@ public Adapter caseTreeDescription(TreeDescription object) { return TreeAdapterFactory.this.createTreeDescriptionAdapter(); } + @Override + public Adapter caseTreeItemLabelDescription(TreeItemLabelDescription object) { + return TreeAdapterFactory.this.createTreeItemLabelDescriptionAdapter(); + } + + @Override + public Adapter caseTreeItemLabelFragmentDescription(TreeItemLabelFragmentDescription object) { + return TreeAdapterFactory.this.createTreeItemLabelFragmentDescriptionAdapter(); + } + + @Override + public Adapter caseTreeItemLabelElementDescription(TreeItemLabelElementDescription object) { + return TreeAdapterFactory.this.createTreeItemLabelElementDescriptionAdapter(); + } + @Override public Adapter caseRepresentationDescription(RepresentationDescription object) { return TreeAdapterFactory.this.createRepresentationDescriptionAdapter(); @@ -114,6 +132,48 @@ public Adapter createTreeDescriptionAdapter() { return null; } + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelDescription Item Label Description}'. This default implementation returns null so that we can easily ignore cases; it's useful to + * ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelDescription + * @generated + */ + public Adapter createTreeItemLabelDescriptionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription Item Label Fragment + * Description}'. This default implementation returns null so that we can easily ignore + * cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription + * @generated + */ + public Adapter createTreeItemLabelFragmentDescriptionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription Item Label Element + * Description}'. This default implementation returns null so that we can easily ignore + * cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription + * @generated + */ + public Adapter createTreeItemLabelElementDescriptionAdapter() { + 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-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java index af9cff19952..ab7b23e1ea4 100644 --- a/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java +++ b/packages/view/backend/sirius-components-view-tree/src/main/java/org/eclipse/sirius/components/view/tree/util/TreeSwitch.java @@ -17,6 +17,9 @@ import org.eclipse.emf.ecore.util.Switch; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.tree.TreeDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelElementDescription; +import org.eclipse.sirius.components.view.tree.TreeItemLabelFragmentDescription; import org.eclipse.sirius.components.view.tree.TreePackage; /** @@ -79,6 +82,29 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case TreePackage.TREE_ITEM_LABEL_DESCRIPTION: { + TreeItemLabelDescription treeItemLabelDescription = (TreeItemLabelDescription) theEObject; + T result = this.caseTreeItemLabelDescription(treeItemLabelDescription); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } + case TreePackage.TREE_ITEM_LABEL_FRAGMENT_DESCRIPTION: { + TreeItemLabelFragmentDescription treeItemLabelFragmentDescription = (TreeItemLabelFragmentDescription) theEObject; + T result = this.caseTreeItemLabelFragmentDescription(treeItemLabelFragmentDescription); + if (result == null) + result = this.caseTreeItemLabelElementDescription(treeItemLabelFragmentDescription); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } + case TreePackage.TREE_ITEM_LABEL_ELEMENT_DESCRIPTION: { + TreeItemLabelElementDescription treeItemLabelElementDescription = (TreeItemLabelElementDescription) theEObject; + T result = this.caseTreeItemLabelElementDescription(treeItemLabelElementDescription); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } default: return this.defaultCase(theEObject); } @@ -98,6 +124,51 @@ public T caseTreeDescription(TreeDescription object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'Item Label Description'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Item Label Description'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTreeItemLabelDescription(TreeItemLabelDescription object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Item Label Fragment Description'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Item Label Fragment Description'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTreeItemLabelFragmentDescription(TreeItemLabelFragmentDescription object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Item Label Element Description'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Item Label Element Description'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTreeItemLabelElementDescription(TreeItemLabelElementDescription 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. A representation of the model object 'Text Style Description'. + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getForegroundColorExpression Foreground Color + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getBackgroundColorExpression Background Color + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getIsBoldExpression Is Bold + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getIsItalicExpression Is Italic + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStyleDescription#getIsUnderlineExpression Is Underline + * Expression}
    • + *
    + * + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription() + * @model + * @generated + */ +public interface TextStyleDescription 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.ViewPackage#getTextStyleDescription_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.TextStyleDescription#getName Name}' + * attribute. + * + * @param value + * the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Foreground Color Expression' attribute. The default value is + * "". + * + * @return the value of the 'Foreground Color Expression' attribute. + * @see #setForegroundColorExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription_ForegroundColorExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getForegroundColorExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getForegroundColorExpression Foreground Color + * Expression}' attribute. + * + * @param value + * the new value of the 'Foreground Color Expression' attribute. + * @see #getForegroundColorExpression() + * @generated + */ + void setForegroundColorExpression(String value); + + /** + * Returns the value of the 'Background Color Expression' attribute. The default value is + * "". + * + * @return the value of the 'Background Color Expression' attribute. + * @see #setBackgroundColorExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription_BackgroundColorExpression() + * @model default="" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getBackgroundColorExpression(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getBackgroundColorExpression Background Color + * Expression}' attribute. + * + * @param value + * the new value of the 'Background Color Expression' attribute. + * @see #getBackgroundColorExpression() + * @generated + */ + void setBackgroundColorExpression(String value); + + /** + * Returns the value of the 'Is Bold Expression' attribute. The default value is + * "aql:\'false\'". + * + * @return the value of the 'Is Bold Expression' attribute. + * @see #setIsBoldExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription_IsBoldExpression() + * @model default="aql:\'false\'" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getIsBoldExpression(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsBoldExpression Is + * Bold Expression}' attribute. + * + * @param value + * the new value of the 'Is Bold Expression' attribute. + * @see #getIsBoldExpression() + * @generated + */ + void setIsBoldExpression(String value); + + /** + * Returns the value of the 'Is Italic Expression' attribute. The default value is + * "aql:\'false\'". + * + * @return the value of the 'Is Italic Expression' attribute. + * @see #setIsItalicExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription_IsItalicExpression() + * @model default="aql:\'false\'" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getIsItalicExpression(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsItalicExpression + * Is Italic Expression}' attribute. + * + * @param value + * the new value of the 'Is Italic Expression' attribute. + * @see #getIsItalicExpression() + * @generated + */ + void setIsItalicExpression(String value); + + /** + * Returns the value of the 'Is Underline Expression' attribute. The default value is + * "aql:\'false\'". + * + * @return the value of the 'Is Underline Expression' attribute. + * @see #setIsUnderlineExpression(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStyleDescription_IsUnderlineExpression() + * @model default="aql:\'false\'" dataType="org.eclipse.sirius.components.view.InterpretedExpression" + * @generated + */ + String getIsUnderlineExpression(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsUnderlineExpression + * Is Underline Expression}' attribute. + * + * @param value + * the new value of the 'Is Underline Expression' attribute. + * @see #getIsUnderlineExpression() + * @generated + */ + void setIsUnderlineExpression(String value); + +} // TextStyleDescription diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/TextStylePalette.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/TextStylePalette.java new file mode 100644 index 00000000000..e0b69c4922f --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/TextStylePalette.java @@ -0,0 +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 + *******************************************************************************/ +package org.eclipse.sirius.components.view; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * A representation of the model object 'Text Style Palette'. + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.TextStylePalette#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.TextStylePalette#getStyles Styles}
    • + *
    + * + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStylePalette() + * @model + * @generated + */ +public interface TextStylePalette 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.ViewPackage#getTextStylePalette_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.TextStylePalette#getName Name}' + * attribute. + * + * @param value + * the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Styles' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.components.view.TextStyleDescription}. + * + * @return the value of the 'Styles' containment reference list. + * @see org.eclipse.sirius.components.view.ViewPackage#getTextStylePalette_Styles() + * @model containment="true" keys="name" + * @generated + */ + EList getStyles(); + +} // TextStylePalette diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/View.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/View.java index f72998b731b..b6b56453552 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/View.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/View.java @@ -24,6 +24,7 @@ *
      *
    • {@link org.eclipse.sirius.components.view.View#getDescriptions Descriptions}
    • *
    • {@link org.eclipse.sirius.components.view.View#getColorPalettes Color Palettes}
    • + *
    • {@link org.eclipse.sirius.components.view.View#getTextStylePalettes Text Style Palettes}
    • *
    * * @see org.eclipse.sirius.components.view.ViewPackage#getView() @@ -54,4 +55,16 @@ public interface View extends EObject { */ EList getColorPalettes(); + /** + * Returns the value of the 'Text Style Palettes' containment reference list. The list contents are + * of type {@link org.eclipse.sirius.components.view.TextStylePalette}. + * + * @return the value of the 'Text Style Palettes' containment reference list. + * @see org.eclipse.sirius.components.view.ViewPackage#getView_TextStylePalettes() + * @model containment="true" keys="name" + * @generated + */ + EList getTextStylePalettes(); + } // View diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java index d14643823ae..a09b28af969 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewFactory.java @@ -117,6 +117,22 @@ public interface ViewFactory extends EFactory { */ For createFor(); + /** + * Returns a new object of class 'Text Style Palette'. + * + * @return a new object of class 'Text Style Palette'. + * @generated + */ + TextStylePalette createTextStylePalette(); + + /** + * Returns a new object of class 'Text Style Description'. + * + * @return a new object of class 'Text Style Description'. + * @generated + */ + TextStyleDescription createTextStyleDescription(); + /** * Returns the package supported by this factory. * diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java index 02d087e3bdf..4c42716d87d 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/ViewPackage.java @@ -90,13 +90,22 @@ public interface ViewPackage extends EPackage { */ int VIEW__COLOR_PALETTES = 1; + /** + * The feature id for the 'Text Style Palettes' containment reference list. + * + * + * @generated + * @ordered + */ + int VIEW__TEXT_STYLE_PALETTES = 2; + /** * The number of structural features of the 'View' class. * * @generated * @ordered */ - int VIEW_FEATURE_COUNT = 2; + int VIEW_FEATURE_COUNT = 3; /** * The number of operations of the 'View' class. @@ -821,6 +830,132 @@ public interface ViewPackage extends EPackage { */ int FOR_OPERATION_COUNT = OPERATION_OPERATION_COUNT + 0; + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.impl.TextStylePaletteImpl Text Style + * Palette}' class. + * + * @see org.eclipse.sirius.components.view.impl.TextStylePaletteImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getTextStylePalette() + * @generated + */ + int TEXT_STYLE_PALETTE = 16; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_PALETTE__NAME = 0; + + /** + * The feature id for the 'Styles' containment reference list. + * + * @generated + * @ordered + */ + int TEXT_STYLE_PALETTE__STYLES = 1; + + /** + * The number of structural features of the 'Text Style Palette' class. + * + * @generated + * @ordered + */ + int TEXT_STYLE_PALETTE_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'Text Style Palette' class. + * + * @generated + * @ordered + */ + int TEXT_STYLE_PALETTE_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl Text + * Style Description}' class. + * + * @see org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getTextStyleDescription() + * @generated + */ + int TEXT_STYLE_DESCRIPTION = 17; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__NAME = 0; + + /** + * The feature id for the 'Foreground Color Expression' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION = 1; + + /** + * The feature id for the 'Background Color Expression' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION = 2; + + /** + * The feature id for the 'Is Bold Expression' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION = 3; + + /** + * The feature id for the 'Is Italic Expression' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION = 4; + + /** + * The feature id for the 'Is Underline Expression' attribute. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION = 5; + + /** + * The number of structural features of the 'Text Style Description' class. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION_FEATURE_COUNT = 6; + + /** + * The number of operations of the 'Text Style Description' class. + * + * @generated + * @ordered + */ + int TEXT_STYLE_DESCRIPTION_OPERATION_COUNT = 0; + /** * The meta object id for the 'Identifier' data type. * @@ -828,7 +963,7 @@ public interface ViewPackage extends EPackage { * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getIdentifier() * @generated */ - int IDENTIFIER = 16; + int IDENTIFIER = 18; /** * The meta object id for the 'Interpreted Expression' data type. @@ -847,7 +982,7 @@ public interface ViewPackage extends EPackage { * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getDomainType() * @generated */ - int DOMAIN_TYPE = 18; + int DOMAIN_TYPE = 20; /** * The meta object id for the 'Color' data type. @@ -856,7 +991,7 @@ public interface ViewPackage extends EPackage { * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getColor() * @generated */ - int COLOR = 19; + int COLOR = 21; /** * The meta object id for the 'Length' data type. @@ -864,7 +999,7 @@ public interface ViewPackage extends EPackage { * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getLength() * @generated */ - int LENGTH = 20; + int LENGTH = 22; /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.View View}'. + * + * @return the meta object for the containment reference list 'Text Style Palettes'. + * @see org.eclipse.sirius.components.view.View#getTextStylePalettes() + * @see #getView() + * @generated + */ + EReference getView_TextStylePalettes(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.ColorPalette Color * Palette}'. @@ -1367,6 +1514,120 @@ public interface ViewPackage extends EPackage { */ EAttribute getFor_IteratorName(); + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.TextStylePalette Text Style + * Palette}'. + * + * @return the meta object for class 'Text Style Palette'. + * @see org.eclipse.sirius.components.view.TextStylePalette + * @generated + */ + EClass getTextStylePalette(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.sirius.components.view.TextStylePalette#getName + * Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.sirius.components.view.TextStylePalette#getName() + * @see #getTextStylePalette() + * @generated + */ + EAttribute getTextStylePalette_Name(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.components.view.TextStylePalette#getStyles Styles}'. + * + * + * @return the meta object for the containment reference list 'Styles'. + * @see org.eclipse.sirius.components.view.TextStylePalette#getStyles() + * @see #getTextStylePalette() + * @generated + */ + EReference getTextStylePalette_Styles(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.TextStyleDescription Text Style + * Description}'. + * + * @return the meta object for class 'Text Style Description'. + * @see org.eclipse.sirius.components.view.TextStyleDescription + * @generated + */ + EClass getTextStyleDescription(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.sirius.components.view.TextStyleDescription#getName + * Name}'. + * + * @return the meta object for the attribute 'Name'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getName() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_Name(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getForegroundColorExpression Foreground Color + * Expression}'. + * + * @return the meta object for the attribute 'Foreground Color Expression'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getForegroundColorExpression() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_ForegroundColorExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getBackgroundColorExpression Background Color + * Expression}'. + * + * @return the meta object for the attribute 'Background Color Expression'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getBackgroundColorExpression() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_BackgroundColorExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsBoldExpression Is Bold + * Expression}'. + * + * @return the meta object for the attribute 'Is Bold Expression'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getIsBoldExpression() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_IsBoldExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsItalicExpression Is Italic + * Expression}'. + * + * @return the meta object for the attribute 'Is Italic Expression'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getIsItalicExpression() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_IsItalicExpression(); + + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.TextStyleDescription#getIsUnderlineExpression Is Underline + * Expression}'. + * + * @return the meta object for the attribute 'Is Underline Expression'. + * @see org.eclipse.sirius.components.view.TextStyleDescription#getIsUnderlineExpression() + * @see #getTextStyleDescription() + * @generated + */ + EAttribute getTextStyleDescription_IsUnderlineExpression(); + /** * Returns the meta object for data type '{@link java.lang.String Identifier}'. * @@ -1468,6 +1729,14 @@ interface Literals { */ EReference VIEW__COLOR_PALETTES = eINSTANCE.getView_ColorPalettes(); + /** + * The meta object literal for the 'Text Style Palettes' containment reference list feature. + * + * + * @generated + */ + EReference VIEW__TEXT_STYLE_PALETTES = eINSTANCE.getView_TextStylePalettes(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.ColorPaletteImpl Color * Palette}' class. @@ -1842,6 +2111,90 @@ interface Literals { */ EAttribute FOR__ITERATOR_NAME = eINSTANCE.getFor_IteratorName(); + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.TextStylePaletteImpl Text + * Style Palette}' class. + * + * @see org.eclipse.sirius.components.view.impl.TextStylePaletteImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getTextStylePalette() + * @generated + */ + EClass TEXT_STYLE_PALETTE = eINSTANCE.getTextStylePalette(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_PALETTE__NAME = eINSTANCE.getTextStylePalette_Name(); + + /** + * The meta object literal for the 'Styles' containment reference list feature. + * + * @generated + */ + EReference TEXT_STYLE_PALETTE__STYLES = eINSTANCE.getTextStylePalette_Styles(); + + /** + * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl + * Text Style Description}' class. + * + * @see org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl + * @see org.eclipse.sirius.components.view.impl.ViewPackageImpl#getTextStyleDescription() + * @generated + */ + EClass TEXT_STYLE_DESCRIPTION = eINSTANCE.getTextStyleDescription(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__NAME = eINSTANCE.getTextStyleDescription_Name(); + + /** + * The meta object literal for the 'Foreground Color Expression' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION = eINSTANCE.getTextStyleDescription_ForegroundColorExpression(); + + /** + * The meta object literal for the 'Background Color Expression' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION = eINSTANCE.getTextStyleDescription_BackgroundColorExpression(); + + /** + * The meta object literal for the 'Is Bold Expression' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION = eINSTANCE.getTextStyleDescription_IsBoldExpression(); + + /** + * The meta object literal for the 'Is Italic Expression' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION = eINSTANCE.getTextStyleDescription_IsItalicExpression(); + + /** + * The meta object literal for the 'Is Underline Expression' attribute feature. + * + * @generated + */ + EAttribute TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION = eINSTANCE.getTextStyleDescription_IsUnderlineExpression(); + /** * The meta object literal for the 'Identifier' data type. diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStyleDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStyleDescriptionImpl.java new file mode 100644 index 00000000000..763048e733b --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStyleDescriptionImpl.java @@ -0,0 +1,457 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * An implementation of the model object 'Text Style Description'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getForegroundColorExpression + * Foreground Color Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getBackgroundColorExpression + * Background Color Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getIsBoldExpression Is Bold + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getIsItalicExpression Is Italic + * Expression}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStyleDescriptionImpl#getIsUnderlineExpression Is Underline + * Expression}
    • + *
    + * + * @generated + */ +public class TextStyleDescriptionImpl extends MinimalEObjectImpl.Container implements TextStyleDescription { + /** + * 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 #getForegroundColorExpression() Foreground Color Expression}' + * attribute. + * + * @see #getForegroundColorExpression() + * @generated + * @ordered + */ + protected static final String FOREGROUND_COLOR_EXPRESSION_EDEFAULT = ""; + + /** + * The cached value of the '{@link #getForegroundColorExpression() Foreground Color Expression}' attribute. + * + * + * @see #getForegroundColorExpression() + * @generated + * @ordered + */ + protected String foregroundColorExpression = FOREGROUND_COLOR_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getBackgroundColorExpression() Background Color Expression}' + * attribute. + * + * @see #getBackgroundColorExpression() + * @generated + * @ordered + */ + protected static final String BACKGROUND_COLOR_EXPRESSION_EDEFAULT = ""; + + /** + * The cached value of the '{@link #getBackgroundColorExpression() Background Color Expression}' attribute. + * + * + * @see #getBackgroundColorExpression() + * @generated + * @ordered + */ + protected String backgroundColorExpression = BACKGROUND_COLOR_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getIsBoldExpression() Is Bold Expression}' attribute. + * + * @see #getIsBoldExpression() + * @generated + * @ordered + */ + protected static final String IS_BOLD_EXPRESSION_EDEFAULT = "aql:\'false\'"; + + /** + * The cached value of the '{@link #getIsBoldExpression() Is Bold Expression}' attribute. + * + * @see #getIsBoldExpression() + * @generated + * @ordered + */ + protected String isBoldExpression = IS_BOLD_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getIsItalicExpression() Is Italic Expression}' attribute. + * + * @see #getIsItalicExpression() + * @generated + * @ordered + */ + protected static final String IS_ITALIC_EXPRESSION_EDEFAULT = "aql:\'false\'"; + + /** + * The cached value of the '{@link #getIsItalicExpression() Is Italic Expression}' attribute. + * + * @see #getIsItalicExpression() + * @generated + * @ordered + */ + protected String isItalicExpression = IS_ITALIC_EXPRESSION_EDEFAULT; + + /** + * The default value of the '{@link #getIsUnderlineExpression() Is Underline Expression}' attribute. + * + * @see #getIsUnderlineExpression() + * @generated + * @ordered + */ + protected static final String IS_UNDERLINE_EXPRESSION_EDEFAULT = "aql:\'false\'"; + + /** + * The cached value of the '{@link #getIsUnderlineExpression() Is Underline Expression}' attribute. + * + * @see #getIsUnderlineExpression() + * @generated + * @ordered + */ + protected String isUnderlineExpression = IS_UNDERLINE_EXPRESSION_EDEFAULT; + + /** + * + * + * @generated + */ + protected TextStyleDescriptionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ViewPackage.Literals.TEXT_STYLE_DESCRIPTION; + } + + /** + * + * + * @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, ViewPackage.TEXT_STYLE_DESCRIPTION__NAME, oldName, this.name)); + } + + /** + * + * + * @generated + */ + @Override + public String getForegroundColorExpression() { + return this.foregroundColorExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setForegroundColorExpression(String newForegroundColorExpression) { + String oldForegroundColorExpression = this.foregroundColorExpression; + this.foregroundColorExpression = newForegroundColorExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION, oldForegroundColorExpression, this.foregroundColorExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getBackgroundColorExpression() { + return this.backgroundColorExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setBackgroundColorExpression(String newBackgroundColorExpression) { + String oldBackgroundColorExpression = this.backgroundColorExpression; + this.backgroundColorExpression = newBackgroundColorExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION, oldBackgroundColorExpression, this.backgroundColorExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getIsBoldExpression() { + return this.isBoldExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setIsBoldExpression(String newIsBoldExpression) { + String oldIsBoldExpression = this.isBoldExpression; + this.isBoldExpression = newIsBoldExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION, oldIsBoldExpression, this.isBoldExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getIsItalicExpression() { + return this.isItalicExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setIsItalicExpression(String newIsItalicExpression) { + String oldIsItalicExpression = this.isItalicExpression; + this.isItalicExpression = newIsItalicExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION, oldIsItalicExpression, this.isItalicExpression)); + } + + /** + * + * + * @generated + */ + @Override + public String getIsUnderlineExpression() { + return this.isUnderlineExpression; + } + + /** + * + * + * @generated + */ + @Override + public void setIsUnderlineExpression(String newIsUnderlineExpression) { + String oldIsUnderlineExpression = this.isUnderlineExpression; + this.isUnderlineExpression = newIsUnderlineExpression; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION, oldIsUnderlineExpression, this.isUnderlineExpression)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_DESCRIPTION__NAME: + return this.getName(); + case ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION: + return this.getForegroundColorExpression(); + case ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION: + return this.getBackgroundColorExpression(); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION: + return this.getIsBoldExpression(); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION: + return this.getIsItalicExpression(); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION: + return this.getIsUnderlineExpression(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_DESCRIPTION__NAME: + this.setName((String) newValue); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION: + this.setForegroundColorExpression((String) newValue); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION: + this.setBackgroundColorExpression((String) newValue); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION: + this.setIsBoldExpression((String) newValue); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION: + this.setIsItalicExpression((String) newValue); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION: + this.setIsUnderlineExpression((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_DESCRIPTION__NAME: + this.setName(NAME_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION: + this.setForegroundColorExpression(FOREGROUND_COLOR_EXPRESSION_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION: + this.setBackgroundColorExpression(BACKGROUND_COLOR_EXPRESSION_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION: + this.setIsBoldExpression(IS_BOLD_EXPRESSION_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION: + this.setIsItalicExpression(IS_ITALIC_EXPRESSION_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION: + this.setIsUnderlineExpression(IS_UNDERLINE_EXPRESSION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_DESCRIPTION__NAME: + return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name); + case ViewPackage.TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION: + return FOREGROUND_COLOR_EXPRESSION_EDEFAULT == null ? this.foregroundColorExpression != null : !FOREGROUND_COLOR_EXPRESSION_EDEFAULT.equals(this.foregroundColorExpression); + case ViewPackage.TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION: + return BACKGROUND_COLOR_EXPRESSION_EDEFAULT == null ? this.backgroundColorExpression != null : !BACKGROUND_COLOR_EXPRESSION_EDEFAULT.equals(this.backgroundColorExpression); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION: + return IS_BOLD_EXPRESSION_EDEFAULT == null ? this.isBoldExpression != null : !IS_BOLD_EXPRESSION_EDEFAULT.equals(this.isBoldExpression); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION: + return IS_ITALIC_EXPRESSION_EDEFAULT == null ? this.isItalicExpression != null : !IS_ITALIC_EXPRESSION_EDEFAULT.equals(this.isItalicExpression); + case ViewPackage.TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION: + return IS_UNDERLINE_EXPRESSION_EDEFAULT == null ? this.isUnderlineExpression != null : !IS_UNDERLINE_EXPRESSION_EDEFAULT.equals(this.isUnderlineExpression); + } + 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(", foregroundColorExpression: "); + result.append(this.foregroundColorExpression); + result.append(", backgroundColorExpression: "); + result.append(this.backgroundColorExpression); + result.append(", isBoldExpression: "); + result.append(this.isBoldExpression); + result.append(", isItalicExpression: "); + result.append(this.isItalicExpression); + result.append(", isUnderlineExpression: "); + result.append(this.isUnderlineExpression); + result.append(')'); + return result.toString(); + } + +} // TextStyleDescriptionImpl diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStylePaletteImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStylePaletteImpl.java new file mode 100644 index 00000000000..4a7bdc3c32d --- /dev/null +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/TextStylePaletteImpl.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * 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 + *******************************************************************************/ +package org.eclipse.sirius.components.view.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; +import org.eclipse.sirius.components.view.ViewPackage; + +/** + * An implementation of the model object 'Text Style Palette'. + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.eclipse.sirius.components.view.impl.TextStylePaletteImpl#getName Name}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.TextStylePaletteImpl#getStyles Styles}
    • + *
    + * + * @generated + */ +public class TextStylePaletteImpl extends MinimalEObjectImpl.Container implements TextStylePalette { + /** + * 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 cached value of the '{@link #getStyles() Styles}' containment reference list. + * + * @see #getStyles() + * @generated + * @ordered + */ + protected EList styles; + + /** + * + * + * @generated + */ + protected TextStylePaletteImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ViewPackage.Literals.TEXT_STYLE_PALETTE; + } + + /** + * + * + * @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, ViewPackage.TEXT_STYLE_PALETTE__NAME, oldName, this.name)); + } + + /** + * + * + * @generated + */ + @Override + public EList getStyles() { + if (this.styles == null) { + this.styles = new EObjectContainmentEList<>(TextStyleDescription.class, this, ViewPackage.TEXT_STYLE_PALETTE__STYLES); + } + return this.styles; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + return ((InternalEList) this.getStyles()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_PALETTE__NAME: + return this.getName(); + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + return this.getStyles(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_PALETTE__NAME: + this.setName((String) newValue); + return; + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + this.getStyles().clear(); + this.getStyles().addAll((Collection) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_PALETTE__NAME: + this.setName(NAME_EDEFAULT); + return; + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + this.getStyles().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ViewPackage.TEXT_STYLE_PALETTE__NAME: + return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name); + case ViewPackage.TEXT_STYLE_PALETTE__STYLES: + return this.styles != null && !this.styles.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(')'); + return result.toString(); + } + +} // TextStylePaletteImpl diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java index 6eda799f5d4..8902e460a79 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewFactoryImpl.java @@ -27,6 +27,8 @@ import org.eclipse.sirius.components.view.If; import org.eclipse.sirius.components.view.Let; import org.eclipse.sirius.components.view.SetValue; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.UnsetValue; import org.eclipse.sirius.components.view.View; import org.eclipse.sirius.components.view.ViewFactory; @@ -94,6 +96,10 @@ public EObject create(EClass eClass) { return this.createIf(); case ViewPackage.FOR: return this.createFor(); + case ViewPackage.TEXT_STYLE_PALETTE: + return this.createTextStylePalette(); + case ViewPackage.TEXT_STYLE_DESCRIPTION: + return this.createTextStyleDescription(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -266,6 +272,28 @@ public For createFor() { return for_; } + /** + * + * + * @generated + */ + @Override + public TextStylePalette createTextStylePalette() { + TextStylePaletteImpl textStylePalette = new TextStylePaletteImpl(); + return textStylePalette; + } + + /** + * + * + * @generated + */ + @Override + public TextStyleDescription createTextStyleDescription() { + TextStyleDescriptionImpl textStyleDescription = new TextStyleDescriptionImpl(); + return textStyleDescription; + } + /** * * diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewImpl.java index 152b134a70d..4cbcd1815f8 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewImpl.java @@ -23,6 +23,7 @@ import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.components.view.ColorPalette; import org.eclipse.sirius.components.view.RepresentationDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.View; import org.eclipse.sirius.components.view.ViewPackage; @@ -34,6 +35,7 @@ *
      *
    • {@link org.eclipse.sirius.components.view.impl.ViewImpl#getDescriptions Descriptions}
    • *
    • {@link org.eclipse.sirius.components.view.impl.ViewImpl#getColorPalettes Color Palettes}
    • + *
    • {@link org.eclipse.sirius.components.view.impl.ViewImpl#getTextStylePalettes Text Style Palettes}
    • *
    * * @generated @@ -59,6 +61,16 @@ public class ViewImpl extends MinimalEObjectImpl.Container implements View { */ protected EList colorPalettes; + /** + * The cached value of the '{@link #getTextStylePalettes() Text Style Palettes}' containment reference + * list. + * + * @see #getTextStylePalettes() + * @generated + * @ordered + */ + protected EList textStylePalettes; + /** * * @@ -104,6 +116,19 @@ public EList getColorPalettes() { return this.colorPalettes; } + /** + * + * + * @generated + */ + @Override + public EList getTextStylePalettes() { + if (this.textStylePalettes == null) { + this.textStylePalettes = new EObjectContainmentEList<>(TextStylePalette.class, this, ViewPackage.VIEW__TEXT_STYLE_PALETTES); + } + return this.textStylePalettes; + } + /** * * @@ -116,6 +141,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return ((InternalEList) this.getDescriptions()).basicRemove(otherEnd, msgs); case ViewPackage.VIEW__COLOR_PALETTES: return ((InternalEList) this.getColorPalettes()).basicRemove(otherEnd, msgs); + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: + return ((InternalEList) this.getTextStylePalettes()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -132,6 +159,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getDescriptions(); case ViewPackage.VIEW__COLOR_PALETTES: return this.getColorPalettes(); + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: + return this.getTextStylePalettes(); } return super.eGet(featureID, resolve, coreType); } @@ -153,6 +182,10 @@ public void eSet(int featureID, Object newValue) { this.getColorPalettes().clear(); this.getColorPalettes().addAll((Collection) newValue); return; + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: + this.getTextStylePalettes().clear(); + this.getTextStylePalettes().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -171,6 +204,9 @@ public void eUnset(int featureID) { case ViewPackage.VIEW__COLOR_PALETTES: this.getColorPalettes().clear(); return; + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: + this.getTextStylePalettes().clear(); + return; } super.eUnset(featureID); } @@ -187,6 +223,8 @@ public boolean eIsSet(int featureID) { return this.descriptions != null && !this.descriptions.isEmpty(); case ViewPackage.VIEW__COLOR_PALETTES: return this.colorPalettes != null && !this.colorPalettes.isEmpty(); + case ViewPackage.VIEW__TEXT_STYLE_PALETTES: + return this.textStylePalettes != null && !this.textStylePalettes.isEmpty(); } return super.eIsSet(featureID); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java index 3eaec22679b..1d943438bf4 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ViewPackageImpl.java @@ -31,6 +31,8 @@ import org.eclipse.sirius.components.view.Operation; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.SetValue; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.UnsetValue; import org.eclipse.sirius.components.view.UserColor; import org.eclipse.sirius.components.view.View; @@ -155,6 +157,20 @@ public class ViewPackageImpl extends EPackageImpl implements ViewPackage { */ private EClass forEClass = null; + /** + * + * + * @generated + */ + private EClass textStylePaletteEClass = null; + + /** + * + * + * @generated + */ + private EClass textStyleDescriptionEClass = null; + /** * * @@ -281,6 +297,16 @@ public EReference getView_ColorPalettes() { return (EReference) this.viewEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EReference getView_TextStylePalettes() { + return (EReference) this.viewEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -711,6 +737,106 @@ public EAttribute getFor_IteratorName() { return (EAttribute) this.forEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EClass getTextStylePalette() { + return this.textStylePaletteEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStylePalette_Name() { + return (EAttribute) this.textStylePaletteEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EReference getTextStylePalette_Styles() { + return (EReference) this.textStylePaletteEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EClass getTextStyleDescription() { + return this.textStyleDescriptionEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_Name() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_ForegroundColorExpression() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_BackgroundColorExpression() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_IsBoldExpression() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_IsItalicExpression() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getTextStyleDescription_IsUnderlineExpression() { + return (EAttribute) this.textStyleDescriptionEClass.getEStructuralFeatures().get(5); + } + /** * * @@ -793,6 +919,7 @@ public void createPackageContents() { this.viewEClass = this.createEClass(VIEW); this.createEReference(this.viewEClass, VIEW__DESCRIPTIONS); this.createEReference(this.viewEClass, VIEW__COLOR_PALETTES); + this.createEReference(this.viewEClass, VIEW__TEXT_STYLE_PALETTES); this.colorPaletteEClass = this.createEClass(COLOR_PALETTE); this.createEAttribute(this.colorPaletteEClass, COLOR_PALETTE__NAME); @@ -852,6 +979,18 @@ public void createPackageContents() { this.createEAttribute(this.forEClass, FOR__EXPRESSION); this.createEAttribute(this.forEClass, FOR__ITERATOR_NAME); + this.textStylePaletteEClass = this.createEClass(TEXT_STYLE_PALETTE); + this.createEAttribute(this.textStylePaletteEClass, TEXT_STYLE_PALETTE__NAME); + this.createEReference(this.textStylePaletteEClass, TEXT_STYLE_PALETTE__STYLES); + + this.textStyleDescriptionEClass = this.createEClass(TEXT_STYLE_DESCRIPTION); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__NAME); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__FOREGROUND_COLOR_EXPRESSION); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__BACKGROUND_COLOR_EXPRESSION); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__IS_BOLD_EXPRESSION); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__IS_ITALIC_EXPRESSION); + this.createEAttribute(this.textStyleDescriptionEClass, TEXT_STYLE_DESCRIPTION__IS_UNDERLINE_EXPRESSION); + // Create data types this.identifierEDataType = this.createEDataType(IDENTIFIER); this.interpretedExpressionEDataType = this.createEDataType(INTERPRETED_EXPRESSION); @@ -906,6 +1045,9 @@ public void initializePackageContents() { this.initEReference(this.getView_ColorPalettes(), this.getColorPalette(), null, "colorPalettes", null, 0, -1, View.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.getView_ColorPalettes().getEKeys().add(this.getColorPalette_Name()); + this.initEReference(this.getView_TextStylePalettes(), this.getTextStylePalette(), null, "textStylePalettes", null, 0, -1, View.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, + !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.getView_TextStylePalettes().getEKeys().add(this.getTextStylePalette_Name()); this.initEClass(this.colorPaletteEClass, ColorPalette.class, "ColorPalette", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getColorPalette_Name(), this.getIdentifier(), "name", null, 1, 1, ColorPalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, @@ -994,6 +1136,27 @@ public void initializePackageContents() { this.initEAttribute(this.getFor_IteratorName(), this.ecorePackage.getEString(), "iteratorName", null, 1, 1, For.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEClass(this.textStylePaletteEClass, TextStylePalette.class, "TextStylePalette", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getTextStylePalette_Name(), this.getIdentifier(), "name", null, 1, 1, TextStylePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getTextStylePalette_Styles(), this.getTextStyleDescription(), null, "styles", null, 0, -1, TextStylePalette.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.getTextStylePalette_Styles().getEKeys().add(this.getTextStyleDescription_Name()); + + this.initEClass(this.textStyleDescriptionEClass, TextStyleDescription.class, "TextStyleDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEAttribute(this.getTextStyleDescription_Name(), this.getIdentifier(), "name", null, 1, 1, TextStyleDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTextStyleDescription_ForegroundColorExpression(), this.getInterpretedExpression(), "foregroundColorExpression", "", 0, 1, TextStyleDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTextStyleDescription_BackgroundColorExpression(), this.getInterpretedExpression(), "backgroundColorExpression", "", 0, 1, TextStyleDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTextStyleDescription_IsBoldExpression(), this.getInterpretedExpression(), "isBoldExpression", "aql:\'false\'", 0, 1, TextStyleDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTextStyleDescription_IsItalicExpression(), this.getInterpretedExpression(), "isItalicExpression", "aql:\'false\'", 0, 1, TextStyleDescription.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getTextStyleDescription_IsUnderlineExpression(), this.getInterpretedExpression(), "isUnderlineExpression", "aql:\'false\'", 0, 1, TextStyleDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Initialize data types this.initEDataType(this.identifierEDataType, String.class, "Identifier", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); this.initEDataType(this.interpretedExpressionEDataType, String.class, "InterpretedExpression", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java index 72fecd9457f..875cdb512ce 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewAdapterFactory.java @@ -29,6 +29,8 @@ import org.eclipse.sirius.components.view.Operation; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.SetValue; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.UnsetValue; import org.eclipse.sirius.components.view.UserColor; import org.eclipse.sirius.components.view.View; @@ -165,6 +167,16 @@ public Adapter caseFor(For object) { return ViewAdapterFactory.this.createForAdapter(); } + @Override + public Adapter caseTextStylePalette(TextStylePalette object) { + return ViewAdapterFactory.this.createTextStylePaletteAdapter(); + } + + @Override + public Adapter caseTextStyleDescription(TextStyleDescription object) { + return ViewAdapterFactory.this.createTextStyleDescriptionAdapter(); + } + @Override public Adapter defaultCase(EObject object) { return ViewAdapterFactory.this.createEObjectAdapter(); @@ -395,6 +407,34 @@ public Adapter createForAdapter() { return null; } + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.TextStylePalette Text + * Style Palette}'. 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.TextStylePalette + * @generated + */ + public Adapter createTextStylePaletteAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.TextStyleDescription + * Text Style Description}'. This default implementation returns null so that we + * can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.TextStyleDescription + * @generated + */ + public Adapter createTextStyleDescriptionAdapter() { + return null; + } + /** * Creates a new adapter for the default case. This default implementation returns null. * diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java index a36e2161535..f5a467ee385 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/util/ViewSwitch.java @@ -28,6 +28,8 @@ import org.eclipse.sirius.components.view.Operation; import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.SetValue; +import org.eclipse.sirius.components.view.TextStyleDescription; +import org.eclipse.sirius.components.view.TextStylePalette; import org.eclipse.sirius.components.view.UnsetValue; import org.eclipse.sirius.components.view.UserColor; import org.eclipse.sirius.components.view.View; @@ -214,6 +216,20 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case ViewPackage.TEXT_STYLE_PALETTE: { + TextStylePalette textStylePalette = (TextStylePalette) theEObject; + T result = this.caseTextStylePalette(textStylePalette); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } + case ViewPackage.TEXT_STYLE_DESCRIPTION: { + TextStyleDescription textStyleDescription = (TextStyleDescription) theEObject; + T result = this.caseTextStyleDescription(textStyleDescription); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } default: return this.defaultCase(theEObject); } @@ -447,6 +463,36 @@ public T caseFor(For object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'Text Style Palette'. 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 'Text Style Palette'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTextStylePalette(TextStylePalette object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Text Style Description'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Text Style Description'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTextStyleDescription(TextStyleDescription object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'EObject'. This * implementation returns null; returning a non-null result will terminate the switch, but this is the last case diff --git a/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore b/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore index e832bbad20b..77b00f650fb 100644 --- a/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore +++ b/packages/view/backend/sirius-components-view/src/main/resources/model/view.ecore @@ -11,6 +11,8 @@ eType="#//RepresentationDescription" containment="true" eKeys="#//RepresentationDescription/name"/> + @@ -94,4 +96,22 @@ + + + + + + + + + + + + diff --git a/packages/view/backend/sirius-components-view/src/main/resources/model/view.genmodel b/packages/view/backend/sirius-components-view/src/main/resources/model/view.genmodel index da2a2209410..844f36c3a4c 100644 --- a/packages/view/backend/sirius-components-view/src/main/resources/model/view.genmodel +++ b/packages/view/backend/sirius-components-view/src/main/resources/model/view.genmodel @@ -20,6 +20,7 @@ + @@ -78,5 +79,17 @@ + + + + + + + + + + + + diff --git a/scripts/check-coverage.jsh b/scripts/check-coverage.jsh index 32b7d772b3d..22a69ba2e6d 100644 --- a/scripts/check-coverage.jsh +++ b/scripts/check-coverage.jsh @@ -97,7 +97,9 @@ var moduleCoverageData = List.of( new ModuleCoverage("sirius-web-application", 93.0), new ModuleCoverage("sirius-web-infrastructure", 93.0), new ModuleCoverage("sirius-web-starter", 98.0), - new ModuleCoverage("sirius-web", 37.0) + new ModuleCoverage("sirius-web", 37.0), + new ModuleCoverage("sirius-components-view-tree", 0), + new ModuleCoverage("sirius-components-view-tree-edit", 0) ); void display(String module, double coverage, double expected) {