[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: SWT Image creation

1) Are you trying to access these images in code from your plugin?
2) Are you trying to access these images from plugin.xml?

If it is (1), then you should put the images directory under your src folder so that they are in your jar. Then you would use

ImageDescriptor.createImageFromFile(yourClass.class,"/images/myimage.gif").createImage();

where yourClass.class is some class in the plugin that the images are in.

That is the best way to do it. You really only need them outside of the jar if they need to be accessed from the plugin.xml, or from some code that is not running under Eclipse, or is running under Eclipse but from code that does not know of any classes in your plugin.

If it must be from code outside of your plugin, then you need to use:

ImageDescriptor.createFromURL(Platform.getBundle("yourbundleid").findEntry("/images/myimage.gif")).createImage();

--
Thanks,
Rich Kulp