Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Preferences IPropertyChangeListener
Preferences IPropertyChangeListener [message #1770435] Fri, 11 August 2017 11:01 Go to next message
sirair sirair is currently offline sirair sirairFriend
Messages: 7
Registered: November 2015
Junior Member

im my RCP application I use custom Preferences.
To listen for changes I use the code below.
IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent event) {

The problem is that I have more than two preferences, but only a special preference is relevant for a plugin. But in the above code I get notified for each change.
Is it possible to get notified for a special preference, even better when I get notified for a special BooleanFieldEditor used in the preference for example.
Re: Preferences IPropertyChangeListener [message #1770578 is a reply to message #1770435] Mon, 14 August 2017 15:48 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 877
Registered: January 2012
Senior Member

You have to filter the change events.

Is it possible [...] even better when I get notified for a special BooleanFieldEditor used in the preference for example.

Why do you want to do this? I'll posit that you don't want to know about what changed the preference (i.e., the BooleanFieldEditor). In doing so, you risk operating against stale data (i.e., a legitimate change came from elsewhere). If you're seeking to perform validation, check it in the editor or the pref page before writing the preference change out; by the time the event comes, it's too late: the value has been written out.
Previous Topic:RunAndTrack update accessed variables
Next Topic:Disabled icons in application model
Goto Forum:

Current Time: Sat Jan 16 06:51:09 GMT 2021

Powered by FUDForum. Page generated in 0.01905 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top