View | Details | Raw Unified | Return to bug 267844 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/resource/ImageDescriptor.java (-235 / +291 lines)
Lines 12-17 Link Here
12
12
13
import java.net.URL;
13
import java.net.URL;
14
14
15
import org.eclipse.jface.internal.JFaceActivator;
15
import org.eclipse.swt.SWTException;
16
import org.eclipse.swt.SWTException;
16
import org.eclipse.swt.graphics.Device;
17
import org.eclipse.swt.graphics.Device;
17
import org.eclipse.swt.graphics.Image;
18
import org.eclipse.swt.graphics.Image;
Lines 19-211 Link Here
19
import org.eclipse.swt.graphics.PaletteData;
20
import org.eclipse.swt.graphics.PaletteData;
20
import org.eclipse.swt.graphics.RGB;
21
import org.eclipse.swt.graphics.RGB;
21
import org.eclipse.swt.widgets.Display;
22
import org.eclipse.swt.widgets.Display;
23
import org.osgi.framework.Bundle;
24
import org.osgi.framework.BundleContext;
25
import org.osgi.framework.ServiceReference;
22
26
23
/**
27
/**
24
 * An image descriptor is an object that knows how to create
28
 * An image descriptor is an object that knows how to create an SWT image. It
25
 * an SWT image.  It does not hold onto images or cache them,
29
 * does not hold onto images or cache them, but rather just creates them on
26
 * but rather just creates them on demand.  An image descriptor
30
 * demand. An image descriptor is intended to be a lightweight representation of
27
 * is intended to be a lightweight representation of an image
31
 * an image that can be manipulated even when no SWT display exists.
28
 * that can be manipulated even when no SWT display exists.
29
 * <p>
32
 * <p>
30
 * This package defines a concrete image descriptor implementation
33
 * This package defines a concrete image descriptor implementation which reads
31
 * which reads an image from a file (<code>FileImageDescriptor</code>).
34
 * an image from a file (<code>FileImageDescriptor</code>). It also provides
32
 * It also provides abstract framework classes (this one and
35
 * abstract framework classes (this one and
33
 * <code>CompositeImageDescriptor</code>) which may be subclassed to define
36
 * <code>CompositeImageDescriptor</code>) which may be subclassed to define news
34
 * news kinds of image descriptors.
37
 * kinds of image descriptors.
35
 * </p>
38
 * </p>
36
 * <p>
39
 * <p>
37
 * Using this abstract class involves defining a concrete subclass
40
 * Using this abstract class involves defining a concrete subclass and providing
38
 * and providing an implementation for the <code>getImageData</code>
41
 * an implementation for the <code>getImageData</code> method.
39
 * method.
40
 * </p>
42
 * </p>
41
 * <p>
43
 * <p>
42
 * There are two ways to get an Image from an ImageDescriptor. The method
44
 * There are two ways to get an Image from an ImageDescriptor. The method
43
 * createImage will always return a new Image which must be disposed by
45
 * createImage will always return a new Image which must be disposed by the
44
 * the caller. Alternatively, createResource() returns a shared
46
 * caller. Alternatively, createResource() returns a shared Image. When the
45
 * Image. When the caller is done with an image obtained from createResource,
47
 * caller is done with an image obtained from createResource, they must call
46
 * they must call destroyResource() rather than disposing the Image directly.
48
 * destroyResource() rather than disposing the Image directly. The result of
47
 * The result of createResource() can be safely cast to an Image. 
49
 * createResource() can be safely cast to an Image.
48
 * </p>
50
 * </p>
49
 *
51
 * 
50
 * @see org.eclipse.swt.graphics.Image
52
 * @see org.eclipse.swt.graphics.Image
51
 */
53
 */
52
public abstract class ImageDescriptor extends DeviceResourceDescriptor {
54
public abstract class ImageDescriptor extends DeviceResourceDescriptor {
53
55
54
    /** 
56
	/**
55
     * A small red square used to warn that an image cannot be created.
57
	 * A small red square used to warn that an image cannot be created.
56
     * <p>
58
	 * <p>
57
     */
59
	 */
58
    protected static final ImageData DEFAULT_IMAGE_DATA = new ImageData(6, 6,
60
	protected static final ImageData DEFAULT_IMAGE_DATA = new ImageData(6, 6,
59
            1, new PaletteData(new RGB[] { new RGB(255, 0, 0) }));
61
			1, new PaletteData(new RGB[] { new RGB(255, 0, 0) }));
60
62
61
    /**
63
	/**
62
     * Constructs an image descriptor.
64
	 * Constructs an image descriptor.
63
     */
65
	 */
64
    protected ImageDescriptor() {
66
	protected ImageDescriptor() {
65
        // do nothing
67
		// do nothing
66
    }
68
	}
67
69
68
    /**
70
	/**
69
     * Creates and returns a new image descriptor from a file.
71
	 * Creates and returns a new image descriptor from a file. Convenience
70
     * Convenience method for
72
	 * method for <code>new FileImageDescriptor(location,filename)</code>.
71
     * <code>new FileImageDescriptor(location,filename)</code>.
73
	 * 
72
     *
74
	 * @param location
73
     * @param location the class whose resource directory contain the file
75
	 *            the class whose resource directory contain the file
74
     * @param filename the file name
76
	 * @param filename
75
     * @return a new image descriptor
77
	 *            the file name
76
     */
78
	 * @return a new image descriptor
77
    public static ImageDescriptor createFromFile(Class location, String filename) {
79
	 */
78
        return new FileImageDescriptor(location, filename);
80
	public static ImageDescriptor createFromFile(Class location, String filename) {
79
    }
81
		return new FileImageDescriptor(location, filename);
80
    
82
	}
81
    /**
83
82
     * Creates and returns a new image descriptor given ImageData
84
	/**
83
     * describing the image.
85
	 * Creates and returns a new image descriptor given ImageData describing the
84
     * 
86
	 * image.
85
     * @since 3.1 
87
	 * 
86
     *
88
	 * @since 3.1
87
     * @param data contents of the image
89
	 * 
88
     * @return newly created image descriptor
90
	 * @param data
89
     */
91
	 *            contents of the image
90
    public static ImageDescriptor createFromImageData(ImageData data) {
92
	 * @return newly created image descriptor
91
        return new ImageDataImageDescriptor(data);
93
	 */
92
    }
94
	public static ImageDescriptor createFromImageData(ImageData data) {
93
    
95
		return new ImageDataImageDescriptor(data);
94
    /**
96
	}
95
     * Creates and returns a new image descriptor for the given image. Note 
97
96
     * that disposing the original Image will cause the descriptor to become invalid.
98
	/**
97
     * 
99
	 * Creates and returns a new image descriptor for the given image. Note that
98
     * @since 3.1 
100
	 * disposing the original Image will cause the descriptor to become invalid.
99
     *
101
	 * 
100
     * @param img image to create
102
	 * @since 3.1
101
     * @return a newly created image descriptor
103
	 * 
102
     */
104
	 * @param img
103
    public static ImageDescriptor createFromImage(Image img) {
105
	 *            image to create
104
        return new ImageDataImageDescriptor(img);
106
	 * @return a newly created image descriptor
105
    }
107
	 */
106
    
108
	public static ImageDescriptor createFromImage(Image img) {
107
    /**
109
		return new ImageDataImageDescriptor(img);
108
     * Creates an ImageDescriptor based on the given original descriptor, but with additional
110
	}
109
     * SWT flags.
111
110
     *  
112
	/**
111
     * <p>
113
	 * Creates an ImageDescriptor based on the given original descriptor, but
112
     * Note that this sort of ImageDescriptor is slower and consumes more resources than
114
	 * with additional SWT flags.
113
     * a regular image descriptor. It will also never generate results that look as nice as
115
	 * 
114
     * a hand-drawn image. Clients are encouraged to supply their own disabled/grayed/etc. images
116
	 * <p>
115
     * rather than using a default image and transforming it.
117
	 * Note that this sort of ImageDescriptor is slower and consumes more
116
     * </p>
118
	 * resources than a regular image descriptor. It will also never generate
117
     * 
119
	 * results that look as nice as a hand-drawn image. Clients are encouraged
118
     * @param originalImage image to transform
120
	 * to supply their own disabled/grayed/etc. images rather than using a
119
     * @param swtFlags any flag that can be passed to the flags argument of Image#Image(Device, Image, int)
121
	 * default image and transforming it.
120
     * @return an ImageDescriptor that creates new images by transforming the given image descriptor
122
	 * </p>
121
     * 
123
	 * 
122
     * @see Image#Image(Device, Image, int) 
124
	 * @param originalImage
123
     * @since 3.1 
125
	 *            image to transform
124
     *
126
	 * @param swtFlags
125
     */
127
	 *            any flag that can be passed to the flags argument of
126
    public static ImageDescriptor createWithFlags(ImageDescriptor originalImage, int swtFlags) {
128
	 *            Image#Image(Device, Image, int)
127
        return new DerivedImageDescriptor(originalImage, swtFlags);
129
	 * @return an ImageDescriptor that creates new images by transforming the
128
    }
130
	 *         given image descriptor
129
131
	 * 
130
    /**
132
	 * @see Image#Image(Device, Image, int)
131
     * Creates and returns a new image descriptor for the given image. This
133
	 * @since 3.1
132
     * method takes the Device that created the Image as an argument, allowing
134
	 * 
133
     * the original Image to be reused if the descriptor is asked for another
135
	 */
134
     * Image on the same device. Note that disposing the original Image will 
136
	public static ImageDescriptor createWithFlags(
135
     * cause the descriptor to become invalid.
137
			ImageDescriptor originalImage, int swtFlags) {
136
     * 
138
		return new DerivedImageDescriptor(originalImage, swtFlags);
137
     * @deprecated use {@link ImageDescriptor#createFromImage(Image)}
139
	}
138
     * @since 3.1 
140
139
     *
141
	/**
140
     * @param img image to create
142
	 * Creates and returns a new image descriptor for the given image. This
141
     * @param theDevice the device that was used to create the Image
143
	 * method takes the Device that created the Image as an argument, allowing
142
     * @return a newly created image descriptor
144
	 * the original Image to be reused if the descriptor is asked for another
143
     */
145
	 * Image on the same device. Note that disposing the original Image will
144
    public static ImageDescriptor createFromImage(Image img, Device theDevice) {
146
	 * cause the descriptor to become invalid.
145
        return new ImageDataImageDescriptor(img);
147
	 * 
146
    }
148
	 * @deprecated use {@link ImageDescriptor#createFromImage(Image)}
147
    
149
	 * @since 3.1
148
    /**
150
	 * 
149
     * Creates and returns a new image descriptor from a URL.
151
	 * @param img
150
     *
152
	 *            image to create
151
     * @param url The URL of the image file.
153
	 * @param theDevice
152
     * @return a new image descriptor
154
	 *            the device that was used to create the Image
153
     */
155
	 * @return a newly created image descriptor
154
    public static ImageDescriptor createFromURL(URL url) {
156
	 */
155
        if (url == null) {
157
	public static ImageDescriptor createFromImage(Image img, Device theDevice) {
156
            return getMissingImageDescriptor();
158
		return new ImageDataImageDescriptor(img);
157
        }
159
	}
158
        return new URLImageDescriptor(url);
160
159
    }
161
	/**
160
162
	 * Creates and returns a new image descriptor from a URL.
161
    /* (non-Javadoc)
163
	 * 
162
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#createResource(org.eclipse.swt.graphics.Device)
164
	 * @param url
163
     */
165
	 *            The URL of the image file.
164
    public Object createResource(Device device) throws DeviceResourceException {
166
	 * @return a new image descriptor
165
        Image result = createImage(false, device);
167
	 */
166
        if (result == null) {
168
	public static ImageDescriptor createFromURL(URL url) {
167
            throw new DeviceResourceException(this);
169
		if (url == null) {
168
        }
170
			return getMissingImageDescriptor();
169
        return result;
171
		}
170
    }
172
		return new URLImageDescriptor(transformImageLocation(url));
171
    
173
	}
172
    /* (non-Javadoc)
174
173
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#destroyResource(Object)
175
	/*
174
     */
176
	 * (non-Javadoc)
175
    public void destroyResource(Object previouslyCreatedObject) {
177
	 * 
176
        ((Image)previouslyCreatedObject).dispose();
178
	 * @see
177
    }
179
	 * org.eclipse.jface.resource.DeviceResourceDescriptor#createResource(org
178
    
180
	 * .eclipse.swt.graphics.Device)
179
    /**
181
	 */
182
	public Object createResource(Device device) throws DeviceResourceException {
183
		Image result = createImage(false, device);
184
		if (result == null) {
185
			throw new DeviceResourceException(this);
186
		}
187
		return result;
188
	}
189
190
	/*
191
	 * (non-Javadoc)
192
	 * 
193
	 * @see
194
	 * org.eclipse.jface.resource.DeviceResourceDescriptor#destroyResource(Object
195
	 * )
196
	 */
197
	public void destroyResource(Object previouslyCreatedObject) {
198
		((Image) previouslyCreatedObject).dispose();
199
	}
200
201
	/**
180
	 * Creates and returns a new SWT image for this image descriptor. Note that
202
	 * Creates and returns a new SWT image for this image descriptor. Note that
181
	 * each call returns a new SWT image object. The returned image must be
203
	 * each call returns a new SWT image object. The returned image must be
182
	 * explicitly disposed using the image's dispose call. The image will not be
204
	 * explicitly disposed using the image's dispose call. The image will not be
183
	 * automatically garbage collected. A default image is returned in the event
205
	 * automatically garbage collected. A default image is returned in the event
184
	 * of an error.
206
	 * of an error.
185
     * 
207
	 * 
186
     * <p>
208
	 * <p>
187
     * Note: this method differs from createResource(Device) in that the returned image
209
	 * Note: this method differs from createResource(Device) in that the
188
     * must be disposed directly, whereas an image obtained from createResource(...)
210
	 * returned image must be disposed directly, whereas an image obtained from
189
     * must be disposed by calling destroyResource(...). It is not possible to 
211
	 * createResource(...) must be disposed by calling destroyResource(...). It
190
     * mix-and-match. If you obtained the Image from this method, you must not dispose
212
	 * is not possible to mix-and-match. If you obtained the Image from this
191
     * it by calling destroyResource. Clients are encouraged to use 
213
	 * method, you must not dispose it by calling destroyResource. Clients are
192
     * create/destroyResource and downcast the result to Image rather than using 
214
	 * encouraged to use create/destroyResource and downcast the result to Image
193
     * createImage.
215
	 * rather than using createImage.
194
     * </p>
216
	 * </p>
195
     * 
217
	 * 
196
	 * <p>
218
	 * <p>
197
	 * Note: it is still possible for this method to return <code>null</code>
219
	 * Note: it is still possible for this method to return <code>null</code> in
198
	 * in extreme cases, for example if SWT runs out of image handles.
220
	 * extreme cases, for example if SWT runs out of image handles.
199
	 * </p>
221
	 * </p>
200
	 * 
222
	 * 
201
	 * @return a new image or <code>null</code> if the image could not be
223
	 * @return a new image or <code>null</code> if the image could not be
202
	 *         created
224
	 *         created
203
	 */
225
	 */
204
    public Image createImage() {
226
	public Image createImage() {
205
        return createImage(true);
227
		return createImage(true);
206
    }
228
	}
207
229
208
    /**
230
	/**
209
	 * Creates and returns a new SWT image for this image descriptor. The
231
	 * Creates and returns a new SWT image for this image descriptor. The
210
	 * returned image must be explicitly disposed using the image's dispose
232
	 * returned image must be explicitly disposed using the image's dispose
211
	 * call. The image will not be automatically garbage collected. In the event
233
	 * call. The image will not be automatically garbage collected. In the event
Lines 213-221 Link Here
213
	 * <code>returnMissingImageOnError</code> is true, otherwise
235
	 * <code>returnMissingImageOnError</code> is true, otherwise
214
	 * <code>null</code> is returned.
236
	 * <code>null</code> is returned.
215
	 * <p>
237
	 * <p>
216
	 * Note: Even if <code>returnMissingImageOnError</code> is true, it is
238
	 * Note: Even if <code>returnMissingImageOnError</code> is true, it is still
217
	 * still possible for this method to return <code>null</code> in extreme
239
	 * possible for this method to return <code>null</code> in extreme cases,
218
	 * cases, for example if SWT runs out of image handles.
240
	 * for example if SWT runs out of image handles.
219
	 * </p>
241
	 * </p>
220
	 * 
242
	 * 
221
	 * @param returnMissingImageOnError
243
	 * @param returnMissingImageOnError
Lines 223-240 Link Here
223
	 * @return a new image or <code>null</code> if the image could not be
245
	 * @return a new image or <code>null</code> if the image could not be
224
	 *         created
246
	 *         created
225
	 */
247
	 */
226
    public Image createImage(boolean returnMissingImageOnError) {
248
	public Image createImage(boolean returnMissingImageOnError) {
227
        return createImage(returnMissingImageOnError, Display.getCurrent());
249
		return createImage(returnMissingImageOnError, Display.getCurrent());
228
    }
250
	}
229
251
230
    /**
252
	/**
231
	 * Creates and returns a new SWT image for this image descriptor. The
253
	 * Creates and returns a new SWT image for this image descriptor. The
232
	 * returned image must be explicitly disposed using the image's dispose
254
	 * returned image must be explicitly disposed using the image's dispose
233
	 * call. The image will not be automatically garbage collected. A default
255
	 * call. The image will not be automatically garbage collected. A default
234
	 * image is returned in the event of an error.
256
	 * image is returned in the event of an error.
235
	 * <p>
257
	 * <p>
236
	 * Note: it is still possible for this method to return <code>null</code>
258
	 * Note: it is still possible for this method to return <code>null</code> in
237
	 * in extreme cases, for example if SWT runs out of image handles.
259
	 * extreme cases, for example if SWT runs out of image handles.
238
	 * </p>
260
	 * </p>
239
	 * 
261
	 * 
240
	 * @param device
262
	 * @param device
Lines 243-253 Link Here
243
	 *         created
265
	 *         created
244
	 * @since 2.0
266
	 * @since 2.0
245
	 */
267
	 */
246
    public Image createImage(Device device) {
268
	public Image createImage(Device device) {
247
        return createImage(true, device);
269
		return createImage(true, device);
248
    }
270
	}
249
271
250
    /**
272
	/**
251
	 * Creates and returns a new SWT image for this image descriptor. The
273
	 * Creates and returns a new SWT image for this image descriptor. The
252
	 * returned image must be explicitly disposed using the image's dispose
274
	 * returned image must be explicitly disposed using the image's dispose
253
	 * call. The image will not be automatically garbage collected. In the even
275
	 * call. The image will not be automatically garbage collected. In the even
Lines 255-263 Link Here
255
	 * <code>returnMissingImageOnError</code> is true, otherwise
277
	 * <code>returnMissingImageOnError</code> is true, otherwise
256
	 * <code>null</code> is returned.
278
	 * <code>null</code> is returned.
257
	 * <p>
279
	 * <p>
258
	 * Note: Even if <code>returnMissingImageOnError</code> is true, it is
280
	 * Note: Even if <code>returnMissingImageOnError</code> is true, it is still
259
	 * still possible for this method to return <code>null</code> in extreme
281
	 * possible for this method to return <code>null</code> in extreme cases,
260
	 * cases, for example if SWT runs out of image handles.
282
	 * for example if SWT runs out of image handles.
261
	 * </p>
283
	 * </p>
262
	 * 
284
	 * 
263
	 * @param returnMissingImageOnError
285
	 * @param returnMissingImageOnError
Lines 268-329 Link Here
268
	 *         created
290
	 *         created
269
	 * @since 2.0
291
	 * @since 2.0
270
	 */
292
	 */
271
    public Image createImage(boolean returnMissingImageOnError, Device device) {
293
	public Image createImage(boolean returnMissingImageOnError, Device device) {
294
295
		ImageData data = getImageData();
296
		if (data == null) {
297
			if (!returnMissingImageOnError) {
298
				return null;
299
			}
300
			data = DEFAULT_IMAGE_DATA;
301
		}
302
303
		/*
304
		 * Try to create the supplied image. If there is an SWT Exception try
305
		 * and create the default image if that was requested. Return null if
306
		 * this fails.
307
		 */
308
309
		try {
310
			if (data.transparentPixel >= 0) {
311
				ImageData maskData = data.getTransparencyMask();
312
				return new Image(device, data, maskData);
313
			}
314
			return new Image(device, data);
315
		} catch (SWTException exception) {
316
			if (returnMissingImageOnError) {
317
				try {
318
					return new Image(device, DEFAULT_IMAGE_DATA);
319
				} catch (SWTException nextException) {
320
					return null;
321
				}
322
			}
323
			return null;
324
		}
325
	}
326
327
	/**
328
	 * Creates and returns a new SWT <code>ImageData</code> object for this
329
	 * image descriptor. Note that each call returns a new SWT image data
330
	 * object.
331
	 * <p>
332
	 * This framework method is declared public so that it is possible to
333
	 * request an image descriptor's image data without creating an SWT image
334
	 * object.
335
	 * </p>
336
	 * <p>
337
	 * Returns <code>null</code> if the image data could not be created.
338
	 * </p>
339
	 * 
340
	 * @return a new image data or <code>null</code>
341
	 */
342
	public abstract ImageData getImageData();
343
344
	/**
345
	 * Returns the shared image descriptor for a missing image.
346
	 * 
347
	 * @return the missing image descriptor
348
	 */
349
	public static ImageDescriptor getMissingImageDescriptor() {
350
		return MissingImageDescriptor.getInstance();
351
	}
352
353
	/**
354
	 * Transforms the {@link URL} by using an available implementation of
355
	 * {@link IImageLocationTransformer}.
356
	 * 
357
	 * @param url
358
	 *            Given image {@link URL}.
359
	 * @return Transformed {@link URL}.
360
	 */
361
	private static URL transformImageLocation(URL url) {
362
		URL result = url;
363
364
		Bundle bundle = JFaceActivator.getBundle();
365
		if (bundle != null) {
366
			BundleContext bundleContext = JFaceActivator.getBundle()
367
					.getBundleContext();
368
			if (bundleContext != null) {
369
				ServiceReference serviceReference = bundleContext
370
						.getServiceReference(IImageLocationTransformer.class
371
								.getName());
372
				if (serviceReference != null) {
373
					Object service = bundleContext.getService(serviceReference);
374
					if (service != null) {
375
						IImageLocationTransformer transformer = (IImageLocationTransformer) service;
376
						result = transformer.transform(url);
377
					}
378
				}
379
			}
380
		}
381
382
		return result;
383
	}
272
384
273
        ImageData data = getImageData();
274
        if (data == null) {
275
            if (!returnMissingImageOnError) {
276
                return null;
277
            }
278
            data = DEFAULT_IMAGE_DATA;
279
        }
280
281
        /*
282
         * Try to create the supplied image. If there is an SWT Exception try and create
283
         * the default image if that was requested. Return null if this fails.
284
         */
285
286
        try {
287
            if (data.transparentPixel >= 0) {
288
                ImageData maskData = data.getTransparencyMask();
289
                return new Image(device, data, maskData);
290
            }
291
            return new Image(device, data);
292
        } catch (SWTException exception) {
293
            if (returnMissingImageOnError) {
294
                try {
295
                    return new Image(device, DEFAULT_IMAGE_DATA);
296
                } catch (SWTException nextException) {
297
                    return null;
298
                }
299
            }
300
            return null;
301
        }
302
    }
303
304
    /**
305
     * Creates and returns a new SWT <code>ImageData</code> object
306
     * for this image descriptor.
307
     * Note that each call returns a new SWT image data object.
308
     * <p>
309
     * This framework method is declared public so that it is
310
     * possible to request an image descriptor's image data without
311
     * creating an SWT image object.
312
     * </p>
313
     * <p>
314
     * Returns <code>null</code> if the image data could not be created.
315
     * </p>
316
     *
317
     * @return a new image data or <code>null</code>
318
     */
319
    public abstract ImageData getImageData();
320
321
    /**
322
     * Returns the shared image descriptor for a missing image.
323
     *
324
     * @return the missing image descriptor
325
     */
326
    public static ImageDescriptor getMissingImageDescriptor() {
327
        return MissingImageDescriptor.getInstance();
328
    }
329
}
385
}
(-)src/org/eclipse/jface/resource/IImageLocationTransformer.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.jface.resource;
13
14
import java.net.URL;
15
16
/**
17
 * An image location {@link URL} transformer. The implementation of this service
18
 * influence the loaded image within {@link ImageDescriptor#createFromURL(URL)}.
19
 * 
20
 * @since 3.4
21
 */
22
public interface IImageLocationTransformer {
23
24
	/**
25
	 * Transforms the given image location {@link URL} and returns the result.
26
	 * 
27
	 * @param url
28
	 *            Image's location {@link URL}.
29
	 * @return Transformed image location {@link URL}.
30
	 */
31
	public URL transform(URL url);
32
33
}

Return to bug 267844