I'm trying to get an image file from my plugin resources using SWT
Image image=new Image(device,"icons/imagename.png");
The icons folder is in the classpath of the plugin but I still get an
Can you help me indicating what is the correct way of accessing an Image resource from internal resources of the plugin ?
Best How To :
Use something like:
String path = "icons/imagename.png";
Bundle bundle = Platform.getBundle("plugin id");
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
Image image = imageDesc.createImage();
Don't forget that you must dispose an image when you are done with it.