Eclipse RCP / Plug-in – Reading an icon out of the icon directory of the plug-in

If you want to access an icon from your /icons directory in your code you can access it via the following method:

AbstractUIPlugin.imageDescriptorFromPlugin(“YourPluginName”,”$nl$/icons/your.gif”).createImage();

If recommend to define it as a static final variable to avoid that the icon is created more then once:

private static final Image IMAGE1 = AbstractUIPlugin.imageDescriptorFromPlugin(“YourPluginName”,”$nl$/icons/your.gif”).createImage();

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Uncategorized. Bookmark the permalink.