Problems in getting an image from a source folder [message #308248] |
Mon, 18 September 2006 08:21  |
Eclipse User |
|
|
|
Originally posted by: subbareddiklk.gmail.com
Hi All,
I'm new to using the Eclipse plug-in and am having some problems. I've
done my best to setup the plug-in as described in the tutorial on the
website. However, I'm having to problems:
I have a project 'XYZ', in which i have a source folder 'P1' in which
there is a class 'class1'.
I have to show some images in dialogs of my Plugin.For this I have added a
folder 'myIcons' and added it as a source folder along with 'P1'.
In 'class1',i am trying to access it by getImage("//myicons//icon.gif").
But i am getting FileNotFoundException.
I cannot give direct absolute path because, i have to export the jar and
be able to run it along with other plugins.
Thanks in advance!
regards,
subba
|
|
|
Re: Problems in getting an image from a source folder [message #308266 is a reply to message #308248] |
Mon, 18 September 2006 12:40  |
Eclipse User |
|
|
|
For images that are part of your source, you can just use
getResourceAsStream("whatever.gif") ... just standard resource loading.
For images that are part of your plugin ... i.e. end up in
<plugin>/icons/whatever.gif
You can use
MyPlugin.getDefault().getBundle().getEntry("/icons/whatever.gif ") That
returns a URL that you can then get the input stream for.
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.02137 seconds