The top-level preferences store can be injected into the object by using standard dependency injection techniques, using the IEclipsePreferences
interface. The underlying nodes can also be injected by using an @Preferences
annotation, specifying the node path of interest.
Add the
org.eclipse.e4.core.di.extensions
package to the manifest of thecom.packtpub.e4.clock.ui
project, which contains the@Preferences
annotation.In the
TimeZoneTreeView
class, add a new field of typeIEclipsePreferences
calledpreferences
. Annotate it with@Inject
and@Preferences(nodePath = "com.packtpub.e4.clock.ui")
:@Preference(nodePath = "com.packtpub.e4.clock.ui") @Inject IEclipsePreferences preferences;
In the
create
method, print a...