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

less than 1 minute read

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();

Updated: