Thursday, July 23, 2009

How to replace the default JFace message icons

We all know the standard JFace icons very well. They appear in Dialogs, Wizards and Forms.

And in a form they look like this:

Now, there is a quick and easy way to replace them with your own icons if you like.

You just have to create a Fragment bundle and set org.eclipse.jface as its Bundle-Host. In your fragment bundle you include the icons you want to replace in the following folder structure:
Don't forget to add the icons folder and all of its subfolder and content into your build.properties file:
bin.includes = META-INF/,\
             .,\
             OSGI-INF/,\
             icons/
Interesting fact: You can replace the JFace icons with PNGs too. You can just rename them to have the .GIF extensions. The image file loader of SWT does not care about the extension but analyses the content of the file.

3 comments:

  1. Hey Phillipp, can you change your blogger settings so posts are fully syndicated... and not just the summaries? The blog gets cut off on places like PlanetEclipse and other RSS readers ;(

    ReplyDelete
  2. Hey Philipp, thanks for this post - it works well with the given example to replace the org.eclipse.jface icons. But when I try the exact same procedure with one of my plugins (also with an icon folder), the fragment's icon is only displayed when I delete the host's icon - otherwise always the host's icon is shown :( Do you have any idea?

    Cheers, Tom

    ReplyDelete