views:

34

answers:

1

I have two plugins, say com.site.plugin.core and com.site.plugin.ui.
I'd like to separate core part from UI part, so at plugin com.site.plugin.ui I created Preferences page where I defined some preferences, which should be used by com.site.plugin.core. I check article at Eclipse site, but it is quite outdated, and linked bug also do not provide much info.
So is it possible to do this using standard Eclipse mechanism, or I need use direct low-level API via package org.eclipse.core.runtime.preferences?

A: 

Prefs stores are found per plugin. This is one way to get a prefs store for the plugin whose activator class is ActivatorA.

IPreferenceStore store = ActivatorA.getDefault().getPreferenceStore();

If you want another plugin to refer to the same store, perhaps you could expose some api on ActivatorA for it to get there, e.g.

public IPreferenceStore getSharedPrefs() {
    return ActivatorA.getDefault().getPreferenceStore();
}

The second plugin would find the shared store by doing this

IPreferenceStore sharedPrefs = ActivatorA.getSharedPrefs();

Good luck.

bwinspur
Hmmm... But in this case my core plugin should know about UI part. It is not good.
St.Shadow
OK. In general terms what would an acceptable way for the core plug-in to locate the shared data, if not via the plugin that creates it. How about: a filepath?, Dialog-settings? a URL?
bwinspur