Icons in preferences dialog in Eclipse
When you’re working on custom RCP based applications you’re sometimes forced to change visual aspects of parts of the application that are provided by Eclipse RCP itself. Preferences is a good example of that visual aspect. Since we want to reuse code from RCP as much as possible we decided to use JFace preferences dialog.
After implementing first pages we were pointed out that items should have icons next to label. I thought I would have to patch JFace plug-in to achieve that, but I was wrong! Preferences dialog (and therefore Properties dialog) have undocumented functionality of showing image next to item on the tree view and above content composite. No coding is required to achieve that!
Here’s how preference page (in this case wklej.org plug-in’s page) is shown
![]()
After adding attribute icon to extension point we’re presented with nice image
![]()
And here’s modified extension point entry in your plugin.xml (or fragment.xml):
<page
class="org.example.plugin.preferences.ExamplePreferencePage"
id="org.example.preferencepage" name="Preference page with image"
icon="images/example.png">
</page>
</extension>
Notice that Eclipse will show you a warning that icon element is illegal. Fortunately it just a warning, and extension point org.eclipse.ui.preferencePages does support images (icons) but it just doesn’t expose this publicly.
As you can see on the screenshots above, placing image in a plug-in that will be used in standard Eclipse IDE just looks wrong, I agree. But for a custom applications, when you’re providing all pages, it looks great and helps non-developers to find what they’re looking for.
On the other note, I would like to welcome everyone at Eclipse Planet. It’s a pleasure to be here :-)

WordPress