diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index d9909050a2..8c17ccd045 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -36,6 +36,9 @@ An absent/empty candidates expression now simply means the widget is empty. === New Features - https://github.com/eclipse-sirius/sirius-components/issues/2039[#2039] [project] A new "Blank Studio" project template is available to create a project with the "studio" nature but no initial content +- https://github.com/eclipse-sirius/sirius-components/issues/2004[#2004] [form] Add the possibility to show select options' icons. ++ +image:doc/screenshots/ShowIconOptionSelectWidget.jpg[Icons on select widget option,70%,30%] === Improvements diff --git a/doc/screenshots/ShowIconOptionSelectWidget.jpg b/doc/screenshots/ShowIconOptionSelectWidget.jpg new file mode 100644 index 0000000000..07038fec41 Binary files /dev/null and b/doc/screenshots/ShowIconOptionSelectWidget.jpg differ diff --git a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MonoValuedNonContainmentReferenceIfDescriptionProvider.java b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MonoValuedNonContainmentReferenceIfDescriptionProvider.java index e065c6467f..ad0db7a47b 100644 --- a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MonoValuedNonContainmentReferenceIfDescriptionProvider.java +++ b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MonoValuedNonContainmentReferenceIfDescriptionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Obeo. + * Copyright (c) 2019, 2023 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 @@ -90,6 +90,7 @@ private SelectDescription getSelectDescription() { .optionsProvider(this.getOptionsProvider()) .optionIdProvider(this.getOptionIdProvider()) .optionLabelProvider(this.getOptionLabelProvider()) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse("")) .newValueHandler(this.getNewValueHandler()) .diagnosticsProvider(this.propertiesValidationProvider.getDiagnosticsProvider()) .kindProvider(this.propertiesValidationProvider.getKindProvider()) diff --git a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MultiValuedNonContainmentReferenceIfDescriptionProvider.java b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MultiValuedNonContainmentReferenceIfDescriptionProvider.java index ea5e708667..532fc999bc 100644 --- a/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MultiValuedNonContainmentReferenceIfDescriptionProvider.java +++ b/packages/compatibility/backend/sirius-components-compatibility-emf/src/main/java/org/eclipse/sirius/components/compatibility/emf/properties/MultiValuedNonContainmentReferenceIfDescriptionProvider.java @@ -92,6 +92,7 @@ private MultiSelectDescription getMultiSelectDescription() { .optionsProvider(this.getOptionsProvider()) .optionIdProvider(this.getOptionIdProvider()) .optionLabelProvider(this.getOptionLabelProvider()) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse("")) .newValuesHandler(this.getNewValuesHandler()) .diagnosticsProvider(this.propertiesValidationProvider.getDiagnosticsProvider()) .kindProvider(this.propertiesValidationProvider.getKindProvider()) diff --git a/packages/compatibility/backend/sirius-components-compatibility/src/main/java/org/eclipse/sirius/components/compatibility/forms/WidgetDescriptionConverter.java b/packages/compatibility/backend/sirius-components-compatibility/src/main/java/org/eclipse/sirius/components/compatibility/forms/WidgetDescriptionConverter.java index 01696bbe53..2e45c7f713 100644 --- a/packages/compatibility/backend/sirius-components-compatibility/src/main/java/org/eclipse/sirius/components/compatibility/forms/WidgetDescriptionConverter.java +++ b/packages/compatibility/backend/sirius-components-compatibility/src/main/java/org/eclipse/sirius/components/compatibility/forms/WidgetDescriptionConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Obeo. + * Copyright (c) 2019, 2023 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 @@ -260,6 +260,7 @@ private SelectDescription convertSelect(org.eclipse.sirius.properties.SelectDesc .optionsProvider(optionsProvider) .optionIdProvider(optionIdProvider) .optionLabelProvider(optionLabelProvider) + .optionIconURLProvider(vm -> "") .newValueHandler(newValueHandler) .diagnosticsProvider(variableManager -> List.of()) .kindProvider(object -> "") diff --git a/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/ObjectService.java b/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/ObjectService.java index bd9457dec9..4e53faacc1 100644 --- a/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/ObjectService.java +++ b/packages/emf/backend/sirius-components-emf/src/main/java/org/eclipse/sirius/components/emf/services/ObjectService.java @@ -26,7 +26,6 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.DynamicEObjectImpl; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.edit.domain.EditingDomain; @@ -34,6 +33,7 @@ import org.eclipse.emf.edit.provider.ComposedImage; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.ReflectiveItemProvider; import org.eclipse.sirius.components.core.api.IEditingContext; import org.eclipse.sirius.components.core.api.IObjectService; import org.eclipse.sirius.components.emf.services.api.IEMFKindService; @@ -151,10 +151,10 @@ public String getFullLabel(Object object) { @Override public String getImagePath(Object object) { - if (object instanceof EObject eObject && !(object instanceof DynamicEObjectImpl)) { + if (object instanceof EObject eObject) { Adapter adapter = this.composedAdapterFactory.adapt(eObject, IItemLabelProvider.class); - if (adapter instanceof IItemLabelProvider labelProvider) { + if (adapter instanceof IItemLabelProvider labelProvider && !(adapter instanceof ReflectiveItemProvider)) { try { Object image = labelProvider.getImage(eObject); String imageFullPath = this.findImagePath(image); diff --git a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/MultiSelectStyleProvider.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/MultiSelectStyleProvider.java index 8e3b100621..2193bc5d6d 100644 --- a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/MultiSelectStyleProvider.java +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/MultiSelectStyleProvider.java @@ -55,6 +55,7 @@ public MultiSelectStyle build() { boolean bold = this.viewStyle.isBold(); boolean underline = this.viewStyle.isUnderline(); boolean strikeThrough = this.viewStyle.isStrikeThrough(); + boolean isShowIcon = this.viewStyle.isShowIcon(); // @formatter:off return multiSelectStyleBuilder @@ -63,6 +64,7 @@ public MultiSelectStyle build() { .bold(bold) .underline(underline) .strikeThrough(strikeThrough) + .showIcon(isShowIcon) .build(); // @formatter:on } diff --git a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/SelectStyleProvider.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/SelectStyleProvider.java index a59cc81424..71013f4ba3 100644 --- a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/SelectStyleProvider.java +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/SelectStyleProvider.java @@ -55,6 +55,7 @@ public SelectStyle build() { boolean bold = this.viewStyle.isBold(); boolean underline = this.viewStyle.isUnderline(); boolean strikeThrough = this.viewStyle.isStrikeThrough(); + boolean isShowIcon = this.viewStyle.isShowIcon(); // @formatter:off return selectStyleBuilder @@ -63,6 +64,7 @@ public SelectStyle build() { .bold(bold) .underline(underline) .strikeThrough(strikeThrough) + .showIcon(isShowIcon) .build(); // @formatter:on } diff --git a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java index 94a81d009c..c00c84b113 100644 --- a/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java +++ b/packages/formdescriptioneditors/backend/sirius-components-formdescriptioneditors/src/main/java/org/eclipse/sirius/components/formdescriptioneditors/components/ViewFormDescriptionEditorConverterSwitch.java @@ -167,6 +167,7 @@ public AbstractWidgetDescription caseSelectDescription(org.eclipse.sirius.compon .valueProvider(vm -> "") .optionIdProvider(vm -> "") .optionLabelProvider(vm -> "") + .optionIconURLProvider(vm -> "") .optionsProvider(vm -> List.of()) .newValueHandler((vm, value) -> new Success()) .diagnosticsProvider(vm -> List.of()) @@ -228,6 +229,7 @@ public AbstractWidgetDescription caseMultiSelectDescription(org.eclipse.sirius.c .valuesProvider(vm -> List.of()) .optionIdProvider(vm -> "") .optionLabelProvider(vm -> "") + .optionIconURLProvider(vm -> "") .optionsProvider(vm -> List.of()) .newValuesHandler((vm, values) -> new Success()) .diagnosticsProvider(vm -> List.of()) diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls index 81ed474a55..b7818d6711 100644 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls +++ b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls @@ -180,6 +180,7 @@ type Select implements Widget { type SelectOption { id: ID! label: String! + iconURL: String } type SelectStyle { diff --git a/packages/forms/backend/sirius-components-forms-graphql/pom.xml b/packages/forms/backend/sirius-components-forms-graphql/pom.xml index 51bdeec9c6..5f62ccae6c 100644 --- a/packages/forms/backend/sirius-components-forms-graphql/pom.xml +++ b/packages/forms/backend/sirius-components-forms-graphql/pom.xml @@ -58,6 +58,11 @@ sirius-components-annotations-spring 2023.6.1 + + org.eclipse.sirius + sirius-components-forms + 2023.6.1 + org.eclipse.sirius sirius-components-collaborative-forms diff --git a/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/form/SelectOptionIconURLDataFetcher.java b/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/form/SelectOptionIconURLDataFetcher.java new file mode 100644 index 0000000000..abb05b51f0 --- /dev/null +++ b/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/form/SelectOptionIconURLDataFetcher.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2023 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.forms.graphql.datafetchers.form; + +import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; +import org.eclipse.sirius.components.forms.SelectOption; +import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; +import org.eclipse.sirius.components.graphql.api.URLConstants; + +import graphql.schema.DataFetchingEnvironment; + +/** + * Data fetcher for SelectOption.iconURL, to rewrite the relative path of the image into an absolute path on the server. + *

+ * If the SelectOption.iconURL is of the form path/to/image.svg, the rewritten value which will + * be seen by the frontend will be /api/images/path/to/image.svg. + * + * @author mcharfadi + */ +@QueryDataFetcher(type = "SelectOption", field = "iconURL") +public class SelectOptionIconURLDataFetcher implements IDataFetcherWithFieldCoordinates { + + @Override + public String get(DataFetchingEnvironment environment) throws Exception { + SelectOption option = environment.getSource(); + String result = option.getIconURL(); + if (result != null && !result.isBlank()) { + result = URLConstants.IMAGE_BASE_PATH + result; + } + return result; + } +} diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/MultiSelectStyle.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/MultiSelectStyle.java index e338a7ad88..afbec6cd1c 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/MultiSelectStyle.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/MultiSelectStyle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Obeo. + * Copyright (c) 2022, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -29,6 +29,8 @@ public final class MultiSelectStyle extends AbstractFontStyle { private String foregroundColor; + private boolean showIcon; + private MultiSelectStyle() { // Prevent instantiation } @@ -41,14 +43,18 @@ public String getForegroundColor() { return this.foregroundColor; } + public boolean isShowIcon() { + return this.showIcon; + } + public static Builder newMultiSelectStyle() { return new Builder(); } @Override public String toString() { - String pattern = "{0} '{'backgroundColor: {1}, foregroundColor: {2}, fontSize: {3}, italic: {4}, bold: {5}, underline: {6}, strikeThrough: {7},'}'"; - return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.backgroundColor, this.foregroundColor, this.fontSize, this.italic, this.bold, this.underline, this.strikeThrough); + String pattern = "{0} '{'backgroundColor: {1}, foregroundColor: {2}, fontSize: {3}, italic: {4}, bold: {5}, underline: {6}, strikeThrough: {7}, isShowIcon: {8'}'}'"; + return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.backgroundColor, this.foregroundColor, this.fontSize, this.italic, this.bold, this.underline, this.strikeThrough, this.showIcon); } /** @@ -72,6 +78,8 @@ public static final class Builder { private boolean strikeThrough; + private boolean showIcon; + private Builder() { } @@ -100,6 +108,11 @@ public Builder bold(boolean bold) { return this; } + public Builder showIcon(boolean showIcon) { + this.showIcon = showIcon; + return this; + } + public Builder underline(boolean underline) { this.underline = underline; return this; @@ -119,6 +132,7 @@ public MultiSelectStyle build() { multiSelectStyle.bold = this.bold; multiSelectStyle.underline = this.underline; multiSelectStyle.strikeThrough = this.strikeThrough; + multiSelectStyle.showIcon = this.showIcon; return multiSelectStyle; } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectOption.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectOption.java index 2125549c4c..744ca8cebe 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectOption.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectOption.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 Obeo. + * Copyright (c) 2019, 2023 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 @@ -28,6 +28,8 @@ public final class SelectOption { private String label; + private String iconURL; + private SelectOption() { // Prevent instantiation } @@ -40,14 +42,18 @@ public String getLabel() { return this.label; } + public String getIconURL() { + return this.iconURL; + } + public static Builder newSelectOption(String id) { return new Builder(id); } @Override public String toString() { - String pattern = "{0} '{'id: {1}, label: {2}'}'"; - return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.label); + String pattern = "{0} '{'id: {1}, label: {2}', iconUrl: {3}'"; + return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.label, this.iconURL); } /** @@ -61,6 +67,8 @@ public static final class Builder { private String label; + private String iconURL; + private Builder(String id) { this.id = Objects.requireNonNull(id); } @@ -70,10 +78,16 @@ public Builder label(String label) { return this; } + public Builder iconURL(String iconURL) { + this.iconURL = iconURL; + return this; + } + public SelectOption build() { SelectOption selectOption = new SelectOption(); selectOption.id = Objects.requireNonNull(this.id); selectOption.label = Objects.requireNonNull(this.label); + selectOption.iconURL = this.iconURL; return selectOption; } } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectStyle.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectStyle.java index 7f48760884..ea90c41583 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectStyle.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/SelectStyle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Obeo. + * Copyright (c) 2022, 2023 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 @@ -28,6 +28,8 @@ public final class SelectStyle extends AbstractFontStyle { private String foregroundColor; + private boolean showIcon; + private SelectStyle() { // Prevent instantiation } @@ -40,14 +42,18 @@ public String getForegroundColor() { return this.foregroundColor; } + public boolean isShowIcon() { + return this.showIcon; + } + public static Builder newSelectStyle() { return new Builder(); } @Override public String toString() { - String pattern = "{0} '{'backgroundColor: {1}, foregroundColor: {2}, fontSize: {3}, italic: {4}, bold: {5}, underline: {6}, strikeThrough: {7},'}'"; - return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.backgroundColor, this.foregroundColor, this.fontSize, this.italic, this.bold, this.underline, this.strikeThrough); + String pattern = "{0} '{'backgroundColor: {1}, foregroundColor: {2}, fontSize: {3}, italic: {4}, bold: {5}, underline: {6}, strikeThrough: {7}, isShowIcon: {8'}'"; + return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.backgroundColor, this.foregroundColor, this.fontSize, this.italic, this.bold, this.underline, this.strikeThrough, this.showIcon); } /** @@ -71,6 +77,8 @@ public static final class Builder { private boolean strikeThrough; + private boolean showIcon; + private Builder() { } @@ -99,6 +107,11 @@ public Builder bold(boolean bold) { return this; } + public Builder showIcon(boolean showIcon) { + this.showIcon = showIcon; + return this; + } + public Builder underline(boolean underline) { this.underline = underline; return this; @@ -118,6 +131,7 @@ public SelectStyle build() { selectStyle.bold = this.bold; selectStyle.underline = this.underline; selectStyle.strikeThrough = this.strikeThrough; + selectStyle.showIcon = this.showIcon; return selectStyle; } diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/MultiSelectComponent.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/MultiSelectComponent.java index cdea78500c..b5e8b4dcb4 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/MultiSelectComponent.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/MultiSelectComponent.java @@ -54,6 +54,7 @@ public Element render() { String iconURL = multiSelectDescription.getIconURLProvider().apply(variableManager); List optionCandidates = multiSelectDescription.getOptionsProvider().apply(variableManager); List values = multiSelectDescription.getValuesProvider().apply(variableManager); + var multiSelectStyle = multiSelectDescription.getStyleProvider().apply(variableManager); List children = List.of(new Element(DiagnosticComponent.class, new DiagnosticComponentProps(multiSelectDescription, variableManager))); @@ -65,18 +66,21 @@ public Element render() { String optionId = multiSelectDescription.getOptionIdProvider().apply(optionVariableManager); String optionLabel = multiSelectDescription.getOptionLabelProvider().apply(optionVariableManager); - // @formatter:off - SelectOption option = SelectOption.newSelectOption(optionId) - .label(optionLabel) - .build(); - // @formatter:on + var selectOptionBuilder = SelectOption.newSelectOption(optionId) + .label(optionLabel); + if (multiSelectStyle != null && multiSelectStyle.isShowIcon()) { + String optionIconUrl = multiSelectDescription.getOptionIconURLProvider().apply(optionVariableManager); + if (optionIconUrl != null && !optionIconUrl.isBlank()) { + selectOptionBuilder.iconURL(optionIconUrl); + } + } + SelectOption option = selectOptionBuilder.build(); options.add(option); } Function, IStatus> newValuesHandler = newValues -> { return multiSelectDescription.getNewValuesHandler().apply(variableManager, newValues); }; - var multiSelectStyle = multiSelectDescription.getStyleProvider().apply(variableManager); // @formatter:off Builder multiSelectElementPropsBuilder = MultiSelectElementProps.newMultiSelectElementProps(id) diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/SelectComponent.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/SelectComponent.java index f9265902fe..ab8a34df75 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/SelectComponent.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/components/SelectComponent.java @@ -53,6 +53,7 @@ public Element render() { String iconURL = selectDescription.getIconURLProvider().apply(variableManager); List optionCandidates = selectDescription.getOptionsProvider().apply(variableManager); String value = selectDescription.getValueProvider().apply(variableManager); + var selectStyle = selectDescription.getStyleProvider().apply(variableManager); List children = List.of(new Element(DiagnosticComponent.class, new DiagnosticComponentProps(selectDescription, variableManager))); @@ -64,18 +65,21 @@ public Element render() { String optionId = selectDescription.getOptionIdProvider().apply(optionVariableManager); String optionLabel = selectDescription.getOptionLabelProvider().apply(optionVariableManager); - // @formatter:off - SelectOption option = SelectOption.newSelectOption(optionId) - .label(optionLabel) - .build(); - // @formatter:on + var selectOptionBuilder = SelectOption.newSelectOption(optionId) + .label(optionLabel); + if (selectStyle != null && selectStyle.isShowIcon()) { + String optionIconUrl = selectDescription.getOptionIconURLProvider().apply(optionVariableManager); + if (optionIconUrl != null && !optionIconUrl.isBlank()) { + selectOptionBuilder.iconURL(optionIconUrl); + } + } + SelectOption option = selectOptionBuilder.build(); options.add(option); } Function specializedHandler = newValue -> { return selectDescription.getNewValueHandler().apply(variableManager, newValue); }; - var selectStyle = selectDescription.getStyleProvider().apply(variableManager); // @formatter:off Builder selectElementPropsBuilder = SelectElementProps.newSelectElementProps(id) diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/MultiSelectDescription.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/MultiSelectDescription.java index d7e943fd6a..ebf9a7f914 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/MultiSelectDescription.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/MultiSelectDescription.java @@ -44,6 +44,8 @@ public final class MultiSelectDescription extends AbstractWidgetDescription { private Function optionLabelProvider; + private Function optionIconURLProvider; + private Function> valuesProvider; private BiFunction, IStatus> newValuesHandler; @@ -78,6 +80,10 @@ public Function getOptionLabelProvider() { return this.optionLabelProvider; } + public Function getOptionIconURLProvider() { + return this.optionIconURLProvider; + } + public Function> getValuesProvider() { return this.valuesProvider; } @@ -122,6 +128,8 @@ public static final class Builder { private Function optionLabelProvider; + private Function optionIconURLProvider = variableManager -> null; + private Function> valuesProvider; private BiFunction, IStatus> newValuesHandler; @@ -170,6 +178,11 @@ public Builder optionLabelProvider(Function optionLabel return this; } + public Builder optionIconURLProvider(Function optionIconURLProvider) { + this.optionIconURLProvider = Objects.requireNonNull(optionIconURLProvider); + return this; + } + public Builder valuesProvider(Function> valuesProvider) { this.valuesProvider = Objects.requireNonNull(valuesProvider); return this; @@ -214,6 +227,7 @@ public MultiSelectDescription build() { multiSelectDescription.optionsProvider = Objects.requireNonNull(this.optionsProvider); multiSelectDescription.optionIdProvider = Objects.requireNonNull(this.optionIdProvider); multiSelectDescription.optionLabelProvider = Objects.requireNonNull(this.optionLabelProvider); + multiSelectDescription.optionIconURLProvider = Objects.requireNonNull(this.optionIconURLProvider); multiSelectDescription.valuesProvider = Objects.requireNonNull(this.valuesProvider); multiSelectDescription.newValuesHandler = Objects.requireNonNull(this.newValuesHandler); multiSelectDescription.diagnosticsProvider = Objects.requireNonNull(this.diagnosticsProvider); diff --git a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/SelectDescription.java b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/SelectDescription.java index 34f1c59347..c23710ba2a 100644 --- a/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/SelectDescription.java +++ b/packages/forms/backend/sirius-components-forms/src/main/java/org/eclipse/sirius/components/forms/description/SelectDescription.java @@ -43,6 +43,8 @@ public final class SelectDescription extends AbstractWidgetDescription { private Function optionLabelProvider; + private Function optionIconURLProvider; + private Function valueProvider; private BiFunction newValueHandler; @@ -77,6 +79,10 @@ public Function getOptionLabelProvider() { return this.optionLabelProvider; } + public Function getOptionIconURLProvider() { + return this.optionIconURLProvider; + } + public Function getValueProvider() { return this.valueProvider; } @@ -120,6 +126,8 @@ public static final class Builder { private Function optionLabelProvider; + private Function optionIconURLProvider = variableManager -> null; + private Function valueProvider; private BiFunction newValueHandler; @@ -168,6 +176,11 @@ public Builder optionLabelProvider(Function optionLabel return this; } + public Builder optionIconURLProvider(Function optionIconURLProvider) { + this.optionIconURLProvider = Objects.requireNonNull(optionIconURLProvider); + return this; + } + public Builder valueProvider(Function valueProvider) { this.valueProvider = Objects.requireNonNull(valueProvider); return this; @@ -212,6 +225,7 @@ public SelectDescription build() { selectDescription.optionsProvider = Objects.requireNonNull(this.optionsProvider); selectDescription.optionIdProvider = Objects.requireNonNull(this.optionIdProvider); selectDescription.optionLabelProvider = Objects.requireNonNull(this.optionLabelProvider); + selectDescription.optionIconURLProvider = Objects.requireNonNull(this.optionIconURLProvider); selectDescription.valueProvider = Objects.requireNonNull(this.valueProvider); selectDescription.newValueHandler = Objects.requireNonNull(this.newValueHandler); selectDescription.diagnosticsProvider = Objects.requireNonNull(this.diagnosticsProvider); diff --git a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts index 21c0daeec4..c51385af58 100644 --- a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts +++ b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.ts @@ -98,6 +98,7 @@ export const widgetFields = (contributions: Array) => ` options { id label + iconURL } style { backgroundColor @@ -117,6 +118,7 @@ export const widgetFields = (contributions: Array) => ` options { id label + iconURL } style { backgroundColor diff --git a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.types.ts b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.types.ts index 779b484d82..f3cfbb41f2 100644 --- a/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/form/FormEventFragments.types.ts @@ -207,6 +207,7 @@ export interface GQLMultiSelectStyle { export interface GQLSelectOption { id: string; label: string; + iconURL: string; } export interface GQLRadio extends GQLWidget { diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx index 71f5eb4737..d86fa03ced 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx @@ -11,15 +11,16 @@ * Obeo - initial API and implementation *******************************************************************************/ import { gql, useMutation } from '@apollo/client'; -import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; +import { ServerContext, useMultiToast } from '@eclipse-sirius/sirius-components-core'; import Checkbox from '@material-ui/core/Checkbox'; import FormControl from '@material-ui/core/FormControl'; import FormHelperText from '@material-ui/core/FormHelperText'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import MenuItem from '@material-ui/core/MenuItem'; import Select from '@material-ui/core/Select'; import { Theme, makeStyles } from '@material-ui/core/styles'; -import { useEffect, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import { GQLEditMultiSelectMutationData, GQLEditMultiSelectPayload, @@ -33,7 +34,7 @@ import { import { PropertySectionLabel } from './PropertySectionLabel'; import { getTextDecorationLineValue } from './getTextDecorationLineValue'; -const useStyle = makeStyles(() => ({ +const useStyle = makeStyles((theme) => ({ style: { backgroundColor: ({ backgroundColor }) => (backgroundColor ? backgroundColor : 'inherit'), color: ({ foregroundColor }) => (foregroundColor ? foregroundColor : 'inherit'), @@ -42,6 +43,13 @@ const useStyle = makeStyles(() => ({ fontWeight: ({ bold }) => (bold ? 'bold' : 'inherit'), textDecorationLine: ({ underline, strikeThrough }) => getTextDecorationLineValue(underline, strikeThrough), }, + icon: { + width: '16px', + height: '16px', + }, + iconRoot: { + minWidth: theme.spacing(3), + }, })); export const editMultiSelectMutation = gql` @@ -102,6 +110,8 @@ export const MultiSelectPropertySection = ({ }; const classes = useStyle(props); + const { httpOrigin } = useContext(ServerContext); + const [isFocused, setFocus] = useState(false); const [editMultiSelect, { loading, error, data }] = @@ -214,6 +224,11 @@ export const MultiSelectPropertySection = ({ {widget.options.map((option) => ( -1} /> + {option.iconURL && ( + + {option.label} + + )} (() => ({ +const useStyle = makeStyles((theme) => ({ style: { backgroundColor: ({ backgroundColor }) => (backgroundColor ? backgroundColor : 'inherit'), color: ({ foregroundColor }) => (foregroundColor ? foregroundColor : 'inherit'), @@ -39,6 +40,13 @@ const useStyle = makeStyles(() => ({ fontWeight: ({ bold }) => (bold ? 'bold' : 'inherit'), textDecorationLine: ({ underline, strikeThrough }) => getTextDecorationLineValue(underline, strikeThrough), }, + icon: { + width: '16px', + height: '16px', + }, + iconRoot: { + minWidth: theme.spacing(3), + }, })); export const editSelectMutation = gql` @@ -98,6 +106,8 @@ export const SelectPropertySection = ({ }; const classes = useStyle(props); + const { httpOrigin } = useContext(ServerContext); + const [isFocused, setFocus] = useState(false); const [editSelect, { loading, error, data }] = useMutation(editSelectMutation); @@ -219,6 +229,12 @@ export const SelectPropertySection = ({ } : {} }> + {option.iconURL && ( + + {option.label} + + )} + {option.label} ))} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/MultiSelectPropertySection.test.tsx.snap b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/MultiSelectPropertySection.test.tsx.snap index 27d18ccf8c..fa88bd023b 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/MultiSelectPropertySection.test.tsx.snap +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/__tests__/__snapshots__/MultiSelectPropertySection.test.tsx.snap @@ -7,7 +7,7 @@ exports[`should render the multiSelect help hint 1`] = ` class="MuiFormControl-root" >

@@ -133,7 +133,7 @@ exports[`should render the multiSelect with style 1`] = ` class="MuiFormControl-root" >
@@ -190,7 +190,7 @@ exports[`should render the multiSelect without style 1`] = ` class="MuiFormControl-root" >
@@ -64,7 +64,7 @@ exports[`should render the select with help hint 1`] = ` class="MuiFormControl-root" >
@@ -190,7 +190,7 @@ exports[`should render the select without style 1`] = ` class="MuiFormControl-root" >
getPropertyDescriptors(Object object) { this.addStrikeThroughPropertyDescriptor(object); this.addBackgroundColorPropertyDescriptor(object); this.addForegroundColorPropertyDescriptor(object); + this.addShowIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -141,6 +142,18 @@ protected void addForegroundColorPropertyDescriptor(Object object) { ViewPackage.Literals.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, true, false, false, null, null, null)); } + /** + * This adds a property descriptor for the Show Icon feature. + * + * @generated + */ + protected void addShowIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_MultiSelectDescriptionStyle_showIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_MultiSelectDescriptionStyle_showIcon_feature", "_UI_MultiSelectDescriptionStyle_type"), + ViewPackage.Literals.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); + } + /** * This returns ConditionalMultiSelectDescriptionStyle.gif. * @@ -192,6 +205,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__STRIKE_THROUGH: case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR: case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalSelectDescriptionStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalSelectDescriptionStyleItemProvider.java index 6f32478678..6a555b5dab 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalSelectDescriptionStyleItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalSelectDescriptionStyleItemProvider.java @@ -57,6 +57,7 @@ public List getPropertyDescriptors(Object object) { this.addStrikeThroughPropertyDescriptor(object); this.addBackgroundColorPropertyDescriptor(object); this.addForegroundColorPropertyDescriptor(object); + this.addShowIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -140,6 +141,18 @@ protected void addForegroundColorPropertyDescriptor(Object object) { ViewPackage.Literals.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, true, false, false, null, null, null)); } + /** + * This adds a property descriptor for the Show Icon feature. + * + * @generated + */ + protected void addShowIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_SelectDescriptionStyle_showIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_SelectDescriptionStyle_showIcon_feature", "_UI_SelectDescriptionStyle_type"), + ViewPackage.Literals.SELECT_DESCRIPTION_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); + } + /** * This returns ConditionalSelectDescriptionStyle.gif. * @@ -190,6 +203,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__STRIKE_THROUGH: case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR: case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/MultiSelectDescriptionStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/MultiSelectDescriptionStyleItemProvider.java index 49dc122ff4..0541ffb85a 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/MultiSelectDescriptionStyleItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/MultiSelectDescriptionStyleItemProvider.java @@ -57,6 +57,7 @@ public List getPropertyDescriptors(Object object) { this.addStrikeThroughPropertyDescriptor(object); this.addBackgroundColorPropertyDescriptor(object); this.addForegroundColorPropertyDescriptor(object); + this.addShowIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -140,6 +141,18 @@ protected void addForegroundColorPropertyDescriptor(Object object) { ViewPackage.Literals.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, true, false, false, null, null, null)); } + /** + * This adds a property descriptor for the Show Icon feature. + * + * @generated + */ + protected void addShowIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_MultiSelectDescriptionStyle_showIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_MultiSelectDescriptionStyle_showIcon_feature", "_UI_MultiSelectDescriptionStyle_type"), + ViewPackage.Literals.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); + } + /** * This returns MultiSelectDescriptionStyle.gif. * @@ -190,6 +203,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__STRIKE_THROUGH: case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR: case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/SelectDescriptionStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/SelectDescriptionStyleItemProvider.java index 44fd510545..071773e564 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/SelectDescriptionStyleItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/SelectDescriptionStyleItemProvider.java @@ -57,6 +57,7 @@ public List getPropertyDescriptors(Object object) { this.addStrikeThroughPropertyDescriptor(object); this.addBackgroundColorPropertyDescriptor(object); this.addForegroundColorPropertyDescriptor(object); + this.addShowIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -140,6 +141,18 @@ protected void addForegroundColorPropertyDescriptor(Object object) { ViewPackage.Literals.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, true, false, false, null, null, null)); } + /** + * This adds a property descriptor for the Show Icon feature. + * + * @generated + */ + protected void addShowIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_SelectDescriptionStyle_showIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_SelectDescriptionStyle_showIcon_feature", "_UI_SelectDescriptionStyle_type"), + ViewPackage.Literals.SELECT_DESCRIPTION_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); + } + /** * This returns SelectDescriptionStyle.gif. * @@ -190,6 +203,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.SELECT_DESCRIPTION_STYLE__STRIKE_THROUGH: case ViewPackage.SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR: case ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } 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 568567f29b..b44382dadd 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 @@ -280,8 +280,10 @@ _UI_TextfieldDescriptionStyle_foregroundColor_feature = Foreground Color _UI_CheckboxDescriptionStyle_color_feature = Color _UI_SelectDescriptionStyle_backgroundColor_feature = Background Color _UI_SelectDescriptionStyle_foregroundColor_feature = Foreground Color +_UI_SelectDescriptionStyle_showIcon_feature = Show Icon _UI_MultiSelectDescriptionStyle_backgroundColor_feature = Background Color _UI_MultiSelectDescriptionStyle_foregroundColor_feature = Foreground Color +_UI_MultiSelectDescriptionStyle_showIcon_feature = Show Icon _UI_TextareaDescriptionStyle_backgroundColor_feature = Background Color _UI_TextareaDescriptionStyle_foregroundColor_feature = Foreground Color _UI_RadioDescriptionStyle_color_feature = Color diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/NodeStylePropertiesConfigurer.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/NodeStylePropertiesConfigurer.java index 8d6aba55e7..3e22257f2c 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/NodeStylePropertiesConfigurer.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/NodeStylePropertiesConfigurer.java @@ -35,6 +35,7 @@ import org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistryConfigurer; import org.eclipse.sirius.components.collaborative.validation.api.IValidationService; import org.eclipse.sirius.components.core.api.IEditingContext; +import org.eclipse.sirius.components.core.api.IObjectService; import org.eclipse.sirius.components.emf.services.EditingContext; import org.eclipse.sirius.components.forms.components.SelectComponent; import org.eclipse.sirius.components.forms.description.AbstractControlDescription; @@ -85,12 +86,15 @@ public class NodeStylePropertiesConfigurer implements IPropertiesDescriptionRegi private final AQLTextfieldCustomizer aqlTextfieldCustomizer; + private final IObjectService objectService; + public NodeStylePropertiesConfigurer(ICustomImageMetadataSearchService customImageSearchService, IValidationService validationService, - List parametricSVGImageRegistries, AQLTextfieldCustomizer aqlTextfieldCustomizer) { + List parametricSVGImageRegistries, AQLTextfieldCustomizer aqlTextfieldCustomizer, IObjectService objectService) { this.validationService = Objects.requireNonNull(validationService); this.customImageSearchService = Objects.requireNonNull(customImageSearchService); this.parametricSVGImageRegistries = parametricSVGImageRegistries; this.aqlTextfieldCustomizer = Objects.requireNonNull(aqlTextfieldCustomizer); + this.objectService = Objects.requireNonNull(objectService); } @Override @@ -337,6 +341,7 @@ private SelectDescription createBorderLineStyleSelectionField(String id, Object .optionsProvider(variableManager -> LineStyle.VALUES.stream().toList()) .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, LineStyle.class).map(LineStyle::getLiteral).orElse(EMPTY)) .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, LineStyle.class).map(LineStyle::getName).orElse(EMPTY)) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse("")) .newValueHandler((variableManager, newValue) -> { var optionalBorderStyle = variableManager.get(VariableManager.SELF, BorderStyle.class); if (optionalBorderStyle.isPresent()) { @@ -372,6 +377,7 @@ private SelectDescription createUserColorSelectionField(String id, String la .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, UserColor.class) .map(UserColor::getName) .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse("")) .newValueHandler((variableManager, newValue) -> variableManager.get(VariableManager.SELF, styleType) .map((style) -> { @@ -435,6 +441,7 @@ private SelectDescription createShapeSelectionField(Object feature) { .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) .map(CustomImageMetadata::getLabel) .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse("")) .newValueHandler(this.getNewShapeValueHandler()) .diagnosticsProvider(this.getDiagnosticsProvider(feature)) .kindProvider(this::kindProvider) diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/MultiSelectStyleProvider.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/MultiSelectStyleProvider.java index 7ade691052..116d30bfbe 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/MultiSelectStyleProvider.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/MultiSelectStyleProvider.java @@ -57,6 +57,7 @@ public MultiSelectStyle apply(VariableManager variableManager) { boolean bold = this.viewStyle.isBold(); boolean underline = this.viewStyle.isUnderline(); boolean strikeThrough = this.viewStyle.isStrikeThrough(); + boolean isShowIcon = this.viewStyle.isShowIcon(); // @formatter:off return multiSelectStyleBuilder @@ -65,6 +66,7 @@ public MultiSelectStyle apply(VariableManager variableManager) { .bold(bold) .underline(underline) .strikeThrough(strikeThrough) + .showIcon(isShowIcon) .build(); // @formatter:on } diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/SelectStyleProvider.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/SelectStyleProvider.java index 433efdd35d..849037631c 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/SelectStyleProvider.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/SelectStyleProvider.java @@ -57,6 +57,7 @@ public SelectStyle apply(VariableManager variableManager) { boolean bold = this.viewStyle.isBold(); boolean underline = this.viewStyle.isUnderline(); boolean strikeThrough = this.viewStyle.isStrikeThrough(); + boolean isShowIcon = this.viewStyle.isShowIcon(); // @formatter:off return selectStyleBuilder @@ -65,6 +66,7 @@ public SelectStyle apply(VariableManager variableManager) { .bold(bold) .underline(underline) .strikeThrough(strikeThrough) + .showIcon(isShowIcon) .build(); // @formatter:on } diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java index 597db0c0b4..1241478f68 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/form/ViewFormDescriptionConverterSwitch.java @@ -190,6 +190,7 @@ public AbstractWidgetDescription caseSelectDescription(org.eclipse.sirius.compon String descriptionId = this.getDescriptionId(viewSelectDescription); WidgetIdProvider idProvider = new WidgetIdProvider(); StringValueProvider labelProvider = this.getStringValueProvider(viewSelectDescription.getLabelExpression()); + Function optionIconURLProvider = this.getOptionIconURLProvider(); Function valueProvider = this.getSelectValueProvider(viewSelectDescription.getValueExpression()); Function optionIdProvider = this.getOptionIdProvider(); StringValueProvider optionLabelProvider = this.getStringValueProvider(viewSelectDescription.getCandidateLabelExpression()); @@ -215,6 +216,7 @@ public AbstractWidgetDescription caseSelectDescription(org.eclipse.sirius.compon .optionIdProvider(optionIdProvider) .optionLabelProvider(optionLabelProvider) .optionsProvider(optionsProvider) + .optionIconURLProvider(optionIconURLProvider) .newValueHandler(selectNewValueHandler) .diagnosticsProvider(variableManager -> List.of()) .kindProvider(diagnostic -> "") @@ -287,6 +289,7 @@ public AbstractWidgetDescription caseMultiSelectDescription(org.eclipse.sirius.c String descriptionId = this.getDescriptionId(multiSelectDescription); WidgetIdProvider idProvider = new WidgetIdProvider(); StringValueProvider labelProvider = this.getStringValueProvider(multiSelectDescription.getLabelExpression()); + Function optionIconURLProvider = this.getOptionIconURLProvider(); Function> valuesProvider = this.getMultiSelectValuesProvider(multiSelectDescription.getValueExpression()); Function optionIdProvider = this.getOptionIdProvider(); StringValueProvider optionLabelProvider = this.getStringValueProvider(multiSelectDescription.getCandidateLabelExpression()); @@ -311,6 +314,7 @@ public AbstractWidgetDescription caseMultiSelectDescription(org.eclipse.sirius.c .valuesProvider(valuesProvider) .optionIdProvider(optionIdProvider) .optionLabelProvider(optionLabelProvider) + .optionIconURLProvider(optionIconURLProvider) .optionsProvider(optionsProvider) .newValuesHandler(multiSelectNewValueHandler) .diagnosticsProvider(variableManager -> List.of()) @@ -783,6 +787,10 @@ private BiFunction getSelectNewValueHandler(Li }; } + private Function getOptionIconURLProvider() { + return variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, Object.class).map(this.objectService::getImagePath).orElse(""); + } + private String getDescriptionId(EObject description) { String descriptionURI = EcoreUtil.getURI(description).toString(); return UUID.nameUUIDFromBytes(descriptionURI.getBytes()).toString(); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/MultiSelectDescriptionStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/MultiSelectDescriptionStyle.java index abdc33a112..8e2b10d278 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/MultiSelectDescriptionStyle.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/MultiSelectDescriptionStyle.java @@ -24,6 +24,7 @@ * Color} *
  • {@link org.eclipse.sirius.components.view.MultiSelectDescriptionStyle#getForegroundColor Foreground * Color}
  • + *
  • {@link org.eclipse.sirius.components.view.MultiSelectDescriptionStyle#isShowIcon Show Icon}
  • * * * @see org.eclipse.sirius.components.view.ViewPackage#getMultiSelectDescriptionStyle() @@ -77,4 +78,26 @@ public interface MultiSelectDescriptionStyle extends WidgetDescriptionStyle, Lab */ void setForegroundColor(UserColor value); + /** + * Returns the value of the 'Show Icon' attribute. + * + * @return the value of the 'Show Icon' attribute. + * @see #setShowIcon(boolean) + * @see org.eclipse.sirius.components.view.ViewPackage#getMultiSelectDescriptionStyle_ShowIcon() + * @model + * @generated + */ + boolean isShowIcon(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.MultiSelectDescriptionStyle#isShowIcon Show + * Icon}' attribute. + * + * @param value + * the new value of the 'Show Icon' attribute. + * @see #isShowIcon() + * @generated + */ + void setShowIcon(boolean value); + } // MultiSelectDescriptionStyle diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/SelectDescriptionStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/SelectDescriptionStyle.java index 348957a23d..32f10183c5 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/SelectDescriptionStyle.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/SelectDescriptionStyle.java @@ -24,6 +24,7 @@ * Color} *
  • {@link org.eclipse.sirius.components.view.SelectDescriptionStyle#getForegroundColor Foreground * Color}
  • + *
  • {@link org.eclipse.sirius.components.view.SelectDescriptionStyle#isShowIcon Show Icon}
  • * * * @see org.eclipse.sirius.components.view.ViewPackage#getSelectDescriptionStyle() @@ -77,4 +78,26 @@ public interface SelectDescriptionStyle extends WidgetDescriptionStyle, LabelSty */ void setForegroundColor(UserColor value); + /** + * Returns the value of the 'Show Icon' attribute. + * + * @return the value of the 'Show Icon' attribute. + * @see #setShowIcon(boolean) + * @see org.eclipse.sirius.components.view.ViewPackage#getSelectDescriptionStyle_ShowIcon() + * @model + * @generated + */ + boolean isShowIcon(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.SelectDescriptionStyle#isShowIcon Show + * Icon}' attribute. + * + * @param value + * the new value of the 'Show Icon' attribute. + * @see #isShowIcon() + * @generated + */ + void setShowIcon(boolean value); + } // SelectDescriptionStyle 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 676c80b4f4..30e520a6f2 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 @@ -4535,6 +4535,14 @@ public interface ViewPackage extends EPackage { */ int SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 6; + /** + * The feature id for the 'Show Icon' attribute. + * + * @generated + * @ordered + */ + int SELECT_DESCRIPTION_STYLE__SHOW_ICON = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 7; + /** * The number of structural features of the 'Select Description Style' class. @@ -4542,7 +4550,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 7; + int SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 8; /** * The number of operations of the 'Select Description Style' class. + * + * @generated + * @ordered + */ + int CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON = CONDITIONAL_FEATURE_COUNT + 7; + /** * The number of structural features of the 'Conditional Select Description Style' class. @@ -4636,7 +4652,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int CONDITIONAL_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 7; + int CONDITIONAL_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 8; /** * The number of operations of the 'Conditional Select Description Style' class. @@ -4715,6 +4731,14 @@ public interface ViewPackage extends EPackage { */ int MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 6; + /** + * The feature id for the 'Show Icon' attribute. + * + * @generated + * @ordered + */ + int MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 7; + /** * The number of structural features of the 'Multi Select Description Style' class. * @@ -4722,7 +4746,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int MULTI_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 7; + int MULTI_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = WIDGET_DESCRIPTION_STYLE_FEATURE_COUNT + 8; /** * The number of operations of the 'Multi Select Description Style' class. + * + * @generated + * @ordered + */ + int CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON = CONDITIONAL_FEATURE_COUNT + 7; + /** * The number of structural features of the 'Conditional Multi Select Description Style' class. @@ -4817,7 +4849,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 7; + int CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 8; /** * The number of operations of the 'Conditional Multi Select Description Style' class. + * + * @return the meta object for the attribute 'Show Icon'. + * @see org.eclipse.sirius.components.view.SelectDescriptionStyle#isShowIcon() + * @see #getSelectDescriptionStyle() + * @generated + */ + EAttribute getSelectDescriptionStyle_ShowIcon(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.ConditionalSelectDescriptionStyle * Conditional Select Description Style}'. @@ -9317,6 +9361,18 @@ public interface ViewPackage extends EPackage { */ EReference getMultiSelectDescriptionStyle_ForegroundColor(); + /** + * Returns the meta object for the attribute + * '{@link org.eclipse.sirius.components.view.MultiSelectDescriptionStyle#isShowIcon Show Icon}'. + * + * @return the meta object for the attribute 'Show Icon'. + * @see org.eclipse.sirius.components.view.MultiSelectDescriptionStyle#isShowIcon() + * @see #getMultiSelectDescriptionStyle() + * @generated + */ + EAttribute getMultiSelectDescriptionStyle_ShowIcon(); + /** * Returns the meta object for class * '{@link org.eclipse.sirius.components.view.ConditionalMultiSelectDescriptionStyle Conditional Multi Select @@ -12044,6 +12100,14 @@ interface Literals { */ EReference SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR = eINSTANCE.getSelectDescriptionStyle_ForegroundColor(); + /** + * The meta object literal for the 'Show Icon' attribute feature. + * + * @generated + */ + EAttribute SELECT_DESCRIPTION_STYLE__SHOW_ICON = eINSTANCE.getSelectDescriptionStyle_ShowIcon(); + /** * The meta object literal for the * '{@link org.eclipse.sirius.components.view.impl.ConditionalSelectDescriptionStyleImpl Conditional Select @@ -12082,6 +12146,14 @@ interface Literals { */ EReference MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR = eINSTANCE.getMultiSelectDescriptionStyle_ForegroundColor(); + /** + * The meta object literal for the 'Show Icon' attribute feature. + * + * @generated + */ + EAttribute MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON = eINSTANCE.getMultiSelectDescriptionStyle_ShowIcon(); + /** * The meta object literal for the * '{@link org.eclipse.sirius.components.view.impl.ConditionalMultiSelectDescriptionStyleImpl Conditional diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalMultiSelectDescriptionStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalMultiSelectDescriptionStyleImpl.java index d5d2cebe76..1eb6167816 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalMultiSelectDescriptionStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalMultiSelectDescriptionStyleImpl.java @@ -44,6 +44,8 @@ * Background Color} *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalMultiSelectDescriptionStyleImpl#getForegroundColor * Foreground Color}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalMultiSelectDescriptionStyleImpl#isShowIcon Show + * Icon}
  • * * * @generated @@ -169,6 +171,26 @@ public class ConditionalMultiSelectDescriptionStyleImpl extends ConditionalImpl */ protected UserColor foregroundColor; + /** + * The default value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected static final boolean SHOW_ICON_EDEFAULT = false; + + /** + * The cached value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** * * @@ -383,6 +405,29 @@ public void setForegroundColor(UserColor newForegroundColor) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, oldForegroundColor, this.foregroundColor)); } + /** + * + * + * @generated + */ + @Override + public boolean isShowIcon() { + return this.showIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setShowIcon(boolean newShowIcon) { + boolean oldShowIcon = this.showIcon; + this.showIcon = newShowIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); + } + /** * * @@ -409,6 +454,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { if (resolve) return this.getForegroundColor(); return this.basicGetForegroundColor(); + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.isShowIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -442,6 +489,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) newValue); return; + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon((Boolean) newValue); + return; } super.eSet(featureID, newValue); } @@ -475,6 +525,9 @@ public void eUnset(int featureID) { case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) null); return; + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon(SHOW_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -501,6 +554,8 @@ public boolean eIsSet(int featureID) { return this.backgroundColor != null; case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return this.foregroundColor != null; + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.showIcon != SHOW_ICON_EDEFAULT; } return super.eIsSet(featureID); } @@ -540,6 +595,8 @@ public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { return ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR; case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR; + case ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON; default: return -1; } @@ -582,6 +639,8 @@ public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { return ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR; case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR; + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return ViewPackage.CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON; default: return -1; } @@ -610,6 +669,8 @@ public String toString() { result.append(this.underline); result.append(", strikeThrough: "); result.append(this.strikeThrough); + result.append(", showIcon: "); + result.append(this.showIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalSelectDescriptionStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalSelectDescriptionStyleImpl.java index 54dcdec16b..74db5ea72b 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalSelectDescriptionStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalSelectDescriptionStyleImpl.java @@ -43,6 +43,8 @@ * Background Color} *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalSelectDescriptionStyleImpl#getForegroundColor * Foreground Color}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalSelectDescriptionStyleImpl#isShowIcon Show + * Icon}
  • * * * @generated @@ -168,6 +170,26 @@ public class ConditionalSelectDescriptionStyleImpl extends ConditionalImpl imple */ protected UserColor foregroundColor; + /** + * The default value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected static final boolean SHOW_ICON_EDEFAULT = false; + + /** + * The cached value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** * * @@ -382,6 +404,29 @@ public void setForegroundColor(UserColor newForegroundColor) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, oldForegroundColor, this.foregroundColor)); } + /** + * + * + * @generated + */ + @Override + public boolean isShowIcon() { + return this.showIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setShowIcon(boolean newShowIcon) { + boolean oldShowIcon = this.showIcon; + this.showIcon = newShowIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); + } + /** * * @@ -408,6 +453,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { if (resolve) return this.getForegroundColor(); return this.basicGetForegroundColor(); + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.isShowIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -441,6 +488,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) newValue); return; + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon((Boolean) newValue); + return; } super.eSet(featureID, newValue); } @@ -474,6 +524,9 @@ public void eUnset(int featureID) { case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) null); return; + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon(SHOW_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -500,6 +553,8 @@ public boolean eIsSet(int featureID) { return this.backgroundColor != null; case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return this.foregroundColor != null; + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.showIcon != SHOW_ICON_EDEFAULT; } return super.eIsSet(featureID); } @@ -539,6 +594,8 @@ public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { return ViewPackage.SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR; case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR; + case ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON; default: return -1; } @@ -581,6 +638,8 @@ public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { return ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR; case ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR; + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return ViewPackage.CONDITIONAL_SELECT_DESCRIPTION_STYLE__SHOW_ICON; default: return -1; } @@ -609,6 +668,8 @@ public String toString() { result.append(this.underline); result.append(", strikeThrough: "); result.append(this.strikeThrough); + result.append(", showIcon: "); + result.append(this.showIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/MultiSelectDescriptionStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/MultiSelectDescriptionStyleImpl.java index 2e9202ee03..b26544fe10 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/MultiSelectDescriptionStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/MultiSelectDescriptionStyleImpl.java @@ -40,6 +40,8 @@ * Color
    } *
  • {@link org.eclipse.sirius.components.view.impl.MultiSelectDescriptionStyleImpl#getForegroundColor Foreground * Color}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.MultiSelectDescriptionStyleImpl#isShowIcon Show + * Icon}
  • * * * @generated @@ -165,6 +167,26 @@ public class MultiSelectDescriptionStyleImpl extends WidgetDescriptionStyleImpl */ protected UserColor foregroundColor; + /** + * The default value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected static final boolean SHOW_ICON_EDEFAULT = false; + + /** + * The cached value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** * * @@ -379,6 +401,29 @@ public void setForegroundColor(UserColor newForegroundColor) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, oldForegroundColor, this.foregroundColor)); } + /** + * + * + * @generated + */ + @Override + public boolean isShowIcon() { + return this.showIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setShowIcon(boolean newShowIcon) { + boolean oldShowIcon = this.showIcon; + this.showIcon = newShowIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); + } + /** * * @@ -405,6 +450,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { if (resolve) return this.getForegroundColor(); return this.basicGetForegroundColor(); + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.isShowIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -438,6 +485,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) newValue); return; + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon((Boolean) newValue); + return; } super.eSet(featureID, newValue); } @@ -471,6 +521,9 @@ public void eUnset(int featureID) { case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) null); return; + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon(SHOW_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -497,6 +550,8 @@ public boolean eIsSet(int featureID) { return this.backgroundColor != null; case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return this.foregroundColor != null; + case ViewPackage.MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.showIcon != SHOW_ICON_EDEFAULT; } return super.eIsSet(featureID); } @@ -574,6 +629,8 @@ public String toString() { result.append(this.underline); result.append(", strikeThrough: "); result.append(this.strikeThrough); + result.append(", showIcon: "); + result.append(this.showIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/SelectDescriptionStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/SelectDescriptionStyleImpl.java index a221f283fe..1d7e28b4c3 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/SelectDescriptionStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/SelectDescriptionStyleImpl.java @@ -38,6 +38,7 @@ * Color
    } *
  • {@link org.eclipse.sirius.components.view.impl.SelectDescriptionStyleImpl#getForegroundColor Foreground * Color}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.SelectDescriptionStyleImpl#isShowIcon Show Icon}
  • * * * @generated @@ -163,6 +164,26 @@ public class SelectDescriptionStyleImpl extends WidgetDescriptionStyleImpl imple */ protected UserColor foregroundColor; + /** + * The default value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected static final boolean SHOW_ICON_EDEFAULT = false; + + /** + * The cached value of the '{@link #isShowIcon() Show Icon}' attribute. + * + * @see #isShowIcon() + * @generated + * @ordered + */ + protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** * * @@ -377,6 +398,29 @@ public void setForegroundColor(UserColor newForegroundColor) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR, oldForegroundColor, this.foregroundColor)); } + /** + * + * + * @generated + */ + @Override + public boolean isShowIcon() { + return this.showIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setShowIcon(boolean newShowIcon) { + boolean oldShowIcon = this.showIcon; + this.showIcon = newShowIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); + } + /** * * @@ -403,6 +447,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { if (resolve) return this.getForegroundColor(); return this.basicGetForegroundColor(); + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.isShowIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -436,6 +482,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) newValue); return; + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon((Boolean) newValue); + return; } super.eSet(featureID, newValue); } @@ -469,6 +518,9 @@ public void eUnset(int featureID) { case ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: this.setForegroundColor((UserColor) null); return; + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: + this.setShowIcon(SHOW_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -495,6 +547,8 @@ public boolean eIsSet(int featureID) { return this.backgroundColor != null; case ViewPackage.SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR: return this.foregroundColor != null; + case ViewPackage.SELECT_DESCRIPTION_STYLE__SHOW_ICON: + return this.showIcon != SHOW_ICON_EDEFAULT; } return super.eIsSet(featureID); } @@ -572,6 +626,8 @@ public String toString() { result.append(this.underline); result.append(", strikeThrough: "); result.append(this.strikeThrough); + result.append(", showIcon: "); + result.append(this.showIcon); result.append(')'); return result.toString(); } 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 c4785d5861..775d7f32c5 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 @@ -3074,6 +3074,16 @@ public EReference getSelectDescriptionStyle_ForegroundColor() { return (EReference) this.selectDescriptionStyleEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EAttribute getSelectDescriptionStyle_ShowIcon() { + return (EAttribute) this.selectDescriptionStyleEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -3114,6 +3124,16 @@ public EReference getMultiSelectDescriptionStyle_ForegroundColor() { return (EReference) this.multiSelectDescriptionStyleEClass.getEStructuralFeatures().get(1); } + /** + * + * + * @generated + */ + @Override + public EAttribute getMultiSelectDescriptionStyle_ShowIcon() { + return (EAttribute) this.multiSelectDescriptionStyleEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -4163,12 +4183,14 @@ public void createPackageContents() { this.selectDescriptionStyleEClass = this.createEClass(SELECT_DESCRIPTION_STYLE); this.createEReference(this.selectDescriptionStyleEClass, SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR); this.createEReference(this.selectDescriptionStyleEClass, SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR); + this.createEAttribute(this.selectDescriptionStyleEClass, SELECT_DESCRIPTION_STYLE__SHOW_ICON); this.conditionalSelectDescriptionStyleEClass = this.createEClass(CONDITIONAL_SELECT_DESCRIPTION_STYLE); this.multiSelectDescriptionStyleEClass = this.createEClass(MULTI_SELECT_DESCRIPTION_STYLE); this.createEReference(this.multiSelectDescriptionStyleEClass, MULTI_SELECT_DESCRIPTION_STYLE__BACKGROUND_COLOR); this.createEReference(this.multiSelectDescriptionStyleEClass, MULTI_SELECT_DESCRIPTION_STYLE__FOREGROUND_COLOR); + this.createEAttribute(this.multiSelectDescriptionStyleEClass, MULTI_SELECT_DESCRIPTION_STYLE__SHOW_ICON); this.conditionalMultiSelectDescriptionStyleEClass = this.createEClass(CONDITIONAL_MULTI_SELECT_DESCRIPTION_STYLE); @@ -4838,6 +4860,8 @@ public void initializePackageContents() { IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEReference(this.getSelectDescriptionStyle_ForegroundColor(), this.getUserColor(), null, "foregroundColor", null, 0, 1, SelectDescriptionStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getSelectDescriptionStyle_ShowIcon(), this.ecorePackage.getEBoolean(), "showIcon", null, 0, 1, SelectDescriptionStyle.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.conditionalSelectDescriptionStyleEClass, ConditionalSelectDescriptionStyle.class, "ConditionalSelectDescriptionStyle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -4847,6 +4871,8 @@ public void initializePackageContents() { !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEReference(this.getMultiSelectDescriptionStyle_ForegroundColor(), this.getUserColor(), null, "foregroundColor", null, 0, 1, MultiSelectDescriptionStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getMultiSelectDescriptionStyle_ShowIcon(), this.ecorePackage.getEBoolean(), "showIcon", null, 0, 1, MultiSelectDescriptionStyle.class, !IS_TRANSIENT, !IS_VOLATILE, + IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.conditionalMultiSelectDescriptionStyleEClass, ConditionalMultiSelectDescriptionStyle.class, "ConditionalMultiSelectDescriptionStyle", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); 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 5c69f22720..e2f22b7fd6 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 @@ -433,11 +433,13 @@ + + 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 22a7ac6e27..1b20ec52b5 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 @@ -327,11 +327,13 @@ + +