I'm working on an Eclipse plugin (or in fact, a plugin for an Eclipse-based application) which needs some configuration to be entered by the user.
From looking at the documentation, there seem to be two preference APIs - one in org.eclipse.core.runtime.preferences
, extending/implementing the OSGI prefererence API, another one, JFace specific, in org.eclipse.jface.preference
. Then we have org.eclipse.ui.preferences
, too.
The OSGI API has a hierarchic Node tree - a preference node (Preferences
or IEclipsePreferences
) can have multiple subnodes, which themselves can contain both individual name-value-pairs as well as more subnodes. This seems to be right for my use case - I have a dynamic number of "preference groups", each with about three string properties (name, description, command), which would nicely map to these nodes.
The JFace API has no such hierarchy, only a flat IPreferenceStore
for each plugin. But it provides preference editor pages, which then can be included in the usual preferences dialog (Window / Preferences) by implementing IWorkbenchPreferencePage
and using the "org.eclipse.ui.preferencePages" extension point. (I still have to implement part of the preference page myself, but this API provides a good base for this, it seems.)
It seems that the org.eclipse.ui.preferences
API somehow bridges both these APIs by providing an IPreferenceStore implementation based on the IEclipsePreferences, but I still can't see how to use this.
So here my question: How can I use the hierarchical OSGI Preferences
in the preferences-dialog? I only need one level, but I need the user to be able to dynamically add new nodes (with about three preferences each). (These nodes do not have to have new preference-pages, though.)