Reputation: 4370
I'm trying to set the background image of canvas using
canvas.setBackgroundImage(image);
How can i set the image with a *.png file that is stored in plugin's image sub-directory ?
Something like this:
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK)
but I want to use my image file instead of the shared image.
Upvotes: 2
Views: 2461
Reputation: 1323453
For images not declared in the plugin.xml, like in this thread:
public Image createImage(String path) {
Image image = getImageRegistry().get(path);
if (image == null) {
getImageRegistry().put(path, AbstractUIPlugin.
imageDescriptorFromPlugin(ID, path));
image = getImageRegistry().get(path);
}
return image;
}
(similar to "FAQ How do I create an image registry for my plug-in?")
See also User interface resources for accessing resources declared within your plugin.
Upvotes: 3