Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.eclipse.wb.core.java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -62,7 +62,7 @@ public boolean isEnabled() {
/**
* @return the icon for visual.
*/
public abstract Image getIcon();
public abstract ImageDescriptor getIcon();

////////////////////////////////////////////////////////////////////////////
//
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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");

////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -58,7 +58,7 @@ public ChooseComponentEntryInfo() {
//
////////////////////////////////////////////////////////////////////////////
@Override
public Image getIcon() {
public ImageDescriptor getIcon() {
return ICON;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}.
Expand All @@ -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();

////////////////////////////////////////////////////////////////////////////
Expand All @@ -43,7 +43,7 @@ public MarqueeSelectionToolEntryInfo() {
//
////////////////////////////////////////////////////////////////////////////
@Override
public Image getIcon() {
public ImageDescriptor getIcon() {
return ICON;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}.
Expand All @@ -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();

////////////////////////////////////////////////////////////////////////////
Expand All @@ -44,7 +44,7 @@ public SelectionToolEntryInfo() {
//
////////////////////////////////////////////////////////////////////////////
@Override
public Image getIcon() {
public ImageDescriptor getIcon() {
return ICON;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand All @@ -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");

////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -58,7 +58,7 @@ public Tool createTool() throws Exception {
}

@Override
public Image getIcon() {
public ImageDescriptor getIcon() {
return ICON;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public boolean isEnabled() {

@Override
public ImageDescriptor getIcon() {
return ImageDescriptor.createFromImage(entryInfo.getIcon());
return entryInfo.getIcon();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -85,6 +88,7 @@

import java.text.MessageFormat;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public boolean isEnabled() {

@Override
public ImageDescriptor getIcon() {
return ImageDescriptor.createFromImage(entryInfo.getIcon());
return entryInfo.getIcon();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -79,6 +82,7 @@

import java.text.MessageFormat;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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");

////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -52,7 +52,7 @@ public ChooseComponentEntryInfo() {
//
////////////////////////////////////////////////////////////////////////////
@Override
public Image getIcon() {
public ImageDescriptor getIcon() {
return ICON;
}

Expand Down
Loading