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
md md is currently offline md mdFriend
Messages: 9
Registered: November 2015
Junior Member
Hello,

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() {
			@Override
			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
Eclipse UserFriend
You have to filter the change events.

Quote:
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: Wed Apr 24 22:46:16 GMT 2024

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

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

Back to the top