diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/DescriptionHelper.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/DescriptionHelper.java index 1aeececd2..7defbba5b 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/DescriptionHelper.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/model/description/helpers/DescriptionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2023 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -13,6 +13,7 @@ package org.eclipse.wb.internal.core.model.description.helpers; import org.eclipse.wb.internal.core.BundleResourceProvider; +import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.EnvironmentUtils; import org.eclipse.wb.internal.core.model.description.IToolkitProvider; import org.eclipse.wb.internal.core.model.description.ToolkitDescription; @@ -121,7 +122,15 @@ public static synchronized void validateComponentDescription(ResourceInfo resour // Utils // //////////////////////////////////////////////////////////////////////////// - public static final String[] ICON_EXTS = new String[]{".png", ".gif"}; + public static final String[] ICON_EXTS; + + static { + if (DesignerPlugin.isSvgSupported()) { + ICON_EXTS = new String[] { ".svg", ".png", ".gif" }; + } else { + ICON_EXTS = new String[] { ".png", ".gif" }; + } + } /** * @return the icon {@link ImageDescriptor} for given component. diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ui/dialogs/image/pages/browse/AbstractBrowseImagePage.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ui/dialogs/image/pages/browse/AbstractBrowseImagePage.java index 30eb2206e..b9433b01a 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ui/dialogs/image/pages/browse/AbstractBrowseImagePage.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/utils/ui/dialogs/image/pages/browse/AbstractBrowseImagePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.wb.internal.core.utils.ui.dialogs.image.pages.browse; +import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.utils.ui.GridDataFactory; import org.eclipse.wb.internal.core.utils.ui.GridLayoutFactory; import org.eclipse.wb.internal.core.utils.ui.dialogs.image.AbstractImageDialog; @@ -222,6 +223,9 @@ public static boolean isImageExtension(String extension) { if (extension == null) { return false; } + if (DesignerPlugin.isSvgSupported() && extension.equalsIgnoreCase("svg")) { + return true; + } return extension.equalsIgnoreCase("gif") || extension.equalsIgnoreCase("png") || extension.equalsIgnoreCase("jpg") diff --git a/org.eclipse.wb.dev/META-INF/MANIFEST.MF b/org.eclipse.wb.dev/META-INF/MANIFEST.MF index e0917d27f..39c57cea8 100644 --- a/org.eclipse.wb.dev/META-INF/MANIFEST.MF +++ b/org.eclipse.wb.dev/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Designer internal developers Plug-in Bundle-SymbolicName: org.eclipse.wb.dev;singleton:=true -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.wb.internal.dev.Activator Bundle-Vendor: Eclipse.org Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.31.100,4.0.0)", diff --git a/org.eclipse.wb.dev/src/org/eclipse/wb/internal/dev/builder/MetaDataModificationHandler.java b/org.eclipse.wb.dev/src/org/eclipse/wb/internal/dev/builder/MetaDataModificationHandler.java index 2f6a0fd34..5907e0f10 100644 --- a/org.eclipse.wb.dev/src/org/eclipse/wb/internal/dev/builder/MetaDataModificationHandler.java +++ b/org.eclipse.wb.dev/src/org/eclipse/wb/internal/dev/builder/MetaDataModificationHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2025 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -114,12 +114,19 @@ private static boolean processResource(IResource resource) { private static boolean isInterestingResource(IResource resource) { if (resource instanceof IFile) { String path = resource.getFullPath().toPortableString().toLowerCase(); - return path.contains("/wbp-meta/") - && (path.endsWith(".wbp-component.xml") || path.endsWith(".png") || path.endsWith(".gif")); + return path.contains("/wbp-meta/") && (isComponent(path) || isImage(path)); } return false; } + private static boolean isImage(String path) { + return path.endsWith(".svg") || path.endsWith(".png") || path.endsWith(".gif"); + } + + private static boolean isComponent(String path) { + return path.endsWith(".wbp-component.xml"); + } + private static String getMetaDataCheckSum(IProject project) throws Exception { MessageDigest algorithm = MessageDigest.getInstance("MD5"); // add files diff --git a/org.eclipse.wb.doc.user/html-src/whatsnew/v120.asciidoc b/org.eclipse.wb.doc.user/html-src/whatsnew/v120.asciidoc index f480f1dd2..983eb2838 100644 --- a/org.eclipse.wb.doc.user/html-src/whatsnew/v120.asciidoc +++ b/org.eclipse.wb.doc.user/html-src/whatsnew/v120.asciidoc @@ -17,8 +17,18 @@ a better integration into the table. | image:images/1.20/PropertyTable_New.png[1.20 and newer] |=== +Palette contributions may now also use SVGs as icons. If both an SVG and a PNG +exist, the SVG file takes precedence if and only if SVGs are supported by the +current Eclipse version. + == Swing - Added conversion support for `java.awt.Cursor`, `java.awt.Font` and `java.awt.ComponentOrientation` in the Customizer. +== SWT + +- Support for SVGs as image data if using Eclipse 2025-06 or newer. + +image:images/1.20/SVG_Support.png[Image Chooser with SVG selection] + What's new - xref:v119.adoc[*v1.19.0*] \ No newline at end of file diff --git a/org.eclipse.wb.doc.user/html/whatsnew/images/1.20/SVG_Support.png b/org.eclipse.wb.doc.user/html/whatsnew/images/1.20/SVG_Support.png new file mode 100644 index 000000000..db90929d8 Binary files /dev/null and b/org.eclipse.wb.doc.user/html/whatsnew/images/1.20/SVG_Support.png differ diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/property/editor/image/plugin/BundleImageContainer.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/property/editor/image/plugin/BundleImageContainer.java index 3b5c954bd..d2ff66e7e 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/property/editor/image/plugin/BundleImageContainer.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/model/property/editor/image/plugin/BundleImageContainer.java @@ -13,6 +13,7 @@ package org.eclipse.wb.internal.swt.model.property.editor.image.plugin; import org.eclipse.wb.core.editor.constants.CoreImages; +import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.utils.ui.dialogs.image.pages.browse.model.IHasChildren; import org.eclipse.wb.internal.core.utils.ui.dialogs.image.pages.browse.model.IImageContainer; import org.eclipse.wb.internal.core.utils.ui.dialogs.image.pages.browse.model.IImageElement; @@ -32,7 +33,16 @@ * @coverage swt.property.editor.plugin */ public class BundleImageContainer extends ImageContainer implements IHasChildren { - private static final String[] PATTERNS = {".gif", ".png", ".jpg", ".jpeg", ".bmp", ".ico"}; + private static final String[] PATTERNS; + + static { + if (DesignerPlugin.isSvgSupported()) { + PATTERNS = new String[] { ".svg", ".gif", ".png", ".jpg", ".jpeg", ".bmp", ".ico" }; + } else { + PATTERNS = new String[] { ".gif", ".png", ".jpg", ".jpeg", ".bmp", ".ico" }; + } + } + private final String m_name; private final Bundle m_bundle; private final String m_symbolicName;