diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index b91fd136fa..c22385db59 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -92,6 +92,7 @@ Introducing a generator of builders aimed to help creating view programmatically - 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%] +- https://github.com/eclipse-sirius/sirius-components/issues/2044[#2044] [view] Add custom icons to edges and nodes label in view dsl === Improvements 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 index abb05b51f0..20a581a439 100644 --- 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 @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.sirius.components.forms.graphql.datafetchers.form; +import java.util.regex.Pattern; + import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; import org.eclipse.sirius.components.forms.SelectOption; import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; @@ -25,17 +27,26 @@ * 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. * + * If the SelectOption.iconURL is of the form path/to/UUID.svg, the rewritten value which will + * be seen by the frontend will be /api/images/custom/path/to/image.svg. + * * @author mcharfadi */ @QueryDataFetcher(type = "SelectOption", field = "iconURL") public class SelectOptionIconURLDataFetcher implements IDataFetcherWithFieldCoordinates { - + private static final Pattern UUID_REGEX = + Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); @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; + if (UUID_REGEX.matcher(result).matches()) { + result = URLConstants.IMAGE_BASE_PATH + "/custom/" + result; + } + else { + result = URLConstants.IMAGE_BASE_PATH + result; + } } return result; } diff --git a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalEdgeStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalEdgeStyleItemProvider.java index 24fbff4282..24f009fa83 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalEdgeStyleItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ConditionalEdgeStyleItemProvider.java @@ -61,6 +61,7 @@ public List getPropertyDescriptors(Object object) { this.addTargetArrowStylePropertyDescriptor(object); this.addEdgeWidthPropertyDescriptor(object); this.addShowIconPropertyDescriptor(object); + this.addLabelIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -186,6 +187,17 @@ protected void addShowIconPropertyDescriptor(Object object) { ViewPackage.Literals.EDGE_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Label Icon feature. + * + * @generated + */ + protected void addLabelIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_EdgeStyle_labelIcon_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_EdgeStyle_labelIcon_feature", "_UI_EdgeStyle_type"), + ViewPackage.Literals.EDGE_STYLE__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This returns ConditionalEdgeStyle.gif. * @@ -240,6 +252,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.CONDITIONAL_EDGE_STYLE__TARGET_ARROW_STYLE: case ViewPackage.CONDITIONAL_EDGE_STYLE__EDGE_WIDTH: case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_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/EdgeStyleItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/EdgeStyleItemProvider.java index af409aadf6..9a83e60f3f 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/EdgeStyleItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/EdgeStyleItemProvider.java @@ -60,6 +60,7 @@ public List getPropertyDescriptors(Object object) { this.addTargetArrowStylePropertyDescriptor(object); this.addEdgeWidthPropertyDescriptor(object); this.addShowIconPropertyDescriptor(object); + this.addLabelIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -174,6 +175,17 @@ protected void addShowIconPropertyDescriptor(Object object) { ViewPackage.Literals.EDGE_STYLE__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Label Icon feature. + * + * @generated + */ + protected void addLabelIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_EdgeStyle_labelIcon_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_EdgeStyle_labelIcon_feature", "_UI_EdgeStyle_type"), + ViewPackage.Literals.EDGE_STYLE__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This returns EdgeStyle.gif. * @@ -227,6 +239,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.EDGE_STYLE__TARGET_ARROW_STYLE: case ViewPackage.EDGE_STYLE__EDGE_WIDTH: case ViewPackage.EDGE_STYLE__SHOW_ICON: + case ViewPackage.EDGE_STYLE__LABEL_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/IconLabelNodeStyleDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/IconLabelNodeStyleDescriptionItemProvider.java index 2e54b949d2..baf3b8a79d 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/IconLabelNodeStyleDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/IconLabelNodeStyleDescriptionItemProvider.java @@ -63,6 +63,7 @@ public List getPropertyDescriptors(Object object) { this.addWidthComputationExpressionPropertyDescriptor(object); this.addHeightComputationExpressionPropertyDescriptor(object); this.addShowIconPropertyDescriptor(object); + this.addLabelIconPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -216,6 +217,18 @@ protected void addShowIconPropertyDescriptor(Object object) { ViewPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Label Icon feature. + * + * @generated + */ + protected void addLabelIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_NodeStyleDescription_labelIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"), + ViewPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This returns IconLabelNodeStyleDescription.gif. * @@ -272,6 +285,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION: case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION: case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON: + case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_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/ImageNodeStyleDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ImageNodeStyleDescriptionItemProvider.java index 68890725d0..f80db20e4d 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ImageNodeStyleDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/ImageNodeStyleDescriptionItemProvider.java @@ -63,6 +63,7 @@ public List getPropertyDescriptors(Object object) { this.addWidthComputationExpressionPropertyDescriptor(object); this.addHeightComputationExpressionPropertyDescriptor(object); this.addShowIconPropertyDescriptor(object); + this.addLabelIconPropertyDescriptor(object); this.addShapePropertyDescriptor(object); } return this.itemPropertyDescriptors; @@ -217,6 +218,18 @@ protected void addShowIconPropertyDescriptor(Object object) { ViewPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Label Icon feature. + * + * @generated + */ + protected void addLabelIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_NodeStyleDescription_labelIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"), + ViewPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This adds a property descriptor for the Shape feature. * @@ -285,6 +298,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION: case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION: case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON: + case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON: case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE: 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/RectangularNodeStyleDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/RectangularNodeStyleDescriptionItemProvider.java index 044ffc1e06..ce12ec333b 100644 --- a/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/RectangularNodeStyleDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-edit/src/main/java/org/eclipse/sirius/components/view/provider/RectangularNodeStyleDescriptionItemProvider.java @@ -63,6 +63,7 @@ public List getPropertyDescriptors(Object object) { this.addWidthComputationExpressionPropertyDescriptor(object); this.addHeightComputationExpressionPropertyDescriptor(object); this.addShowIconPropertyDescriptor(object); + this.addLabelIconPropertyDescriptor(object); this.addWithHeaderPropertyDescriptor(object); } return this.itemPropertyDescriptors; @@ -217,6 +218,18 @@ protected void addShowIconPropertyDescriptor(Object object) { ViewPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Label Icon feature. + * + * @generated + */ + protected void addLabelIconPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_NodeStyleDescription_labelIcon_feature"), + this.getString("_UI_PropertyDescriptor_description", "_UI_NodeStyleDescription_labelIcon_feature", "_UI_NodeStyleDescription_type"), + ViewPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + /** * This adds a property descriptor for the With Header feature. * @@ -285,6 +298,7 @@ public void notifyChanged(Notification notification) { case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION: case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION: case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON: + case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON: case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java index 9a3e4657b7..277124fac4 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/ViewPropertiesDescriptionRegistryConfigurer.java @@ -77,7 +77,8 @@ public class ViewPropertiesDescriptionRegistryConfigurer implements IPropertiesD private static final List TYPES_WITH_CUSTOM_PROPERTIES = List.of( ViewPackage.Literals.IMAGE_NODE_STYLE_DESCRIPTION, ViewPackage.Literals.ICON_LABEL_NODE_STYLE_DESCRIPTION, - ViewPackage.Literals.RECTANGULAR_NODE_STYLE_DESCRIPTION + ViewPackage.Literals.RECTANGULAR_NODE_STYLE_DESCRIPTION, + ViewPackage.Literals.EDGE_STYLE ); // @formatter:on private final IObjectService objectService; diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/EdgeStylePropertiesConfigurer.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/EdgeStylePropertiesConfigurer.java new file mode 100644 index 0000000000..45c77db9b7 --- /dev/null +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/EdgeStylePropertiesConfigurer.java @@ -0,0 +1,499 @@ +/******************************************************************************* + * 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.view.emf.diagram; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.sirius.components.collaborative.forms.services.api.IPropertiesDescriptionRegistry; +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.SelectStyle; +import org.eclipse.sirius.components.forms.components.SelectComponent; +import org.eclipse.sirius.components.forms.description.AbstractControlDescription; +import org.eclipse.sirius.components.forms.description.CheckboxDescription; +import org.eclipse.sirius.components.forms.description.FormDescription; +import org.eclipse.sirius.components.forms.description.GroupDescription; +import org.eclipse.sirius.components.forms.description.PageDescription; +import org.eclipse.sirius.components.forms.description.SelectDescription; +import org.eclipse.sirius.components.representations.Failure; +import org.eclipse.sirius.components.representations.GetOrCreateRandomIdProvider; +import org.eclipse.sirius.components.representations.IStatus; +import org.eclipse.sirius.components.representations.Success; +import org.eclipse.sirius.components.representations.VariableManager; +import org.eclipse.sirius.components.view.ArrowStyle; +import org.eclipse.sirius.components.view.ColorPalette; +import org.eclipse.sirius.components.view.EdgeStyle; +import org.eclipse.sirius.components.view.FixedColor; +import org.eclipse.sirius.components.view.LabelStyle; +import org.eclipse.sirius.components.view.LineStyle; +import org.eclipse.sirius.components.view.Style; +import org.eclipse.sirius.components.view.UserColor; +import org.eclipse.sirius.components.view.View; +import org.eclipse.sirius.components.view.ViewPackage; +import org.eclipse.sirius.components.view.emf.CustomImageMetadata; +import org.eclipse.sirius.components.view.emf.ICustomImageMetadataSearchService; +import org.eclipse.sirius.diagram.description.style.EdgeStyleDescription; +import org.springframework.stereotype.Component; + +/** + * Customizes the properties view for some of the View DSL elements. + * + * @author mcharfadi + */ +@Component +public class EdgeStylePropertiesConfigurer implements IPropertiesDescriptionRegistryConfigurer { + + private static final String EMPTY = ""; + + private static final String UNNAMED = ""; + + private static final String INT_PATTERN = "\\d+"; + + private final Function> semanticElementsProvider = variableManager -> variableManager.get(VariableManager.SELF, Object.class).stream().toList(); + + private final ICustomImageMetadataSearchService customImageSearchService; + + private final IValidationService validationService; + + private final IObjectService objectService; + + public EdgeStylePropertiesConfigurer(ICustomImageMetadataSearchService customImageSearchService, IValidationService validationService, + IObjectService objectService) { + this.validationService = Objects.requireNonNull(validationService); + this.customImageSearchService = Objects.requireNonNull(customImageSearchService); + this.objectService = Objects.requireNonNull(objectService); + } + + @Override + public void addPropertiesDescriptions(IPropertiesDescriptionRegistry registry) { + + String formDescriptionId = UUID.nameUUIDFromBytes("edgestyle".getBytes()).toString(); + + List controls = new ArrayList<>(); + controls.addAll(this.getGeneralControlDescription()); + + Predicate canCreatePagePredicate = variableManager -> variableManager.get(VariableManager.SELF, Object.class) + .filter(self -> self instanceof List) + .map(self -> (List) self) + .flatMap(self -> self.stream().findFirst()) + .filter(EdgeStyle.class::isInstance) + .isPresent(); + + GroupDescription groupDescription = this.createSimpleGroupDescription(controls); + // @formatter:off + FormDescription formDescription = FormDescription.newFormDescription(formDescriptionId) + .label("IconLabel Edge Style") + .labelProvider(variableManager -> variableManager.get(VariableManager.SELF, EdgeStyleDescription.class) + .map(EdgeStyleDescription::getStrokeColor) + .filter(FixedColor.class::isInstance) + .map(FixedColor.class::cast) + .map(FixedColor::getValue) + .orElse(UNNAMED)) + .canCreatePredicate(variableManager -> true) + .idProvider(new GetOrCreateRandomIdProvider()) + .targetObjectIdProvider(this.getTargetObjectIdProvider()) + .pageDescriptions(List.of(this.createSimplePageDescription(groupDescription, canCreatePagePredicate))) + .build(); + + registry.add(formDescription); + // @formatter:on + } + + private PageDescription createSimplePageDescription(GroupDescription groupDescription, Predicate canCreatePredicate) { + // @formatter:off + return PageDescription.newPageDescription("page") + .idProvider(variableManager -> "page") + .labelProvider(variableManager -> "Properties") + .semanticElementsProvider(this.semanticElementsProvider) + .canCreatePredicate(canCreatePredicate) + .groupDescriptions(List.of(groupDescription)) + .build(); + // @formatter:on + } + + private GroupDescription createSimpleGroupDescription(List controls) { + // @formatter:off + return GroupDescription.newGroupDescription("group") + .idProvider(variableManager -> "group") + .labelProvider(variableManager -> "General") + .semanticElementsProvider(this.semanticElementsProvider) + .controlDescriptions(controls) + .build(); + // @formatter:on + } + + private Function getTargetObjectIdProvider() { + // @formatter:off + return variableManager -> variableManager.get(VariableManager.SELF, Object.class) + .filter(self -> self instanceof List) + .map(self -> (List) self) + .flatMap(self -> self.stream().findFirst()) + .filter(EObject.class::isInstance) + .map(EObject.class::cast) + .map(obj -> EcoreUtil.getURI(obj).toString()) + .orElse(null); + // @formatter:on + } + + private List getGeneralControlDescription() { + return List.of( + this.createUserColorSelectionField("edgestyle.Color", "Color", ViewPackage.Literals.STYLE__COLOR + , Style.class + , Style::getColor + , Style::setColor), + this.createCheckbox("edgestyle.italic", "Italic", + style -> ((LabelStyle) style).isItalic(), + (style, newItalic) -> ((LabelStyle) style).setItalic(newItalic), + ViewPackage.Literals.LABEL_STYLE__ITALIC), + this.createCheckbox("edgestyle.bold", "Bold", + style -> ((LabelStyle) style).isBold(), + (style, newBold) -> ((LabelStyle) style).setBold(newBold), + ViewPackage.Literals.LABEL_STYLE__BOLD), + this.createCheckbox("edgestyle.underline", "Underline", + style -> ((LabelStyle) style).isUnderline(), + (style, newUnderline) -> ((LabelStyle) style).setUnderline(newUnderline), + ViewPackage.Literals.LABEL_STYLE__UNDERLINE), + this.createCheckbox("edgestyle.strikeThrough", "Strike Through", + style -> ((LabelStyle) style).isStrikeThrough(), + (style, newStrikeThrough) -> ((LabelStyle) style).setStrikeThrough(newStrikeThrough), + ViewPackage.Literals.LABEL_STYLE__STRIKE_THROUGH), + this.createCheckbox("edgestyle.showIcon", "Show Icon", + style -> ((EdgeStyle) style).isShowIcon(), + (style, newValue) -> ((EdgeStyle) style).setShowIcon(newValue), + ViewPackage.Literals.EDGE_STYLE__SHOW_ICON), + this.createIconSelectionField( + ViewPackage.Literals.EDGE_STYLE__LABEL_ICON), + this.createLineStyleSelectionField( + ViewPackage.Literals.LINE_STYLE), + this.createSourceArrowStyleSelectionField( + ViewPackage.Literals.EDGE_STYLE__SOURCE_ARROW_STYLE), + this.createTargetArrowStyleSelectionField( + ViewPackage.Literals.EDGE_STYLE__TARGET_ARROW_STYLE)); + } + + private SelectDescription createUserColorSelectionField(String id, String label, Object feature, Class styleType + , Function colorGetter, BiConsumer colorSetter) { + // @formatter:off + return SelectDescription.newSelectDescription(id) + .idProvider(variableManager -> id) + .labelProvider(variableManager -> label) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, styleType) + .map(colorGetter) + .map(UserColor::getName) + .orElse(EMPTY)) + .optionsProvider(variableManager -> this.getColorsFromColorPalettesStream(variableManager).toList()) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, UserColor.class) + .map(UserColor::getName) + .orElse(EMPTY)) + .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) -> { + if (newValue != null) { + this.getColorsFromColorPalettesStream(variableManager) + .filter(userColor -> newValue.equals(userColor.getName())) + .findFirst() + .ifPresent(userColor -> colorSetter.accept(style, userColor)); + } + return new Success(); + }).orElseGet(() -> new Failure("")) + ) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private Stream getColorsFromColorPalettesStream(VariableManager variableManager) { + return variableManager.get(IEditingContext.EDITING_CONTEXT, IEditingContext.class) + .filter(EditingContext.class::isInstance) + .map(EditingContext.class::cast) + .map(EditingContext::getDomain) + .map(EditingDomain::getResourceSet) + .map(ResourceSet::getResources) + .stream() + .flatMap(EList::stream) + .map(Resource::getContents) + .flatMap(EList::stream) + .filter(View.class::isInstance) + .map(View.class::cast) + .map(View::getColorPalettes) + .flatMap(EList::stream) + .map(ColorPalette::getColors) + .flatMap(EList::stream); + } + + private CheckboxDescription createCheckbox(String id, String title, Function reader, BiConsumer writer, Object feature) { + Function valueProvider = variableManager -> variableManager.get(VariableManager.SELF, Object.class).map(reader).orElse(Boolean.FALSE); + BiFunction newValueHandler = (variableManager, newValue) -> { + var optionalDiagramMapping = variableManager.get(VariableManager.SELF, Object.class); + if (optionalDiagramMapping.isPresent()) { + writer.accept(optionalDiagramMapping.get(), newValue); + return new Success(); + } else { + return new Failure(""); + } + }; + // @formatter:off + return CheckboxDescription.newCheckboxDescription(id) + .idProvider(variableManager -> id) + .labelProvider(variableManager -> title) + .valueProvider(valueProvider) + .newValueHandler(newValueHandler) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private SelectDescription createSourceArrowStyleSelectionField(Object feature) { + // @formatter:off + return SelectDescription.newSelectDescription("edgestyle.sourceArrowStyleSelector") + .idProvider(variableManager -> "edgestyle.sourceArrowStyleSelector") + .labelProvider(variableManager -> "Source Arrow Syle") + .styleProvider(vm -> SelectStyle.newSelectStyle().showIcon(true).build()) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, EdgeStyle.class).map(EdgeStyle::getSourceArrowStyle) + .map(ArrowStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionsProvider(variableManager -> ArrowStyle.VALUES) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, ArrowStyle.class) + .map(ArrowStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, ArrowStyle.class) + .map(Enumerator::getName) + .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> "") + .newValueHandler(this.getSourceArrowValueHandler()) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private BiFunction getSourceArrowValueHandler() { + return (variableManager, newValue) -> { + var optionalEdgeStyle = variableManager.get(VariableManager.SELF, EdgeStyle.class); + if (optionalEdgeStyle.isPresent() && newValue != null && newValue.matches(INT_PATTERN)) { + int newArrowStyle = Integer.parseInt(newValue); + ArrowStyle arrowStyle = ArrowStyle.get(newArrowStyle); + if (arrowStyle != null) { + optionalEdgeStyle.get().setSourceArrowStyle(arrowStyle); + return new Success(); + } + } + return new Failure(""); + }; + } + + private SelectDescription createTargetArrowStyleSelectionField(Object feature) { + // @formatter:off + return SelectDescription.newSelectDescription("edgestyle.targetArrowStyleSelector") + .idProvider(variableManager -> "edgestyle.targetArrowStyleSelector") + .labelProvider(variableManager -> "Target Arrow Syle") + .styleProvider(vm -> SelectStyle.newSelectStyle().showIcon(true).build()) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, EdgeStyle.class).map(EdgeStyle::getTargetArrowStyle) + .map(ArrowStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionsProvider(variableManager -> ArrowStyle.VALUES) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, ArrowStyle.class) + .map(ArrowStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, ArrowStyle.class) + .map(Enumerator::getName) + .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> "") + .newValueHandler(this.getTargetArrowValueHandler()) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private BiFunction getTargetArrowValueHandler() { + return (variableManager, newValue) -> { + var optionalEdgeStyle = variableManager.get(VariableManager.SELF, EdgeStyle.class); + if (optionalEdgeStyle.isPresent() && newValue != null && newValue.matches(INT_PATTERN)) { + int newArrowStyle = Integer.parseInt(newValue); + ArrowStyle arrowStyle = ArrowStyle.get(newArrowStyle); + if (arrowStyle != null) { + optionalEdgeStyle.get().setTargetArrowStyle(arrowStyle); + return new Success(); + } + } + return new Failure(""); + }; + } + + private SelectDescription createLineStyleSelectionField(Object feature) { + // @formatter:off + return SelectDescription.newSelectDescription("edgestyle.lineStyleSelector") + .idProvider(variableManager -> "edgestyle.lineStyleSelector") + .labelProvider(variableManager -> "Line Syle") + .styleProvider(vm -> SelectStyle.newSelectStyle().showIcon(true).build()) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, EdgeStyle.class).map(EdgeStyle::getLineStyle) + .map(LineStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionsProvider(variableManager -> LineStyle.VALUES) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, LineStyle.class) + .map(LineStyle::getValue) + .map(value -> String.valueOf(value)) + .orElse(EMPTY)) + .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, LineStyle.class) + .map(Enumerator::getName) + .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> "") + .newValueHandler(this.getLineStyleValueHandler()) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private BiFunction getLineStyleValueHandler() { + return (variableManager, newValue) -> { + var optionalEdgeStyle = variableManager.get(VariableManager.SELF, EdgeStyle.class); + if (optionalEdgeStyle.isPresent() && newValue != null && newValue.matches(INT_PATTERN)) { + int newLineStyle = Integer.parseInt(newValue); + LineStyle lineStyle = LineStyle.get(newLineStyle); + if (lineStyle != null) { + optionalEdgeStyle.get().setLineStyle(lineStyle); + return new Success(); + } + } + return new Failure(""); + }; + } + + private SelectDescription createIconSelectionField(Object feature) { + // @formatter:off + return SelectDescription.newSelectDescription("edgestyle.iconLabelSelector") + .idProvider(variableManager -> "edgestyle.iconLabelSelector") + .labelProvider(variableManager -> "Custom Icon") + .styleProvider(vm -> SelectStyle.newSelectStyle().showIcon(true).build()) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, EdgeStyle.class).map(EdgeStyle::getLabelIcon).orElse(EMPTY)) + .optionsProvider(variableManager -> variableManager.get(IEditingContext.EDITING_CONTEXT, IEditingContext.class) + .map(IEditingContext::getId) + .map(this.customImageSearchService::getAvailableImages) + .orElse(List.of()) + ) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getId) + .map(UUID::toString) + .orElse(EMPTY)) + .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getLabel) + .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getId) + .map(UUID::toString) + .orElse(EMPTY)) + .newValueHandler(this.getIconLabelValueHandler()) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + + private BiFunction getIconLabelValueHandler() { + return (variableManager, newValue) -> { + var optionalEdgeStyle = variableManager.get(VariableManager.SELF, EdgeStyle.class); + if (optionalEdgeStyle.isPresent()) { + String newIcon = newValue; + if (newValue != null && newValue.isBlank()) { + newIcon = null; + } + optionalEdgeStyle.get().setLabelIcon(newIcon); + return new Success(); + } + return new Failure(""); + }; + } + + private Function> getDiagnosticsProvider(Object feature) { + return variableManager -> { + var optionalSelf = variableManager.get(VariableManager.SELF, EObject.class); + + if (optionalSelf.isPresent()) { + EObject self = optionalSelf.get(); + List diagnostics = this.validationService.validate(self, feature); + return diagnostics; + } + + return List.of(); + }; + } + + private String kindProvider(Object object) { + String kind = "Unknown"; + if (object instanceof Diagnostic) { + Diagnostic diagnostic = (Diagnostic) object; + switch (diagnostic.getSeverity()) { + case org.eclipse.emf.common.util.Diagnostic.ERROR: + kind = "Error"; + break; + case org.eclipse.emf.common.util.Diagnostic.WARNING: + kind = "Warning"; + break; + case org.eclipse.emf.common.util.Diagnostic.INFO: + kind = "Info"; + break; + default: + kind = "Unknown"; + break; + } + } + return kind; + } + + private String messageProvider(Object object) { + if (object instanceof Diagnostic) { + Diagnostic diagnostic = (Diagnostic) object; + return diagnostic.getMessage(); + } + return ""; + } + +} 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 999cf66a56..e4a5322e23 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 @@ -38,6 +38,7 @@ 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.SelectStyle; import org.eclipse.sirius.components.forms.components.SelectComponent; import org.eclipse.sirius.components.forms.description.AbstractControlDescription; import org.eclipse.sirius.components.forms.description.CheckboxDescription; @@ -220,6 +221,8 @@ private List getGeneralControlDescription() { style -> ((NodeStyleDescription) style).isShowIcon(), (style, newValue) -> ((NodeStyleDescription) style).setShowIcon(newValue), ViewPackage.Literals.NODE_STYLE_DESCRIPTION__SHOW_ICON), + this.createIconSelectionField( + ViewPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_ICON), this.createUserColorSelectionField("nodestyle.labelColor", "Label Color", ViewPackage.Literals.NODE_STYLE_DESCRIPTION__LABEL_COLOR , NodeStyleDescription.class , NodeStyleDescription::getLabelColor @@ -478,6 +481,37 @@ private Stream getColorsFromColorPalettesStream(VariableManager varia .flatMap(EList::stream); } + private SelectDescription createIconSelectionField(Object feature) { + // @formatter:off + return SelectDescription.newSelectDescription("nodestyle.iconLabelSelector") + .idProvider(variableManager -> "nodestyle.iconLabelSelector") + .labelProvider(variableManager -> "Custom Icon") + .styleProvider(vm -> SelectStyle.newSelectStyle().showIcon(true).build()) + .valueProvider(variableManager -> variableManager.get(VariableManager.SELF, NodeStyleDescription.class).map(NodeStyleDescription::getLabelIcon).orElse(EMPTY)) + .optionsProvider(variableManager -> variableManager.get(IEditingContext.EDITING_CONTEXT, IEditingContext.class) + .map(IEditingContext::getId) + .map(this.customImageSearchService::getAvailableImages) + .orElse(List.of()) + ) + .optionIdProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getId) + .map(UUID::toString) + .orElse(EMPTY)) + .optionLabelProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getLabel) + .orElse(EMPTY)) + .optionIconURLProvider(variableManager -> variableManager.get(SelectComponent.CANDIDATE_VARIABLE, CustomImageMetadata.class) + .map(CustomImageMetadata::getId) + .map(UUID::toString) + .orElse(EMPTY)) + .newValueHandler(this.getIconLabelValueHandler()) + .diagnosticsProvider(this.getDiagnosticsProvider(feature)) + .kindProvider(this::kindProvider) + .messageProvider(this::messageProvider) + .build(); + // @formatter:on + } + private SelectDescription createShapeSelectionField(Object feature) { // @formatter:off return SelectDescription.newSelectDescription("nodestyle.shapeSelector") @@ -533,6 +567,21 @@ private ImageDescription createShapePreviewField() { // @formatter:on } + private BiFunction getIconLabelValueHandler() { + return (variableManager, newValue) -> { + var optionalNodeStyle = variableManager.get(VariableManager.SELF, NodeStyleDescription.class); + if (optionalNodeStyle.isPresent()) { + String newIcon = newValue; + if (newValue != null && newValue.isBlank()) { + newIcon = null; + } + optionalNodeStyle.get().setLabelIcon(newIcon); + return new Success(); + } + return new Failure(""); + }; + } + private BiFunction getNewShapeValueHandler() { return (variableManager, newValue) -> { var optionalNodeStyle = variableManager.get(VariableManager.SELF, ImageNodeStyleDescription.class); diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/StylesFactory.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/StylesFactory.java index dc8acca6ef..16257d8413 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/StylesFactory.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/diagram/StylesFactory.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.regex.Pattern; import org.eclipse.sirius.components.core.api.IObjectService; import org.eclipse.sirius.components.diagrams.ArrowStyle; @@ -42,6 +43,9 @@ public final class StylesFactory { private static final String DEFAULT_COLOR = "black"; + private static final Pattern UUID_REGEX = + Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); + private final List iNodeStyleProviders; private final IObjectService objectService; @@ -66,9 +70,17 @@ public LabelStyleDescription createLabelStyleDescription(NodeStyleDescription no .strikeThroughProvider(variableManager -> nodeStyle.isStrikeThrough()) .iconURLProvider(variableManager -> { String iconURL = ""; - if (nodeStyle.isShowIcon()) { + if (nodeStyle.isShowIcon() && nodeStyle.getLabelIcon() == null) { iconURL = variableManager.get(VariableManager.SELF, Object.class).map(this.objectService::getImagePath).orElse(""); } + if (nodeStyle.isShowIcon() && !(nodeStyle.getLabelIcon() == null)) { + if (UUID_REGEX.matcher(nodeStyle.getLabelIcon()).matches()) { + iconURL = "/custom/" + nodeStyle.getLabelIcon(); + } + else { + iconURL = nodeStyle.getLabelIcon(); + } + } return iconURL; }) .build(); @@ -90,9 +102,17 @@ public LabelStyleDescription createEdgeLabelStyleDescription(org.eclipse.sirius. .strikeThroughProvider(variableManager -> edgeStyle.isStrikeThrough()) .iconURLProvider(variableManager -> { String iconURL = ""; - if (edgeStyle.isShowIcon()) { + if (edgeStyle.isShowIcon() && edgeStyle.getLabelIcon() == null) { iconURL = variableManager.get(VariableManager.SELF, Object.class).map(this.objectService::getImagePath).orElse(""); } + if (edgeStyle.isShowIcon() && !(edgeStyle.getLabelIcon() == null)) { + if (UUID_REGEX.matcher(edgeStyle.getLabelIcon()).matches()) { + iconURL = "/custom/" + edgeStyle.getLabelIcon(); + } + else { + iconURL = edgeStyle.getLabelIcon(); + } + } return iconURL; }) .build(); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/EdgeStyle.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/EdgeStyle.java index 9cef90eb5b..b57a3dde22 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/EdgeStyle.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/EdgeStyle.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021, 2022 Obeo. + * Copyright (c) 2021, 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 @@ -24,6 +24,7 @@ *
  • {@link org.eclipse.sirius.components.view.EdgeStyle#getTargetArrowStyle Target Arrow Style}
  • *
  • {@link org.eclipse.sirius.components.view.EdgeStyle#getEdgeWidth Edge Width}
  • *
  • {@link org.eclipse.sirius.components.view.EdgeStyle#isShowIcon Show Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.EdgeStyle#getLabelIcon Label Icon}
  • * * * @see org.eclipse.sirius.components.view.ViewPackage#getEdgeStyle() @@ -155,4 +156,26 @@ public interface EdgeStyle extends Style, LabelStyle { */ void setShowIcon(boolean value); + /** + * Returns the value of the 'Label Icon' attribute. + * + * @return the value of the 'Label Icon' attribute. + * @see #setLabelIcon(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getEdgeStyle_LabelIcon() + * @model + * @generated + */ + String getLabelIcon(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.EdgeStyle#getLabelIcon Label Icon}' + * attribute. + * + * @param value + * the new value of the 'Label Icon' attribute. + * @see #getLabelIcon() + * @generated + */ + void setLabelIcon(String value); + } // EdgeStyle diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/NodeStyleDescription.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/NodeStyleDescription.java index 6714ea4414..98f228223f 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/NodeStyleDescription.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/NodeStyleDescription.java @@ -26,6 +26,7 @@ *
  • {@link org.eclipse.sirius.components.view.NodeStyleDescription#getHeightComputationExpression Height * Computation Expression}
  • *
  • {@link org.eclipse.sirius.components.view.NodeStyleDescription#isShowIcon Show Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.NodeStyleDescription#getLabelIcon Label Icon}
  • * * * @see org.eclipse.sirius.components.view.ViewPackage#getNodeStyleDescription() @@ -49,9 +50,10 @@ public interface NodeStyleDescription extends Style, LabelStyle, BorderStyle { * Sets the value of the '{@link org.eclipse.sirius.components.view.NodeStyleDescription#getLabelColor Label * Color}' reference. * - * @param value the new value of the 'Label Color' reference. - * @generated + * @param value + * the new value of the 'Label Color' reference. * @see #getLabelColor() + * @generated */ void setLabelColor(UserColor value); @@ -125,4 +127,26 @@ public interface NodeStyleDescription extends Style, LabelStyle, BorderStyle { */ void setShowIcon(boolean value); + /** + * Returns the value of the 'Label Icon' attribute. + * + * @return the value of the 'Label Icon' attribute. + * @see #setLabelIcon(String) + * @see org.eclipse.sirius.components.view.ViewPackage#getNodeStyleDescription_LabelIcon() + * @model + * @generated + */ + String getLabelIcon(); + + /** + * Sets the value of the '{@link org.eclipse.sirius.components.view.NodeStyleDescription#getLabelIcon Label + * Icon}' attribute. + * + * @param value + * the new value of the 'Label Icon' attribute. + * @see #getLabelIcon() + * @generated + */ + void setLabelIcon(String value); + } // NodeStyleDescription 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 8f6b8e5fe2..930714d241 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 @@ -1090,6 +1090,14 @@ public interface ViewPackage extends EPackage { */ int NODE_STYLE_DESCRIPTION__SHOW_ICON = STYLE_FEATURE_COUNT + 12; + /** + * The feature id for the 'Label Icon' attribute. + * + * @generated + * @ordered + */ + int NODE_STYLE_DESCRIPTION__LABEL_ICON = STYLE_FEATURE_COUNT + 13; + /** * The number of structural features of the 'Node Style Description' class. @@ -1097,7 +1105,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int NODE_STYLE_DESCRIPTION_FEATURE_COUNT = STYLE_FEATURE_COUNT + 13; + int NODE_STYLE_DESCRIPTION_FEATURE_COUNT = STYLE_FEATURE_COUNT + 14; /** * The number of operations of the 'Node Style Description' class. + * + * @generated + * @ordered + */ + int RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON; + /** * The feature id for the 'With Header' attribute. * @@ -1384,6 +1400,14 @@ public interface ViewPackage extends EPackage { */ int IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON = NODE_STYLE_DESCRIPTION__SHOW_ICON; + /** + * The feature id for the 'Label Icon' attribute. + * + * @generated + * @ordered + */ + int IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON; + /** * The feature id for the 'Shape' attribute. * @@ -1535,6 +1559,14 @@ public interface ViewPackage extends EPackage { */ int ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON = NODE_STYLE_DESCRIPTION__SHOW_ICON; + /** + * The feature id for the 'Label Icon' attribute. + * + * @generated + * @ordered + */ + int ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON = NODE_STYLE_DESCRIPTION__LABEL_ICON; + /** * The number of structural features of the 'Icon Label Node Style Description' class. @@ -1737,6 +1769,14 @@ public interface ViewPackage extends EPackage { */ int EDGE_STYLE__SHOW_ICON = STYLE_FEATURE_COUNT + 9; + /** + * The feature id for the 'Label Icon' attribute. + * + * @generated + * @ordered + */ + int EDGE_STYLE__LABEL_ICON = STYLE_FEATURE_COUNT + 10; + /** * The number of structural features of the 'Edge Style' class. @@ -1744,7 +1784,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int EDGE_STYLE_FEATURE_COUNT = STYLE_FEATURE_COUNT + 10; + int EDGE_STYLE_FEATURE_COUNT = STYLE_FEATURE_COUNT + 11; /** * The number of operations of the 'Edge Style' class. @@ -2773,6 +2813,14 @@ public interface ViewPackage extends EPackage { */ int CONDITIONAL_EDGE_STYLE__SHOW_ICON = CONDITIONAL_FEATURE_COUNT + 10; + /** + * The feature id for the 'Label Icon' attribute. + * + * @generated + * @ordered + */ + int CONDITIONAL_EDGE_STYLE__LABEL_ICON = CONDITIONAL_FEATURE_COUNT + 11; + /** * The number of structural features of the 'Conditional Edge Style' class. @@ -2780,7 +2828,7 @@ public interface ViewPackage extends EPackage { * @generated * @ordered */ - int CONDITIONAL_EDGE_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 11; + int CONDITIONAL_EDGE_STYLE_FEATURE_COUNT = CONDITIONAL_FEATURE_COUNT + 12; /** * The number of operations of the 'Conditional Edge Style' class. + * + * @return the meta object for the attribute 'Label Icon'. + * @see org.eclipse.sirius.components.view.NodeStyleDescription#getLabelIcon() + * @see #getNodeStyleDescription() + * @generated + */ + EAttribute getNodeStyleDescription_LabelIcon(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.RectangularNodeStyleDescription * Rectangular Node Style Description}'. @@ -7601,6 +7661,17 @@ public interface ViewPackage extends EPackage { */ EAttribute getEdgeStyle_ShowIcon(); + /** + * Returns the meta object for the attribute '{@link org.eclipse.sirius.components.view.EdgeStyle#getLabelIcon + * Label Icon}'. + * + * @return the meta object for the attribute 'Label Icon'. + * @see org.eclipse.sirius.components.view.EdgeStyle#getLabelIcon() + * @see #getEdgeStyle() + * @generated + */ + EAttribute getEdgeStyle_LabelIcon(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.Tool Tool}'. @@ -10596,6 +10667,14 @@ interface Literals { */ EAttribute NODE_STYLE_DESCRIPTION__SHOW_ICON = eINSTANCE.getNodeStyleDescription_ShowIcon(); + /** + * The meta object literal for the 'Label Icon' attribute feature. + * + * @generated + */ + EAttribute NODE_STYLE_DESCRIPTION__LABEL_ICON = eINSTANCE.getNodeStyleDescription_LabelIcon(); + /** * The meta object literal for the * '{@link org.eclipse.sirius.components.view.impl.RectangularNodeStyleDescriptionImpl Rectangular Node @@ -10726,6 +10805,14 @@ interface Literals { */ EAttribute EDGE_STYLE__SHOW_ICON = eINSTANCE.getEdgeStyle_ShowIcon(); + /** + * The meta object literal for the 'Label Icon' attribute feature. + * + * @generated + */ + EAttribute EDGE_STYLE__LABEL_ICON = eINSTANCE.getEdgeStyle_LabelIcon(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.view.impl.ToolImpl Tool}' * class. diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalEdgeStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalEdgeStyleImpl.java index 88c835d89b..6675cc3b89 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalEdgeStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ConditionalEdgeStyleImpl.java @@ -46,6 +46,7 @@ * Style} *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalEdgeStyleImpl#getEdgeWidth Edge Width}
  • *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalEdgeStyleImpl#isShowIcon Show Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.ConditionalEdgeStyleImpl#getLabelIcon Label Icon}
  • * * * @generated @@ -261,6 +262,26 @@ public class ConditionalEdgeStyleImpl extends ConditionalImpl implements Conditi */ protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** + * The default value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected static final String LABEL_ICON_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected String labelIcon = LABEL_ICON_EDEFAULT; + /** * * @@ -550,6 +571,29 @@ public void setShowIcon(boolean newShowIcon) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); } + /** + * + * + * @generated + */ + @Override + public String getLabelIcon() { + return this.labelIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelIcon(String newLabelIcon) { + String oldLabelIcon = this.labelIcon; + this.labelIcon = newLabelIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON, oldLabelIcon, this.labelIcon)); + } + /** * * @@ -582,6 +626,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getEdgeWidth(); case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: return this.isShowIcon(); + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON: + return this.getLabelIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -627,6 +673,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: this.setShowIcon((Boolean) newValue); return; + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON: + this.setLabelIcon((String) newValue); + return; } super.eSet(featureID, newValue); } @@ -672,6 +721,9 @@ public void eUnset(int featureID) { case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: this.setShowIcon(SHOW_ICON_EDEFAULT); return; + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON: + this.setLabelIcon(LABEL_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -706,6 +758,8 @@ public boolean eIsSet(int featureID) { return this.edgeWidth != EDGE_WIDTH_EDEFAULT; case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: return this.showIcon != SHOW_ICON_EDEFAULT; + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON: + return LABEL_ICON_EDEFAULT == null ? this.labelIcon != null : !LABEL_ICON_EDEFAULT.equals(this.labelIcon); } return super.eIsSet(featureID); } @@ -753,6 +807,8 @@ public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { return ViewPackage.EDGE_STYLE__EDGE_WIDTH; case ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON: return ViewPackage.EDGE_STYLE__SHOW_ICON; + case ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON: + return ViewPackage.EDGE_STYLE__LABEL_ICON; default: return -1; } @@ -803,6 +859,8 @@ public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { return ViewPackage.CONDITIONAL_EDGE_STYLE__EDGE_WIDTH; case ViewPackage.EDGE_STYLE__SHOW_ICON: return ViewPackage.CONDITIONAL_EDGE_STYLE__SHOW_ICON; + case ViewPackage.EDGE_STYLE__LABEL_ICON: + return ViewPackage.CONDITIONAL_EDGE_STYLE__LABEL_ICON; default: return -1; } @@ -841,6 +899,8 @@ public String toString() { result.append(this.edgeWidth); result.append(", showIcon: "); result.append(this.showIcon); + result.append(", labelIcon: "); + result.append(this.labelIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/EdgeStyleImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/EdgeStyleImpl.java index 12c34da06f..b4c9bec941 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/EdgeStyleImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/EdgeStyleImpl.java @@ -39,6 +39,7 @@ * Style} *
  • {@link org.eclipse.sirius.components.view.impl.EdgeStyleImpl#getEdgeWidth Edge Width}
  • *
  • {@link org.eclipse.sirius.components.view.impl.EdgeStyleImpl#isShowIcon Show Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.EdgeStyleImpl#getLabelIcon Label Icon}
  • * * * @generated @@ -244,6 +245,26 @@ public class EdgeStyleImpl extends StyleImpl implements EdgeStyle { */ protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** + * The default value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected static final String LABEL_ICON_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected String labelIcon = LABEL_ICON_EDEFAULT; + /** * * @@ -493,6 +514,29 @@ public void setShowIcon(boolean newShowIcon) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.EDGE_STYLE__SHOW_ICON, oldShowIcon, this.showIcon)); } + /** + * + * + * @generated + */ + @Override + public String getLabelIcon() { + return this.labelIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelIcon(String newLabelIcon) { + String oldLabelIcon = this.labelIcon; + this.labelIcon = newLabelIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.EDGE_STYLE__LABEL_ICON, oldLabelIcon, this.labelIcon)); + } + /** * * @@ -521,6 +565,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getEdgeWidth(); case ViewPackage.EDGE_STYLE__SHOW_ICON: return this.isShowIcon(); + case ViewPackage.EDGE_STYLE__LABEL_ICON: + return this.getLabelIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -563,6 +609,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.EDGE_STYLE__SHOW_ICON: this.setShowIcon((Boolean) newValue); return; + case ViewPackage.EDGE_STYLE__LABEL_ICON: + this.setLabelIcon((String) newValue); + return; } super.eSet(featureID, newValue); } @@ -605,6 +654,9 @@ public void eUnset(int featureID) { case ViewPackage.EDGE_STYLE__SHOW_ICON: this.setShowIcon(SHOW_ICON_EDEFAULT); return; + case ViewPackage.EDGE_STYLE__LABEL_ICON: + this.setLabelIcon(LABEL_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -637,6 +689,8 @@ public boolean eIsSet(int featureID) { return this.edgeWidth != EDGE_WIDTH_EDEFAULT; case ViewPackage.EDGE_STYLE__SHOW_ICON: return this.showIcon != SHOW_ICON_EDEFAULT; + case ViewPackage.EDGE_STYLE__LABEL_ICON: + return LABEL_ICON_EDEFAULT == null ? this.labelIcon != null : !LABEL_ICON_EDEFAULT.equals(this.labelIcon); } return super.eIsSet(featureID); } @@ -724,6 +778,8 @@ public String toString() { result.append(this.edgeWidth); result.append(", showIcon: "); result.append(this.showIcon); + result.append(", labelIcon: "); + result.append(this.labelIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/IconLabelNodeStyleDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/IconLabelNodeStyleDescriptionImpl.java index 7ae0c575b4..131a177b23 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/IconLabelNodeStyleDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/IconLabelNodeStyleDescriptionImpl.java @@ -54,6 +54,8 @@ * Height Computation Expression} *
  • {@link org.eclipse.sirius.components.view.impl.IconLabelNodeStyleDescriptionImpl#isShowIcon Show * Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.IconLabelNodeStyleDescriptionImpl#getLabelIcon Label + * Icon}
  • * * * @generated @@ -299,6 +301,26 @@ public class IconLabelNodeStyleDescriptionImpl extends StyleImpl implements Icon */ protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** + * The default value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected static final String LABEL_ICON_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected String labelIcon = LABEL_ICON_EDEFAULT; + /** * * @@ -653,6 +675,29 @@ public void setShowIcon(boolean newShowIcon) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON, oldShowIcon, this.showIcon)); } + /** + * + * + * @generated + */ + @Override + public String getLabelIcon() { + return this.labelIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelIcon(String newLabelIcon) { + String oldLabelIcon = this.labelIcon; + this.labelIcon = newLabelIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON, oldLabelIcon, this.labelIcon)); + } + /** * * @@ -691,6 +736,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getHeightComputationExpression(); case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.isShowIcon(); + case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return this.getLabelIcon(); } return super.eGet(featureID, resolve, coreType); } @@ -742,6 +789,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon((Boolean) newValue); return; + case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon((String) newValue); + return; } super.eSet(featureID, newValue); } @@ -793,6 +843,9 @@ public void eUnset(int featureID) { case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon(SHOW_ICON_EDEFAULT); return; + case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon(LABEL_ICON_EDEFAULT); + return; } super.eUnset(featureID); } @@ -831,6 +884,8 @@ public boolean eIsSet(int featureID) { return HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT == null ? this.heightComputationExpression != null : !HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT.equals(this.heightComputationExpression); case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.showIcon != SHOW_ICON_EDEFAULT; + case ViewPackage.ICON_LABEL_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return LABEL_ICON_EDEFAULT == null ? this.labelIcon != null : !LABEL_ICON_EDEFAULT.equals(this.labelIcon); } return super.eIsSet(featureID); } @@ -948,6 +1003,8 @@ public String toString() { result.append(this.heightComputationExpression); result.append(", showIcon: "); result.append(this.showIcon); + result.append(", labelIcon: "); + result.append(this.labelIcon); result.append(')'); return result.toString(); } diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ImageNodeStyleDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ImageNodeStyleDescriptionImpl.java index d7c39fbd9a..53e6463a35 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ImageNodeStyleDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/ImageNodeStyleDescriptionImpl.java @@ -51,6 +51,8 @@ *
  • {@link org.eclipse.sirius.components.view.impl.ImageNodeStyleDescriptionImpl#getHeightComputationExpression * Height Computation Expression}
  • *
  • {@link org.eclipse.sirius.components.view.impl.ImageNodeStyleDescriptionImpl#isShowIcon Show Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.ImageNodeStyleDescriptionImpl#getLabelIcon Label + * Icon}
  • *
  • {@link org.eclipse.sirius.components.view.impl.ImageNodeStyleDescriptionImpl#getShape Shape}
  • * * @@ -297,6 +299,26 @@ public class ImageNodeStyleDescriptionImpl extends StyleImpl implements ImageNod */ protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** + * The default value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected static final String LABEL_ICON_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected String labelIcon = LABEL_ICON_EDEFAULT; + /** * The default value of the '{@link #getShape() Shape}' attribute. @@ -671,6 +693,29 @@ public void setShowIcon(boolean newShowIcon) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON, oldShowIcon, this.showIcon)); } + /** + * + * + * @generated + */ + @Override + public String getLabelIcon() { + return this.labelIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelIcon(String newLabelIcon) { + String oldLabelIcon = this.labelIcon; + this.labelIcon = newLabelIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON, oldLabelIcon, this.labelIcon)); + } + /** * * @@ -732,6 +777,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getHeightComputationExpression(); case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.isShowIcon(); + case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return this.getLabelIcon(); case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE: return this.getShape(); } @@ -785,6 +832,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon((Boolean) newValue); return; + case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon((String) newValue); + return; case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE: this.setShape((String) newValue); return; @@ -839,6 +889,9 @@ public void eUnset(int featureID) { case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon(SHOW_ICON_EDEFAULT); return; + case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon(LABEL_ICON_EDEFAULT); + return; case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE: this.setShape(SHAPE_EDEFAULT); return; @@ -880,6 +933,8 @@ public boolean eIsSet(int featureID) { return HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT == null ? this.heightComputationExpression != null : !HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT.equals(this.heightComputationExpression); case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.showIcon != SHOW_ICON_EDEFAULT; + case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return LABEL_ICON_EDEFAULT == null ? this.labelIcon != null : !LABEL_ICON_EDEFAULT.equals(this.labelIcon); case ViewPackage.IMAGE_NODE_STYLE_DESCRIPTION__SHAPE: return SHAPE_EDEFAULT == null ? this.shape != null : !SHAPE_EDEFAULT.equals(this.shape); } @@ -999,6 +1054,8 @@ public String toString() { result.append(this.heightComputationExpression); result.append(", showIcon: "); result.append(this.showIcon); + result.append(", labelIcon: "); + result.append(this.labelIcon); result.append(", shape: "); result.append(this.shape); result.append(')'); diff --git a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/RectangularNodeStyleDescriptionImpl.java b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/RectangularNodeStyleDescriptionImpl.java index b262f9c831..95f0986f8f 100644 --- a/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/RectangularNodeStyleDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view/src/main/java/org/eclipse/sirius/components/view/impl/RectangularNodeStyleDescriptionImpl.java @@ -54,6 +54,8 @@ * Height Computation Expression} *
  • {@link org.eclipse.sirius.components.view.impl.RectangularNodeStyleDescriptionImpl#isShowIcon Show * Icon}
  • + *
  • {@link org.eclipse.sirius.components.view.impl.RectangularNodeStyleDescriptionImpl#getLabelIcon Label + * Icon}
  • *
  • {@link org.eclipse.sirius.components.view.impl.RectangularNodeStyleDescriptionImpl#isWithHeader With * Header}
  • * @@ -301,6 +303,26 @@ public class RectangularNodeStyleDescriptionImpl extends StyleImpl implements Re */ protected boolean showIcon = SHOW_ICON_EDEFAULT; + /** + * The default value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected static final String LABEL_ICON_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabelIcon() Label Icon}' attribute. + * + * @see #getLabelIcon() + * @generated + * @ordered + */ + protected String labelIcon = LABEL_ICON_EDEFAULT; + /** * The default value of the '{@link #isWithHeader() With Header}' attribute. @@ -675,6 +697,29 @@ public void setShowIcon(boolean newShowIcon) { this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON, oldShowIcon, this.showIcon)); } + /** + * + * + * @generated + */ + @Override + public String getLabelIcon() { + return this.labelIcon; + } + + /** + * + * + * @generated + */ + @Override + public void setLabelIcon(String newLabelIcon) { + String oldLabelIcon = this.labelIcon; + this.labelIcon = newLabelIcon; + if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON, oldLabelIcon, this.labelIcon)); + } + /** * * @@ -736,6 +781,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getHeightComputationExpression(); case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.isShowIcon(); + case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return this.getLabelIcon(); case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER: return this.isWithHeader(); } @@ -789,6 +836,9 @@ public void eSet(int featureID, Object newValue) { case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon((Boolean) newValue); return; + case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon((String) newValue); + return; case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER: this.setWithHeader((Boolean) newValue); return; @@ -843,6 +893,9 @@ public void eUnset(int featureID) { case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON: this.setShowIcon(SHOW_ICON_EDEFAULT); return; + case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON: + this.setLabelIcon(LABEL_ICON_EDEFAULT); + return; case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER: this.setWithHeader(WITH_HEADER_EDEFAULT); return; @@ -884,6 +937,8 @@ public boolean eIsSet(int featureID) { return HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT == null ? this.heightComputationExpression != null : !HEIGHT_COMPUTATION_EXPRESSION_EDEFAULT.equals(this.heightComputationExpression); case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__SHOW_ICON: return this.showIcon != SHOW_ICON_EDEFAULT; + case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__LABEL_ICON: + return LABEL_ICON_EDEFAULT == null ? this.labelIcon != null : !LABEL_ICON_EDEFAULT.equals(this.labelIcon); case ViewPackage.RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER: return this.withHeader != WITH_HEADER_EDEFAULT; } @@ -1003,6 +1058,8 @@ public String toString() { result.append(this.heightComputationExpression); result.append(", showIcon: "); result.append(this.showIcon); + result.append(", labelIcon: "); + result.append(this.labelIcon); result.append(", withHeader: "); result.append(this.withHeader); result.append(')'); 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 99840a24bc..14421d368a 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 @@ -1554,6 +1554,16 @@ public EAttribute getNodeStyleDescription_ShowIcon() { return (EAttribute) this.nodeStyleDescriptionEClass.getEStructuralFeatures().get(3); } + /** + * + * + * @generated + */ + @Override + public EAttribute getNodeStyleDescription_LabelIcon() { + return (EAttribute) this.nodeStyleDescriptionEClass.getEStructuralFeatures().get(4); + } + /** * * @@ -1694,6 +1704,16 @@ public EAttribute getEdgeStyle_ShowIcon() { return (EAttribute) this.edgeStyleEClass.getEStructuralFeatures().get(4); } + /** + * + * + * @generated + */ + @Override + public EAttribute getEdgeStyle_LabelIcon() { + return (EAttribute) this.edgeStyleEClass.getEStructuralFeatures().get(5); + } + /** * * @@ -3952,6 +3972,7 @@ public void createPackageContents() { this.createEAttribute(this.nodeStyleDescriptionEClass, NODE_STYLE_DESCRIPTION__WIDTH_COMPUTATION_EXPRESSION); this.createEAttribute(this.nodeStyleDescriptionEClass, NODE_STYLE_DESCRIPTION__HEIGHT_COMPUTATION_EXPRESSION); this.createEAttribute(this.nodeStyleDescriptionEClass, NODE_STYLE_DESCRIPTION__SHOW_ICON); + this.createEAttribute(this.nodeStyleDescriptionEClass, NODE_STYLE_DESCRIPTION__LABEL_ICON); this.rectangularNodeStyleDescriptionEClass = this.createEClass(RECTANGULAR_NODE_STYLE_DESCRIPTION); this.createEAttribute(this.rectangularNodeStyleDescriptionEClass, RECTANGULAR_NODE_STYLE_DESCRIPTION__WITH_HEADER); @@ -3973,6 +3994,7 @@ public void createPackageContents() { this.createEAttribute(this.edgeStyleEClass, EDGE_STYLE__TARGET_ARROW_STYLE); this.createEAttribute(this.edgeStyleEClass, EDGE_STYLE__EDGE_WIDTH); this.createEAttribute(this.edgeStyleEClass, EDGE_STYLE__SHOW_ICON); + this.createEAttribute(this.edgeStyleEClass, EDGE_STYLE__LABEL_ICON); this.toolEClass = this.createEClass(TOOL); this.createEAttribute(this.toolEClass, TOOL__NAME); @@ -4520,6 +4542,8 @@ public void initializePackageContents() { !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getNodeStyleDescription_ShowIcon(), this.ecorePackage.getEBoolean(), "showIcon", null, 0, 1, NodeStyleDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getNodeStyleDescription_LabelIcon(), this.ecorePackage.getEString(), "labelIcon", null, 0, 1, NodeStyleDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, + !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.rectangularNodeStyleDescriptionEClass, RectangularNodeStyleDescription.class, "RectangularNodeStyleDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getRectangularNodeStyleDescription_WithHeader(), this.ecorePackage.getEBoolean(), "withHeader", null, 0, 1, RectangularNodeStyleDescription.class, !IS_TRANSIENT, @@ -4549,6 +4573,8 @@ public void initializePackageContents() { !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getEdgeStyle_ShowIcon(), this.ecorePackage.getEBoolean(), "showIcon", "false", 0, 1, EdgeStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEAttribute(this.getEdgeStyle_LabelIcon(), this.ecorePackage.getEString(), "labelIcon", null, 0, 1, EdgeStyle.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.toolEClass, Tool.class, "Tool", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEAttribute(this.getTool_Name(), this.getIdentifier(), "name", "Tool", 1, 1, Tool.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, 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 10c0b2011a..5d32b274c7 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 @@ -130,6 +130,7 @@ + @@ -156,6 +157,7 @@ eType="#//Length" defaultValueLiteral="1"/> + 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 2311acb417..a8e97f9fd6 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 @@ -139,6 +139,7 @@ + @@ -156,6 +157,7 @@ +