• Share this article:

Scaring Children with Your User Interface

Thursday, May 3, 2007 - 17:10 by Wayne Beaton

If you’ve found the “Colors and Fonts” page in the Eclipse Workspace Preferences, then you already know that you can customize Eclipse to look as awful as you’d like. Or maybe you went different route and changed the colors and fonts to better suit your personal tastes.

Many aspects of the workbench can be tuned. When you change a value, it’s stuffed into a preferences store and kept on your disc so that those preferences come back the next time you start. More specifically, those preferences are stored in files found in the [workspace]‌/.metadata‌/.plugins‌/org.eclipse.core.runtime‌/.settings directory.

You can override the default preferences in your Eclipse product (or RCP application) without making the user play around in the preferences dialog. This is done by providing preferences overrides. You do this by adding a property to your product declaration in the plugin.xml file like this:

<extension id="product" point="org.eclipse.core.runtime.products">
    <product application="PlayingWithPrefs.application" name="RCP Product">
        <property name="preferenceCustomization" value="preferences.ini"/>
    </product>
</extension>

With this addition in place, the preferences.ini file—located in the plug-in’s root—is defined. Here’s an example:

# Use curvy tabs
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false

# Tabs display in a large italicized font.
org.eclipse.ui.workbench/org.eclipse.ui.workbench.TAB_TEXT_FONT=1|Tahoma|15.75|2|WINDOWS|1|-21|0|0|0|400|1|0|0|0|3|2|1|34|Tahoma;

# The active tab displays as red to green gradient with blue text (yuck)
org.eclipse.ui.workbench/org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=255,0,0
org.eclipse.ui.workbench/org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=0,255,0
org.eclipse.ui.workbench/org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR=0,0,255

# The inactive tab displays as blue to green gradient with red text (yuckers)
org.eclipse.ui.workbench/org.eclipse.ui.workbench.INACTIVE_TAB_BG_END=0,0,255
org.eclipse.ui.workbench/org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=0,255,0
org.eclipse.ui.workbench/org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR=255,0,0

And here’s what the RCP Mail sample application looks like with these customizations applied:

You can set more than just look and feel preferences as well. You can override any value that’s stored in preferences. If you look through the .settings directory, you can get a sense for the kinds of preferences you can override in your Eclipse product.