Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » packaging icons with the plugin
packaging icons with the plugin [message #295734] Tue, 06 December 2005 14:34 Go to next message
vijaishanker is currently offline vijaishankerFriend
Messages: 60
Registered: July 2009
Member
Hi,

I am developing a plugin which has some images on a few buttons... When
I add an image to represent for example, a view or a wizard in plugin.xml,
it gets added as "icons/someIcon.gif" but when i do the same thing for a
Button for example,

someButton.setImage(new Image(Display.getCurrent(),"icons/someImage.gif"));

it throws a file not found exception...How do I get over this, i.e. I
want these images to be displayed on a packaged and deployed plugin

Thanks in advance

Vijai
Re: packaging icons with the plugin [message #295736 is a reply to message #295734] Tue, 06 December 2005 14:52 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The problem is that for the plugin.xml it looks for the icons starting
in the root of the plugin.

But it is different for images for Buttons. new Image(display,filename)
looks for the image files in the current directory, which is NOT your
plugin.

Your images for buttons and such need to be in your library jar (i.e. in
the classpath of the plugin, not in the root directory of the plugin)
AND you need to use:

new Image(Display.getCurrent(), getClass().getResourceAsStream("/path to
file icon in jar"));

Also, you need to dispose of the image when you are done.

Vijai wrote:
> Hi,
> I am developing a plugin which has some images on a few buttons... When
> I add an image to represent for example, a view or a wizard in
> plugin.xml, it gets added as "icons/someIcon.gif" but when i do the same
> thing for a Button for example,
> someButton.setImage(new Image(Display.getCurrent(),"icons/someImage.gif"));
>
> it throws a file not found exception...How do I get over this, i.e. I
> want these images to be displayed on a packaged and deployed plugin
>
> Thanks in advance
>
> Vijai
>

--
Thanks,
Rich Kulp
Previous Topic:multiple applications
Next Topic:Graceful shutdown of Java Applications
Goto Forum:
  


Current Time: Thu Sep 19 05:05:26 GMT 2024

Powered by FUDForum. Page generated in 0.03421 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top