Preferences Spy for Eclipse IDE and RCP

1 minute read

Motivation

Figuring out, which preference is changed, when editing a certain preference in the user interface (i.e. Preference-Dialog), may be difficult.

Let the Preference Spy help you with this issue.

Preferences in Eclipse

The preferences in Eclipse are stored hierarchically. So there is one root node and the other preferences are usually stored for each plug-in, which may be identified by the nodepath.

The nodepath usually contains the Bundle-SymbolicName of the plug-in, which defines a certain preference, but you may also define a custom nodepath.

In the following image the preferences are shown hierarchically. On top of the tree you may see recently changed preferences with bold font, like it is also done with recently changed values in the about:config of the Firefox web browser. The non bold preferences are shown by pressing the second toolbar button, which is used in order to show all currently set preferences.

Explanation of the toolbar buttons of the spy:

  1. Toogle between hierarchical and flat layout
  2. Show all preferences with at least one value
  3. Toogle tracing recently changed preferences
  4. Expand or collapse all preferences in case hierarchical layout is chosen
  5. Remove certain or all entries from the preference spy part

Events fired by the Preference Spy

The PreferenceSpyEventTopics class contains certain Topics, which are consumed by the Preference Spy. Especially the “TOPIC_PREFERENCESPY/PREFERENCE/CHANGED” topic may also be interesting for other developers since it notifies, if any preference is changed. You may receive this event like this:

@Inject     
@Optional     
public void preferenceChanged( @UIEventTopic(PreferenceSpyEventTopics.PREFERENCESPY\_PREFERENCE\_CHANGED) PreferenceChangeEvent event) {

	// print new property value to console 
	System.out.println(String.valueOf(event.getNewValue()));     
} 

 Further Plans

At first I like to admit that the project is hosted on Github [1] and we really appreciate feedback.

You can also get the preference spy from the following update site [2] and install it directly. The newest version will always be available on this update site.

Another aim of this project is that the preference spy will become an official spy of the E4 tools project. [3]

[1] https://github.com/vogellacompany/PreferencesSpy

[2] http://dl.bintray.com/vogellacompany/eclipse-preference-spy/

[3] https://git.eclipse.org/r/#/admin/projects/e4/org.eclipse.e4.tools

Updated: