diff --git a/org.eclipse.wb.core.java/META-INF/MANIFEST.MF b/org.eclipse.wb.core.java/META-INF/MANIFEST.MF index 39624580b..3f45a7981 100755 --- a/org.eclipse.wb.core.java/META-INF/MANIFEST.MF +++ b/org.eclipse.wb.core.java/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wb.core.java;singleton:=true -Bundle-Version: 1.9.4.qualifier +Bundle-Version: 1.10.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.wb.internal.core.java.Activator Bundle-Vendor: %providerName diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/EntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/EntryInfo.java index a483c6679..f6e0b1168 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/EntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/EntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.wb.internal.core.utils.state.EditorState; import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Model of entry on palette. @@ -62,7 +62,7 @@ public boolean isEnabled() { /** * @return the icon for visual. */ - public abstract Image getIcon(); + public abstract ImageDescriptor getIcon(); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ChooseComponentEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ChooseComponentEntryInfo.java index 203e9daed..c8c1abde3 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ChooseComponentEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ChooseComponentEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ import org.eclipse.wb.internal.core.utils.jdt.ui.JdtUiUtils; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.widgets.Shell; import java.text.MessageFormat; @@ -40,7 +40,7 @@ * @coverage core.editor.palette */ public final class ChooseComponentEntryInfo extends ToolEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/ChooseComponent.gif"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/ChooseComponent.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -58,7 +58,7 @@ public ChooseComponentEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java index e4c0c8080..da50dc610 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/ComponentEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -49,6 +49,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.window.Window; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; @@ -70,7 +71,7 @@ */ public final class ComponentEntryInfo extends ToolEntryInfo { public static final String KEY_SIMULATE_PRESENTATION = "ComponentEntryInfo.simulatePresentation"; - public static final Image DEFAULT_ICON = DesignerPlugin.getImage("palette/Object.png"); + public static final ImageDescriptor DEFAULT_ICON = DesignerPlugin.getImageDescriptor("palette/Object.png"); private String m_className; private String m_creationId; private String m_enabledScript; @@ -308,11 +309,11 @@ public Boolean runObject() throws Exception { } @Override - public Image getIcon() { + public ImageDescriptor getIcon() { if (m_icon == null) { return DEFAULT_ICON; } - return m_icon; + return ImageDescriptor.createFromImage(m_icon); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/MarqueeSelectionToolEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/MarqueeSelectionToolEntryInfo.java index 310070c04..cb80d890e 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/MarqueeSelectionToolEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/MarqueeSelectionToolEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.editor.Messages; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link EntryInfo} that activates {@link MarqueeSelectionTool}. @@ -25,7 +25,7 @@ * @coverage core.editor.palette */ public final class MarqueeSelectionToolEntryInfo extends ToolEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/MarqueeSelectionTool.png"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/MarqueeSelectionTool.png"); private final MarqueeSelectionTool m_marqueeSelectionTool = new MarqueeSelectionTool(); //////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ public MarqueeSelectionToolEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/SelectionToolEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/SelectionToolEntryInfo.java index c260377ae..690236053 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/SelectionToolEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/SelectionToolEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.core.editor.Messages; import org.eclipse.wb.internal.core.editor.palette.model.entry.IDefaultEntryInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link EntryInfo} that activates {@link SelectionTool}. @@ -26,7 +26,7 @@ * @coverage core.editor.palette */ public class SelectionToolEntryInfo extends ToolEntryInfo implements IDefaultEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/SelectionTool.gif"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/SelectionTool.gif"); private final SelectionTool m_selectionTool = new SelectionTool(); //////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ public SelectionToolEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/TabOrderToolEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/TabOrderToolEntryInfo.java index c93632844..bb3c228e4 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/TabOrderToolEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/core/editor/palette/model/entry/TabOrderToolEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.core.editor.Messages; import org.eclipse.wb.internal.core.gef.tools.TabOrderTool; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import java.util.List; @@ -28,7 +28,7 @@ * @coverage core.editor.palette */ public final class TabOrderToolEntryInfo extends ToolEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/tab_order.gif"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/tab_order.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -58,7 +58,7 @@ public Tool createTool() throws Exception { } @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } } \ No newline at end of file diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java index d5eb3dfa3..037f93912 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/DesignerPalette.java @@ -278,7 +278,7 @@ public boolean isEnabled() { @Override public ImageDescriptor getIcon() { - return ImageDescriptor.createFromImage(entryInfo.getIcon()); + return entryInfo.getIcon(); } @Override diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/dialogs/PaletteManagerDialog.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/dialogs/PaletteManagerDialog.java index 5b1e0cc15..0026f6b2c 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/dialogs/PaletteManagerDialog.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/dialogs/PaletteManagerDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,6 +44,9 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTreeViewer; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -85,6 +88,7 @@ import java.text.MessageFormat; import java.util.List; +import java.util.Optional; import java.util.Set; /** @@ -355,10 +359,20 @@ private void createViewer(Composite parent) { // providers m_viewer.setContentProvider(m_contentProvider); m_viewer.setLabelProvider(new LabelProvider() { + private final ResourceManager m_resourceManager = new LocalResourceManager(JFaceResources.getResources()); + + @Override + public void dispose() { + super.dispose(); + m_resourceManager.dispose(); + } + @Override public Image getImage(Object element) { if (element instanceof EntryInfo) { - return ((EntryInfo) element).getIcon(); + return Optional.ofNullable(((EntryInfo) element).getIcon()) // + .map(m_resourceManager::createImage) // + .orElse(null); } return IMAGE_CATEGORY; } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/model/entry/FactoryEntryInfo.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/model/entry/FactoryEntryInfo.java index 349fb9ef7..54c361ee3 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/model/entry/FactoryEntryInfo.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/palette/model/entry/FactoryEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,6 +27,7 @@ import org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils; import org.eclipse.wb.internal.core.utils.state.EditorWarning; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.apache.commons.lang.StringUtils; @@ -229,8 +230,8 @@ protected final boolean ensureComponentDescription() { } @Override - public final Image getIcon() { - return m_icon; + public final ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(m_icon); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java index 4af829bae..5a7849333 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/DesignerPalette.java @@ -262,7 +262,7 @@ public boolean isEnabled() { @Override public ImageDescriptor getIcon() { - return ImageDescriptor.createFromImage(entryInfo.getIcon()); + return entryInfo.getIcon(); } @Override diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/dialogs/PaletteManagerDialog.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/dialogs/PaletteManagerDialog.java index a6e750035..6530be6b7 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/dialogs/PaletteManagerDialog.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/dialogs/PaletteManagerDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,6 +38,9 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTreeViewer; import org.eclipse.jface.viewers.DoubleClickEvent; @@ -79,6 +82,7 @@ import java.text.MessageFormat; import java.util.List; +import java.util.Optional; import java.util.Set; /** @@ -351,10 +355,20 @@ private void createViewer(Composite parent) { // providers m_viewer.setContentProvider(m_contentProvider); m_viewer.setLabelProvider(new LabelProvider() { + private final ResourceManager m_resourceManager = new LocalResourceManager(JFaceResources.getResources()); + + @Override + public void dispose() { + super.dispose(); + m_resourceManager.dispose(); + } + @Override public Image getImage(Object element) { if (element instanceof EntryInfo) { - return ((EntryInfo) element).getIcon(); + return Optional.ofNullable(((EntryInfo) element).getIcon()) // + .map(m_resourceManager::createImage) // + .orElse(null); } return IMAGE_CATEGORY; } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ChooseComponentEntryInfo.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ChooseComponentEntryInfo.java index b7fc8fc78..2a4651ce0 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ChooseComponentEntryInfo.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ChooseComponentEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.wb.internal.core.xml.editor.palette.command.Command; import org.eclipse.wb.internal.core.xml.editor.palette.command.ComponentAddCommand; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.widgets.Shell; import java.text.MessageFormat; @@ -34,7 +34,7 @@ * @coverage XML.editor.palette */ public final class ChooseComponentEntryInfo extends ToolEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/ChooseComponent.gif"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/ChooseComponent.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -52,7 +52,7 @@ public ChooseComponentEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ComponentEntryInfo.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ComponentEntryInfo.java index 216a60958..941257d27 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ComponentEntryInfo.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/ComponentEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,6 +40,7 @@ import org.eclipse.wb.internal.core.xml.model.utils.XmlObjectUtils; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; @@ -58,7 +59,7 @@ */ public final class ComponentEntryInfo extends ToolEntryInfo { public static final String KEY_SIMULATE_PRESENTATION = "ComponentEntryInfo.simulatePresentation"; - public static final Image DEFAULT_ICON = DesignerPlugin.getImage("palette/Object.png"); + public static final ImageDescriptor DEFAULT_ICON = DesignerPlugin.getImageDescriptor("palette/Object.png"); private String m_className; private String m_creationId; private String m_enabledScript; @@ -296,11 +297,11 @@ public Boolean runObject() throws Exception { } @Override - public Image getIcon() { + public ImageDescriptor getIcon() { if (m_icon == null) { return DEFAULT_ICON; } - return m_icon; + return ImageDescriptor.createFromImage(m_icon); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/EntryInfo.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/EntryInfo.java index 8d20164ae..982a850a7 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/EntryInfo.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/EntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,7 +15,7 @@ import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Model of entry on palette. @@ -59,7 +59,7 @@ public boolean isEnabled() { /** * @return the icon for visual. */ - public abstract Image getIcon(); + public abstract ImageDescriptor getIcon(); //////////////////////////////////////////////////////////////////////////// // diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/MarqueeSelectionToolEntryInfo.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/MarqueeSelectionToolEntryInfo.java index e861511b6..35f578b6a 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/MarqueeSelectionToolEntryInfo.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/MarqueeSelectionToolEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,7 +15,7 @@ import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.xml.Messages; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link EntryInfo} that activates {@link MarqueeSelectionTool}. @@ -24,7 +24,7 @@ * @coverage XML.editor.palette */ public final class MarqueeSelectionToolEntryInfo extends ToolEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/MarqueeSelectionTool.png"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/MarqueeSelectionTool.png"); private final MarqueeSelectionTool m_marqueeSelectionTool = new MarqueeSelectionTool(); //////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ public MarqueeSelectionToolEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/SelectionToolEntryInfo.java b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/SelectionToolEntryInfo.java index 802c71673..2cacef816 100644 --- a/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/SelectionToolEntryInfo.java +++ b/org.eclipse.wb.core.xml/src/org/eclipse/wb/internal/core/xml/editor/palette/model/SelectionToolEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.wb.internal.core.editor.palette.model.entry.IDefaultEntryInfo; import org.eclipse.wb.internal.core.xml.Messages; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link EntryInfo} that activates {@link SelectionTool}. @@ -25,7 +25,7 @@ * @coverage XML.editor.palette */ public class SelectionToolEntryInfo extends ToolEntryInfo implements IDefaultEntryInfo { - private static final Image ICON = DesignerPlugin.getImage("palette/SelectionTool.gif"); + private static final ImageDescriptor ICON = DesignerPlugin.getImageDescriptor("palette/SelectionTool.gif"); private final SelectionTool m_selectionTool = new SelectionTool(); //////////////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ public SelectionToolEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/UiUtils.java b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/UiUtils.java index 9d64bfc49..04dc79dda 100644 --- a/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/UiUtils.java +++ b/org.eclipse.wb.core/src/org/eclipse/wb/internal/core/utils/ui/UiUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.MenuAdapter; @@ -544,8 +545,32 @@ public static boolean equals(Image image_1, Image image_2) { return false; } // check ImageData's - ImageData imageData_1 = image_1.getImageData(); - ImageData imageData_2 = image_2.getImageData(); + return equals(image_1.getImageData(), image_2.getImageData()); + } + + /** + * @return true if two {@link ImageDescriptor}'s are equal. + */ + public static boolean equals(ImageDescriptor imageDesc_1, ImageDescriptor imageDesc_2) { + // try to compare as plain Object's + if (ObjectUtils.equals(imageDesc_1, imageDesc_2)) { + return true; + } + // compare bounds + if (imageDesc_1.getImageData(100).width != imageDesc_2.getImageData(100).width) { + return false; + } + if (imageDesc_1.getImageData(100).height != imageDesc_2.getImageData(100).height) { + return false; + } + // check ImageData's + return equals(imageDesc_1.getImageData(100), imageDesc_2.getImageData(100)); + } + + /** + * @return true if two {@link ImageData}'s are equal. + */ + private static boolean equals(ImageData imageData_1, ImageData imageData_2) { if (imageData_1.depth != imageData_2.depth) { return false; } diff --git a/org.eclipse.wb.rcp.SWT_AWT/src/org/eclipse/wb/internal/rcp/swtawt/palette/SwingCompositeEntryInfo.java b/org.eclipse.wb.rcp.SWT_AWT/src/org/eclipse/wb/internal/rcp/swtawt/palette/SwingCompositeEntryInfo.java index ce8fba445..065b9e2d4 100644 --- a/org.eclipse.wb.rcp.SWT_AWT/src/org/eclipse/wb/internal/rcp/swtawt/palette/SwingCompositeEntryInfo.java +++ b/org.eclipse.wb.rcp.SWT_AWT/src/org/eclipse/wb/internal/rcp/swtawt/palette/SwingCompositeEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,9 +29,9 @@ import org.eclipse.wb.internal.swing.model.component.ContainerInfo; import org.eclipse.wb.internal.swing.model.layout.BorderLayoutInfo; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.awt.SWT_AWT; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import java.awt.BorderLayout; @@ -46,7 +46,7 @@ * @coverage rcp.editor.palette */ public final class SwingCompositeEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/SWT_AWT/Composite_SWT_AWT.png"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/SWT_AWT/Composite_SWT_AWT.png"); //////////////////////////////////////////////////////////////////////////// // @@ -65,7 +65,7 @@ public SwingCompositeEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/Activator.java b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/Activator.java index 58e146d7a..dc9a68103 100644 --- a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/Activator.java +++ b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ import org.eclipse.wb.internal.core.BundleResourceProvider; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -69,4 +70,11 @@ public static Activator getDefault() { public static Image getImage(String path) { return m_resourceProvider.getImage(path); } + + /** + * @return the {@link ImageDescriptor} from "/" directory, with caching. + */ + public static ImageDescriptor getImageDescriptor(String path) { + return m_resourceProvider.getImageDescriptor(path); + } } diff --git a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/collapsiblebuttons/CollapsibleButtonEntryInfo.java b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/collapsiblebuttons/CollapsibleButtonEntryInfo.java index 5da6ace2a..bc9b863e2 100644 --- a/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/collapsiblebuttons/CollapsibleButtonEntryInfo.java +++ b/org.eclipse.wb.rcp.nebula/src/org/eclipse/wb/internal/rcp/nebula/collapsiblebuttons/CollapsibleButtonEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.wb.internal.rcp.nebula.Activator; import org.eclipse.wb.internal.rcp.nebula.Messages; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * {@link EntryInfo} that allows user to drop new {@link CustomButton} on {@link CollapsibleButtons} @@ -29,8 +29,8 @@ * @coverage nebula.palette */ public final class CollapsibleButtonEntryInfo extends ToolEntryInfo { - private static final Image ICON = - Activator.getImage("wbp-meta/org/eclipse/nebula/widgets/collapsiblebuttons/CustomButton.png"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("wbp-meta/org/eclipse/nebula/widgets/collapsiblebuttons/CustomButton.png"); //////////////////////////////////////////////////////////////////////////// // @@ -48,7 +48,7 @@ public CollapsibleButtonEntryInfo() throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionExternalEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionExternalEntryInfo.java index df683be05..b98e5cd29 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionExternalEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionExternalEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.wb.internal.rcp.model.jface.action.ActionInfo; import org.eclipse.jdt.core.IType; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import javax.swing.Action; @@ -34,7 +34,7 @@ * @coverage rcp.editor.palette */ public final class ActionExternalEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/Action/action_open.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/Action/action_open.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -53,7 +53,7 @@ public ActionExternalEntryInfo(String id) { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionFactoryNewEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionFactoryNewEntryInfo.java index 4af989ebb..d00c069b1 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionFactoryNewEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionFactoryNewEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ import org.eclipse.wb.internal.rcp.model.jface.action.ActionInfo; import org.eclipse.wb.internal.rcp.model.rcp.ActionFactoryCreationSupport; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; @@ -82,8 +83,8 @@ public ActionFactoryNewEntryInfo(String name) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { - return m_icon; + public ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(m_icon); } @Override diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionNewEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionNewEntryInfo.java index 585693030..e814fe30b 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionNewEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionNewEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import org.eclipse.wb.internal.rcp.model.jface.action.ActionContainerInfo; import org.eclipse.wb.internal.rcp.model.jface.action.ActionInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import javax.swing.Action; @@ -30,7 +30,7 @@ * @coverage rcp.editor.palette */ public final class ActionNewEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/Action/action_new.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/Action/action_new.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -49,7 +49,7 @@ public ActionNewEntryInfo(String id) { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionUseEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionUseEntryInfo.java index fcea692de..eec518453 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionUseEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/ActionUseEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.apache.commons.lang.ObjectUtils; @@ -55,13 +56,14 @@ public ActionUseEntryInfo(ActionInfo action) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { - return ExecutionUtils.runObjectLog(new RunnableObjectEx() { - @Override - public Image runObject() throws Exception { - return m_action.getPresentation().getIcon(); - } - }, ICON); + public ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(ExecutionUtils.runObjectLog( + new RunnableObjectEx() { + @Override + public Image runObject() throws Exception { + return m_action.getPresentation().getIcon(); + } + }, ICON)); } @Override diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DialogButtonEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DialogButtonEntryInfo.java index 73054680f..a8caea07b 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DialogButtonEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DialogButtonEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.wb.internal.rcp.Activator; import org.eclipse.wb.internal.rcp.gef.policy.jface.DialogButtonDropTool; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import javax.swing.AbstractButton; import javax.swing.Action; @@ -32,7 +32,7 @@ * @coverage rcp.editor.palette */ public final class DialogButtonEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/Dialog/button.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/Dialog/button.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -51,7 +51,7 @@ public DialogButtonEntryInfo() throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DoubleFieldEditorEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DoubleFieldEditorEntryInfo.java index 2c156c5b8..f54886feb 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DoubleFieldEditorEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/DoubleFieldEditorEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,17 +16,14 @@ import org.eclipse.wb.gef.core.requests.ICreationFactory; import org.eclipse.wb.gef.core.tools.CreationTool; import org.eclipse.wb.gef.core.tools.Tool; +import org.eclipse.wb.internal.core.BundleResourceProvider; import org.eclipse.wb.internal.core.model.JavaInfoUtils; import org.eclipse.wb.internal.core.model.creation.ConstructorCreationSupport; import org.eclipse.wb.internal.core.model.creation.CreationSupport; import org.eclipse.wb.internal.core.utils.jdt.core.ProjectUtils; import org.eclipse.wb.internal.rcp.Activator; -import org.eclipse.swt.graphics.Image; - -import org.apache.commons.io.IOUtils; - -import java.io.InputStream; +import org.eclipse.jface.resource.ImageDescriptor; /** * {@link EntryInfo} for adding DoubleFieldEditor. @@ -36,16 +33,8 @@ */ public final class DoubleFieldEditorEntryInfo extends ToolEntryInfo { private static final String TYPE_NAME = "org.eclipse.wb.swt.DoubleFieldEditor"; - private static final Image ICON = loadIcon(); - - private static Image loadIcon() { - InputStream input = Activator.getFile("wbp-meta/org/eclipse/wb/swt/DoubleFieldEditor.png"); - try { - return new Image(null, input); - } finally { - IOUtils.closeQuietly(input); - } - } + private static final ImageDescriptor ICON = BundleResourceProvider.get(Activator.PLUGIN_ID) + .getImageDescriptor("wbp-meta/org/eclipse/wb/swt/DoubleFieldEditor.png"); //////////////////////////////////////////////////////////////////////////// // @@ -64,7 +53,7 @@ public DoubleFieldEditorEntryInfo() throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectivePerspectiveDropEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectivePerspectiveDropEntryInfo.java index a277b8a09..eba103425 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectivePerspectiveDropEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectivePerspectiveDropEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.rcp.model.rcp.PdeUtils.PerspectiveInfo; import org.eclipse.wb.internal.rcp.model.rcp.perspective.PageLayoutInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * {@link EntryInfo} that allows user to drop new perspective on {@link PageLayoutInfo}. @@ -46,8 +46,8 @@ public PerspectivePerspectiveDropEntryInfo(PerspectiveInfo perspective) { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { - return m_perspective.getIcon(); + public ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(m_perspective.getIcon()); } @Override diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectiveViewDropEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectiveViewDropEntryInfo.java index f1274f676..c8cf1361e 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectiveViewDropEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/PerspectiveViewDropEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.rcp.model.rcp.PdeUtils.ViewInfo; import org.eclipse.wb.internal.rcp.model.rcp.perspective.PageLayoutInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * {@link EntryInfo} that allows user to drop new view on {@link PageLayoutInfo}. @@ -46,8 +46,8 @@ public PerspectiveViewDropEntryInfo(ViewInfo view) { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { - return m_view.getIcon(); + public ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(m_view.getIcon()); } @Override diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableCompositeEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableCompositeEntryInfo.java index 761e16099..a722c6c6c 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableCompositeEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableCompositeEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Table; @@ -40,8 +40,8 @@ * @coverage rcp.editor.palette */ public final class TableCompositeEntryInfo extends ToolEntryInfo { - private static final Image ICON = - Activator.getImage("info/AbstractColumnLayout/TableComposite.gif"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("info/AbstractColumnLayout/TableComposite.gif"); private final ComponentEntryInfo m_compositeEntry; //////////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ public TableCompositeEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableViewerCompositeEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableViewerCompositeEntryInfo.java index 6c5060f20..a7c428e57 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableViewerCompositeEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TableViewerCompositeEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,8 +29,8 @@ import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Table; @@ -42,8 +42,8 @@ * @coverage rcp.editor.palette */ public final class TableViewerCompositeEntryInfo extends ToolEntryInfo { - private static final Image ICON = - Activator.getImage("info/AbstractColumnLayout/TableViewerComposite.gif"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("info/AbstractColumnLayout/TableViewerComposite.gif"); private final ComponentEntryInfo m_compositeEntry; //////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public TableViewerCompositeEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeCompositeEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeCompositeEntryInfo.java index e6f5662e7..43cc3c667 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeCompositeEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeCompositeEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; @@ -40,8 +40,8 @@ * @coverage rcp.editor.palette */ public final class TreeCompositeEntryInfo extends ToolEntryInfo { - private static final Image ICON = - Activator.getImage("info/AbstractColumnLayout/TreeComposite.gif"); + private static final ImageDescriptor ICON = + Activator.getImageDescriptor("info/AbstractColumnLayout/TreeComposite.gif"); private final ComponentEntryInfo m_compositeEntry; //////////////////////////////////////////////////////////////////////////// @@ -62,7 +62,7 @@ public TreeCompositeEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeViewerCompositeEntryInfo.java b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeViewerCompositeEntryInfo.java index 226ec4a06..ea74de4c6 100644 --- a/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeViewerCompositeEntryInfo.java +++ b/org.eclipse.wb.rcp/src/org/eclipse/wb/internal/rcp/palette/TreeViewerCompositeEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,8 +29,8 @@ import org.eclipse.wb.internal.swt.model.widgets.CompositeInfo; import org.eclipse.wb.internal.swt.model.widgets.ControlInfo; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; @@ -42,8 +42,8 @@ * @coverage rcp.editor.palette */ public final class TreeViewerCompositeEntryInfo extends ToolEntryInfo { - private static final Image ICON = - Activator.getImage("info/AbstractColumnLayout/TreeViewerComposite.gif"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("info/AbstractColumnLayout/TreeViewerComposite.gif"); private final ComponentEntryInfo m_compositeEntry; //////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public TreeViewerCompositeEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateLabelEntryInfo.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateLabelEntryInfo.java index 00ccc71e0..2637b5bc7 100644 --- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateLabelEntryInfo.java +++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateLabelEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.wb.internal.swing.FormLayout.Activator; import org.eclipse.wb.internal.swing.FormLayout.parser.DefaultComponentFactoryCreationSupport; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import com.jgoodies.forms.factories.DefaultComponentFactory; @@ -32,8 +32,8 @@ public final class DefaultComponentFactoryCreateLabelEntryInfo extends DefaultComponentFactoryEntryInfo { - private static final Image ICON = - Activator.getImage("DefaultComponentFactory/createLabel_java.lang.String_.gif"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("DefaultComponentFactory/createLabel_java.lang.String_.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -51,7 +51,7 @@ public DefaultComponentFactoryCreateLabelEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateTitleEntryInfo.java b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateTitleEntryInfo.java index 968a3db3d..9809f3752 100644 --- a/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateTitleEntryInfo.java +++ b/org.eclipse.wb.swing.FormLayout/src/org/eclipse/wb/internal/swing/FormLayout/palette/DefaultComponentFactoryCreateTitleEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -19,7 +19,7 @@ import org.eclipse.wb.internal.swing.FormLayout.Activator; import org.eclipse.wb.internal.swing.FormLayout.parser.DefaultComponentFactoryCreationSupport; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import com.jgoodies.forms.factories.DefaultComponentFactory; @@ -32,8 +32,8 @@ public final class DefaultComponentFactoryCreateTitleEntryInfo extends DefaultComponentFactoryEntryInfo { - private static final Image ICON = - Activator.getImage("DefaultComponentFactory/createTitle_java.lang.String_.gif"); + private static final ImageDescriptor ICON = Activator + .getImageDescriptor("DefaultComponentFactory/createTitle_java.lang.String_.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -51,7 +51,7 @@ public DefaultComponentFactoryCreateTitleEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/AbsoluteLayoutEntryInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/AbsoluteLayoutEntryInfo.java index ba1824e17..9fbcb4e81 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/AbsoluteLayoutEntryInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/AbsoluteLayoutEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.swing.Activator; import org.eclipse.wb.internal.swing.model.layout.absolute.AbsoluteLayoutInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link ToolEntryInfo} that adds {@link AbsoluteLayoutInfo}. @@ -26,7 +26,7 @@ * @coverage swing.editor.palette */ public final class AbsoluteLayoutEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/layout/absolute/layout.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/layout/absolute/layout.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -44,7 +44,7 @@ public AbsoluteLayoutEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionExternalEntryInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionExternalEntryInfo.java index 8f9330233..dd399966d 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionExternalEntryInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionExternalEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.wb.internal.swing.model.bean.ActionInfo; import org.eclipse.jdt.core.IType; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import javax.swing.Action; @@ -33,7 +33,7 @@ * @coverage swing.editor.palette */ public final class ActionExternalEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/Action/action_open.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/Action/action_open.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -51,7 +51,7 @@ public ActionExternalEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionNewEntryInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionNewEntryInfo.java index b46e4673b..d3d431db2 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionNewEntryInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionNewEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,7 @@ import org.eclipse.wb.internal.swing.Activator; import org.eclipse.wb.internal.swing.model.bean.ActionInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import javax.swing.Action; @@ -28,7 +28,7 @@ * @coverage swing.editor.palette */ public final class ActionNewEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/Action/action_new.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/Action/action_new.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -46,7 +46,7 @@ public ActionNewEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionUseEntryInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionUseEntryInfo.java index b7a0f5320..0eae69163 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionUseEntryInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/ActionUseEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ import org.eclipse.wb.internal.swing.model.ModelMessages; import org.eclipse.wb.internal.swing.model.bean.ActionInfo; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.apache.commons.lang.ObjectUtils; @@ -60,12 +61,14 @@ public ActionUseEntryInfo(ActionInfo action) throws Exception { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { - return ExecutionUtils.runObjectLog(new RunnableObjectEx() { - public Image runObject() throws Exception { - return m_action.getPresentation().getIcon(); - } - }, ICON); + public ImageDescriptor getIcon() { + return ImageDescriptor.createFromImage(ExecutionUtils.runObjectLog( + new RunnableObjectEx() { + @Override + public Image runObject() throws Exception { + return m_action.getPresentation().getIcon(); + } + }, ICON)); } @Override diff --git a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/SwingPaletteEntryInfo.java b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/SwingPaletteEntryInfo.java index 5cef481b6..9c2272cf6 100644 --- a/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/SwingPaletteEntryInfo.java +++ b/org.eclipse.wb.swing/src/org/eclipse/wb/internal/swing/palette/SwingPaletteEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,8 +23,8 @@ import org.eclipse.wb.internal.swing.Activator; import org.eclipse.wb.internal.swing.preferences.IPreferenceConstants; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; @@ -43,7 +43,7 @@ * @coverage swing.editor.palette */ public final class SwingPaletteEntryInfo extends EntryInfo { - private static final Image ICON = Activator.getImage("popup_palette.png"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("popup_palette.png"); //////////////////////////////////////////////////////////////////////////// // @@ -62,7 +62,7 @@ public SwingPaletteEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/palette/AbsoluteLayoutEntryInfo.java b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/palette/AbsoluteLayoutEntryInfo.java index 49fd318e1..e462c9ad9 100644 --- a/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/palette/AbsoluteLayoutEntryInfo.java +++ b/org.eclipse.wb.swt/src/org/eclipse/wb/internal/swt/palette/AbsoluteLayoutEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.wb.internal.swt.model.layout.absolute.AbsoluteLayoutCreationSupport; import org.eclipse.wb.internal.swt.model.layout.absolute.AbsoluteLayoutInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Implementation of {@link ToolEntryInfo} that adds {@link AbsoluteLayoutInfo}. @@ -29,7 +29,7 @@ * @coverage swt.editor.palette */ public final class AbsoluteLayoutEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/layout/absolute/layout.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/layout/absolute/layout.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -47,7 +47,7 @@ public AbsoluteLayoutEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ComponentEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ComponentEntryInfoTest.java index 7cee7e8f7..4fe639567 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ComponentEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ComponentEntryInfoTest.java @@ -39,6 +39,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IType; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -155,10 +156,10 @@ public void test_parse_valuesFromExtension() throws Exception { assertEquals("my name", entry.getName()); // we have icon in palette entry, so it is not "null" { - Image icon = entry.getIcon(); + ImageDescriptor icon = entry.getIcon(); assertNotNull(icon); - assertEquals(16, icon.getBounds().width); - assertEquals(16, icon.getBounds().height); + assertEquals(16, icon.getImageData(100).width); + assertEquals(16, icon.getImageData(100).height); } assertFalse(entry.isVisible()); } @@ -236,7 +237,7 @@ public void test_initialize_1_allDefaults() throws Exception { ComponentDescriptionHelper.getDescription(m_lastContext, Button.class); CreationDescription creation = componentDescription.getCreation(null); assertEquals(creation.getDescription(), entry.getDescription()); - assertTrue("Same icons.", UiUtils.equals(creation.getIcon(), entry.getIcon())); + assertTrue("Same icons.", UiUtils.equals(creation.getIcon(), (Image) ReflectionUtils.getFieldObject(entry.getIcon(), "m_icon"))); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/EntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/EntryInfoTest.java index c21111b26..b6e62d1d7 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/EntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/EntryInfoTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; import org.eclipse.wb.tests.gef.EmptyEditPartViewer; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Tests for abstract {@link EntryInfo}. @@ -37,7 +37,7 @@ public void test_0() throws Exception { // prepare ToolEntryInfo EntryInfo toolEntry = new EntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ToolEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ToolEntryInfoTest.java index 289037f03..5fc6051f6 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ToolEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/XML/palette/ToolEntryInfoTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import org.eclipse.wb.internal.core.xml.model.XmlObjectInfo; import org.eclipse.wb.tests.gef.EmptyEditPartViewer; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Tests for abstract {@link ToolEntryInfo}. @@ -40,7 +40,7 @@ public void test_activateNoTool() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } @@ -64,7 +64,7 @@ public void test_activateTool() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } @@ -88,7 +88,7 @@ public void test_activateException() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ComponentEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ComponentEntryInfoTest.java index 3dc288f6e..4fcf9bbed 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ComponentEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ComponentEntryInfoTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,6 +42,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IType; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Shell; @@ -154,10 +155,10 @@ public void test_parse_valuesFromExtension() throws Exception { assertEquals("my name", entry.getName()); // we have icon in palette entry, so it is not "null" { - Image icon = entry.getIcon(); + ImageDescriptor icon = entry.getIcon(); assertNotNull(icon); - assertEquals(16, icon.getBounds().width); - assertEquals(16, icon.getBounds().height); + assertEquals(16, icon.getImageData(100).width); + assertEquals(16, icon.getImageData(100).height); } assertFalse(entry.isVisible()); } @@ -232,7 +233,7 @@ public void test_initialize_1_allDefaults() throws Exception { ComponentDescriptionHelper.getDescription(m_lastEditor, JPanel.class); CreationDescription creation = componentDescription.getCreation(null); assertEquals(creation.getDescription(), entry.getDescription()); - assertTrue("Same icons.", UiUtils.equals(creation.getIcon(), entry.getIcon())); + assertTrue("Same icons.", UiUtils.equals(ImageDescriptor.createFromImage(creation.getIcon()), entry.getIcon())); } } diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/StaticFactoryEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/StaticFactoryEntryInfoTest.java index 2313c00fd..4af1b8ac7 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/StaticFactoryEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/StaticFactoryEntryInfoTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,10 +20,11 @@ import org.eclipse.wb.internal.core.model.description.GenericPropertyDescription; import org.eclipse.wb.internal.core.model.description.factory.FactoryMethodDescription; import org.eclipse.wb.internal.core.model.property.category.PropertyCategory; +import org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils; import org.eclipse.wb.tests.designer.tests.Activator; import org.eclipse.core.resources.IFile; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; import static org.assertj.core.api.Assertions.assertThat; @@ -325,10 +326,10 @@ public void test_initialize() throws Exception { assertTrue(entry.initialize(null, panel)); // after successful initialize we can ask for icon { - Image icon = entry.getIcon(); + ImageDescriptor icon = entry.getIcon(); assertNotNull(icon); - assertEquals(16, icon.getBounds().width); - assertEquals(16, icon.getBounds().height); + assertEquals(16, icon.getImageData(100).width); + assertEquals(16, icon.getImageData(100).height); } } @@ -377,7 +378,7 @@ public void test_initialize_iconAndDescription() throws Exception { // initialize assertTrue(entry.initialize(null, panel)); assertEquals("Some textual description of method.", entry.getDescription()); - assertSame(entry.getMethodDescription().getIcon(), entry.getIcon()); + assertSame(entry.getMethodDescription().getIcon(), ReflectionUtils.getFieldObject(entry, "m_icon")); } //////////////////////////////////////////////////////////////////////////// diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ToolEntryInfoTest.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ToolEntryInfoTest.java index 2c81de4fa..63c01e5da 100644 --- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ToolEntryInfoTest.java +++ b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/core/palette/ToolEntryInfoTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.tests.gef.EmptyEditPartViewer; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * Tests for abstract {@link ToolEntryInfo}. @@ -40,7 +40,7 @@ public void test_activateNoTool() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } @@ -64,7 +64,7 @@ public void test_activateTool() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } @@ -88,7 +88,7 @@ public void test_activateException() throws Exception { // prepare ToolEntryInfo ToolEntryInfo toolEntry = new ToolEntryInfo() { @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return null; } diff --git a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/palette/AbsoluteLayoutEntryInfo.java b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/palette/AbsoluteLayoutEntryInfo.java index 1ca796533..ba78569f7 100644 --- a/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/palette/AbsoluteLayoutEntryInfo.java +++ b/org.eclipse.wb.xwt/src/org/eclipse/wb/internal/xwt/palette/AbsoluteLayoutEntryInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2023 Google, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.eclipse.wb.internal.swt.Activator; import org.eclipse.wb.internal.xwt.model.layout.AbsoluteLayoutInfo; -import org.eclipse.swt.graphics.Image; +import org.eclipse.jface.resource.ImageDescriptor; /** * {@link ToolEntryInfo} that adds {@link AbsoluteLayoutInfo}. @@ -26,7 +26,7 @@ * @coverage XWT.editor */ public final class AbsoluteLayoutEntryInfo extends ToolEntryInfo { - private static final Image ICON = Activator.getImage("info/layout/absolute/layout.gif"); + private static final ImageDescriptor ICON = Activator.getImageDescriptor("info/layout/absolute/layout.gif"); //////////////////////////////////////////////////////////////////////////// // @@ -44,7 +44,7 @@ public AbsoluteLayoutEntryInfo() { // //////////////////////////////////////////////////////////////////////////// @Override - public Image getIcon() { + public ImageDescriptor getIcon() { return ICON; }