change Context for @Inject [message #1691030] |
Wed, 01 April 2015 12:43  |
Eclipse User |
|
|
|
Hi all,
in my LifecycleManager I've created a new IPreferenceStore object. This
I've put into current context:
context.set(IPreferenceStore.class, defaultValuesNode);
(context was previously injected into LifecycleManager with @Inject
private IEclipseContext context;).
Now if I inject the IPreferenceStore in a MPart:
@Inject
@Preference(value="/instance/com.acme.work")
private IPreferenceStore preferences;
the preferences field is null (even if I omit the value attribute). On
the other hand, if I call
EclipseContextFactory.getServiceContext(Activator.getContext()).get(IPreferenceStore.class);
all preferences are available, which means that I've chosen the wrong
context (Activator delivers the bundle context for "com.acme.work"). But
how can I say which context for injection is to use?
TIA,
Ralf.
|
|
|
|
Re: change Context for @Inject [message #1691059 is a reply to message #1691046] |
Wed, 01 April 2015 19:55  |
Eclipse User |
|
|
|
Am 01.04.2015 um 21:53 schrieb Tom Schindl:
> What gave you the impression that we are querying the IPreferenceStore
> when you use @Preference?
>
> Your code will query
> IPreferenceService.getString("your.bundle.id","/instance/com.acme.work",null)!
>
> If you want to replace preferences storeage you need to replace the
> IPreferencesService at the OSGi-Level.
>
> Tom
>
Ok, I forget to mention that I've used the
com.opcoach.e4.preferences.ScopedPreferenceStore from
https://github.com/opcoach/e4Preferences.
|
|
|
Powered by
FUDForum. Page generated in 0.09953 seconds