I have the following problem. I have a Preferences Page that stores preferences using the Store mechanism. Now, these preferences must be accessed from a plugin that does not include org.eclipse.ui, which means that the store mechanism is not available and I can only use the Runtime preference mechanism.
How can I use the Preference Page to create a runtime preference?
I have the following problem:
- When using preference pages, the class used is
Activator.getDefault().getPreferenceStore() - When using runtime plugins, the class is
new InstanceScope().getNode("<plugin id>");
How do I synchronize both?
See Eclipse: OSGI Preferences vs. PreferenceStore
Basically, InstanceScope.INSTANCE.getNode(“bundle.id”) gives you the
org.eclipse.core.runtime.preferences.IEclipsePreferencesthat backs your bundle’sorg.eclipse.jface.preference.IPreferenceStore. You shouldn’t have to sync them, as they’re the same thing.Have they been out of sync? You might have to do a IPersistentPreferenceStore#save() and/or a org.osgi.service.prefs.Preferences.flush() if they’re not in sync by default (although I thought those methods were simply to write out to the disk cache).