1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Remove warning of illegally extending ImageRegistry

Delegate to an instance of ImageRegistry instead, which is legal.

Change-Id: Ife10b526c54483143a9ef5599c4571844a60604d
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2019-03-09 01:28:55 -05:00 committed by Jonah Graham
parent c21d3f553e
commit 084288dee9
2 changed files with 10 additions and 12 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
Bundle-Version: 2.6.100.qualifier
Bundle-Version: 2.6.200.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -34,13 +34,15 @@ import org.osgi.framework.Bundle;
*
* @since 2.1
*/
public abstract class AbstractImageRegistry extends ImageRegistry {
public abstract class AbstractImageRegistry {
private HashMap<String, String> fPlugins = new HashMap<>();
private HashMap<String, String[]> fLocations = new HashMap<>();
private URL fBaseUrl;
private ImageRegistry fImageRegistry;
protected AbstractImageRegistry(Plugin plugin) {
fBaseUrl = plugin.getBundle().getEntry("/"); //$NON-NLS-1$
fImageRegistry = new ImageRegistry();
}
/**
@ -83,33 +85,29 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
fLocations.put(key, locations);
}
// overrider
@Override
final public Image get(String key) {
Image i = super.get(key);
Image i = fImageRegistry.get(key);
if (i != null) {
return i;
}
ImageDescriptor d = createFileImageDescriptor(key);
if (d != null) {
put(key, d);
return super.get(key);
fImageRegistry.put(key, d);
return fImageRegistry.get(key);
}
return null;
}
// overrider
@Override
final public ImageDescriptor getDescriptor(String key) {
ImageDescriptor d = super.getDescriptor(key);
ImageDescriptor d = fImageRegistry.getDescriptor(key);
if (d != null) {
return d;
}
d = createFileImageDescriptor(key);
if (d != null) {
put(key, d);
fImageRegistry.put(key, d);
return d;
}
return null;
@ -132,7 +130,7 @@ public abstract class AbstractImageRegistry extends ImageRegistry {
try {
full = new URL(url, loc);
ImageDescriptor candidate = ImageDescriptor.createFromURL(full);
if (candidate != null && candidate.getImageData() != null) {
if (candidate != null && candidate.getImageData(100) != null) {
return candidate;
}
} catch (MalformedURLException e) {