|Injecting preferences [message #1622033]
||Wed, 18 February 2015 08:03
| Mateusz Malinowski
Registered: March 2013
I'm not entirely sure if I know how injecting preferences actually works. In Lars Vogel tutorial about preferences  in chapter 2 there is information that "The nodePath is the file name used to save the preference values to disk. By default this is the Bundle-SymbolicName of the plug-in. The value parameter specifies the preference key for the value which should be injected."
Having said that, the example at the end of that chapter should call trackUserSettings and trackPasswordSettings methods only once.
should call the first method and
I decided to create a new project using the following version of Eclipse:
Version: Kepler Service Release 2
Build id: 20140224-0627
Kepler is the same version on which  was based, according to its heading.
The reason I'm posting here is that in my case, both methods are called twice. At the first time user name is set to "TestUser" and password is injected as null, on the second time, user name is re-injecting the same value and password is set to "Password". Shouldn't those calls be split? I mean, when I set "user", shouldn't only methods that listen on that value, be called? Moreover, because I don't have "@Optional" annotation for my methods, shouldn't null values be omitted, according to ?
I'm more interested in the answer about injecting methods on preference values change, than the correct behaviour of "@Optional" annotation in this case. This example is very basic, but we can imagine more sophisticated methods that requires multiple values to be injected from preferences. I'd prefer not to store all injecting values as class variables to compare them each time method is triggered.
Powered by FUDForum
. Page generated in 0.01921 seconds