From 1e4bef73e8fc597a4991a980877b37d4d968489c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20B=C3=A9gaudeau?= Date: Mon, 24 Jun 2024 15:41:43 +0200 Subject: [PATCH] [3649] Restore support for Related elements view icons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-web/issues/3649 Signed-off-by: Stéphane Bégaudeau --- CHANGELOG.adoc | 1 + .../services/ExplorerDescriptionProvider.java | 3 +-- .../services/ExplorerImagePathService.java | 6 +++--- .../CurrentTreeDescriptionProvider.java | 6 +++--- .../IncomingTreeDescriptionProvider.java | 4 ++-- .../OutgoingTreeDescriptionProvider.java | 4 ++-- .../RelatedElementsImagePathService.java} | 21 +++++++++++-------- .../{icons/svg => explorer}/Resource.svg | 0 .../arrow_downward_black_24dp.svg | 0 .../east_black_24dp.svg | 0 .../folder_black_24dp.svg | 0 .../subdirectory_arrow_right_black_24dp.svg | 0 .../west_black_24dp.svg | 0 13 files changed, 24 insertions(+), 21 deletions(-) rename packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/{images => views/explorer}/services/ExplorerImagePathService.java (85%) rename packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/{images/ImageConstants.java => views/relatedelements/services/RelatedElementsImagePathService.java} (55%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => explorer}/Resource.svg (100%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => related-elements}/arrow_downward_black_24dp.svg (100%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => related-elements}/east_black_24dp.svg (100%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => related-elements}/folder_black_24dp.svg (100%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => related-elements}/subdirectory_arrow_right_black_24dp.svg (100%) rename packages/sirius-web/backend/sirius-web-application/src/main/resources/{icons/svg => related-elements}/west_black_24dp.svg (100%) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index ffd2f553d85..fa0cb0d46a4 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -64,6 +64,7 @@ More existing APIs will be migrated to this new common pattern. - https://github.com/eclipse-sirius/sirius-web/issues/3624[#3624] [diagram] Fix an issue where the header separator does not fill the entire width of the node - https://github.com/eclipse-sirius/sirius-web/issues/3531[#3531] [diagram] Fix unnecessary edges label re render - https://github.com/eclipse-sirius/sirius-web/issues/3650[#3650] [diagram] Fix potential NPE in DiagramNavigator and Node toString method +- https://github.com/eclipse-sirius/sirius-web/issues/3649[#3649] [sirius-web] Restore support for Related elements view icons === New Features diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java index 0743f344430..a328d89c5a8 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerDescriptionProvider.java @@ -37,7 +37,6 @@ import org.eclipse.sirius.components.trees.TreeItem; import org.eclipse.sirius.components.trees.description.TreeDescription; import org.eclipse.sirius.components.trees.renderer.TreeRenderer; -import org.eclipse.sirius.web.application.images.ImageConstants; import org.eclipse.sirius.web.application.views.explorer.services.api.IDeleteTreeItemHandler; import org.eclipse.sirius.web.application.views.explorer.services.api.IExplorerChildrenProvider; import org.eclipse.sirius.web.application.views.explorer.services.api.IExplorerElementsProvider; @@ -222,7 +221,7 @@ private List getImageURL(VariableManager variableManager) { .flatMap(Optional::stream) .toList(); } else if (self instanceof Resource) { - imageURL = List.of(ImageConstants.RESOURCE_SVG); + imageURL = List.of("/explorer/Resource.svg"); } return imageURL; } diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/services/ExplorerImagePathService.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerImagePathService.java similarity index 85% rename from packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/services/ExplorerImagePathService.java rename to packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerImagePathService.java index 1045136bf33..827eb960a85 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/services/ExplorerImagePathService.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/explorer/services/ExplorerImagePathService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 Obeo. + * Copyright (c) 2024, 2024 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.web.application.images.services; +package org.eclipse.sirius.web.application.views.explorer.services; import java.util.List; @@ -26,6 +26,6 @@ public class ExplorerImagePathService implements IImagePathService { @Override public List getPaths() { - return List.of("/icons/svg"); + return List.of("/explorer"); } } diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/CurrentTreeDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/CurrentTreeDescriptionProvider.java index 1d4fb027309..832670c19c4 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/CurrentTreeDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/CurrentTreeDescriptionProvider.java @@ -63,11 +63,11 @@ public class CurrentTreeDescriptionProvider implements ICurrentTreeDescriptionPr private static final String TITLE = "Current"; - private static final String WIDGET_ICON_URL = "/icons/svg/arrow_downward_black_24dp.svg"; + private static final String WIDGET_ICON_URL = "/related-elements/arrow_downward_black_24dp.svg"; - private static final String FOLDER_ICON_URL = "/icons/svg/folder_black_24dp.svg"; + private static final String FOLDER_ICON_URL = "/related-elements/folder_black_24dp.svg"; - private static final String CHILDREN_CATEGORY_ICON_URL = "/icons/svg/subdirectory_arrow_right_black_24dp.svg"; + private static final String CHILDREN_CATEGORY_ICON_URL = "/related-elements/subdirectory_arrow_right_black_24dp.svg"; private static final String CATEGORY_KIND = "siriusWeb://category"; diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/IncomingTreeDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/IncomingTreeDescriptionProvider.java index 2491d108963..c0231c8d308 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/IncomingTreeDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/IncomingTreeDescriptionProvider.java @@ -53,9 +53,9 @@ public class IncomingTreeDescriptionProvider implements IIncomingTreeDescription private static final String TITLE = "Incoming"; - private static final String WIDGET_ICON_URL = "/images/west_black_24dp.svg"; + private static final String WIDGET_ICON_URL = "/related-elements/west_black_24dp.svg"; - private static final String INCOMING_REFERENCE_ICON_URL = "/images/west_black_24dp.svg"; + private static final String INCOMING_REFERENCE_ICON_URL = "/related-elements/west_black_24dp.svg"; private static final String INCOMING_REFERENCES_KIND = "siriusWeb://category/incoming-references"; diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/OutgoingTreeDescriptionProvider.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/OutgoingTreeDescriptionProvider.java index 84096fdd11d..0bb010ad9ce 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/OutgoingTreeDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/OutgoingTreeDescriptionProvider.java @@ -56,9 +56,9 @@ public class OutgoingTreeDescriptionProvider implements IOutgoingTreeDescription private static final String TITLE = "Outgoing"; - private static final String WIDGET_ICON_URL = "/icons/svg/east_black_24dp.svg"; + private static final String WIDGET_ICON_URL = "/related-elements/east_black_24dp.svg"; - private static final String OUTGOING_REFERENCE_ICON_URL = "/icons/svg/east_black_24dp.svg"; + private static final String OUTGOING_REFERENCE_ICON_URL = "/related-elements/east_black_24dp.svg"; private static final String OUTGOING_REFERENCE_KIND = "siriusWeb://category/outgoing-references"; diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/ImageConstants.java b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/RelatedElementsImagePathService.java similarity index 55% rename from packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/ImageConstants.java rename to packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/RelatedElementsImagePathService.java index 4491516d019..10dcfee54b4 100644 --- a/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/images/ImageConstants.java +++ b/packages/sirius-web/backend/sirius-web-application/src/main/java/org/eclipse/sirius/web/application/views/relatedelements/services/RelatedElementsImagePathService.java @@ -10,19 +10,22 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.web.application.images; +package org.eclipse.sirius.web.application.views.relatedelements.services; + +import java.util.List; + +import org.eclipse.sirius.components.core.api.IImagePathService; +import org.springframework.stereotype.Service; /** - * Utility class containing constants for the images of Sirius Web. + * Used to allow access to the images of the related elements view. * * @author sbegaudeau */ -public final class ImageConstants { - public static final String IMAGES_ROOT_FOLDER = "/icons/svg"; - - public static final String RESOURCE_SVG = IMAGES_ROOT_FOLDER + "/Resource.svg"; - - private ImageConstants() { - // Prevent instantiation +@Service +public class RelatedElementsImagePathService implements IImagePathService { + @Override + public List getPaths() { + return List.of("/related-elements"); } } diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/Resource.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/explorer/Resource.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/Resource.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/explorer/Resource.svg diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/arrow_downward_black_24dp.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/arrow_downward_black_24dp.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/arrow_downward_black_24dp.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/arrow_downward_black_24dp.svg diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/east_black_24dp.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/east_black_24dp.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/east_black_24dp.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/east_black_24dp.svg diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/folder_black_24dp.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/folder_black_24dp.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/folder_black_24dp.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/folder_black_24dp.svg diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/subdirectory_arrow_right_black_24dp.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/subdirectory_arrow_right_black_24dp.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/subdirectory_arrow_right_black_24dp.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/subdirectory_arrow_right_black_24dp.svg diff --git a/packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/west_black_24dp.svg b/packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/west_black_24dp.svg similarity index 100% rename from packages/sirius-web/backend/sirius-web-application/src/main/resources/icons/svg/west_black_24dp.svg rename to packages/sirius-web/backend/sirius-web-application/src/main/resources/related-elements/west_black_24dp.svg