Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340993

Summary: [prefs] A Preference change listener added to a preference node at instance scope doesn't persist
Product: [Eclipse Project] Equinox Reporter: James Blackburn <jamesblackburn+eclipse>
Component: CompendiumAssignee: equinox.compendium-inbox <equinox.compendium-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: dj.houghton, Szymon.Brandys
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug
Bug Depends on:    
Bug Blocks: 340983    

Description James Blackburn CLA 2011-03-25 15:09:19 EDT
In core.resources I'm trying to replace the simple (but deprecated):

ResourcesPlugin.getPlugin().getPluginPreferences().addPropertyChangeListener(this);

with:

InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES).addPreferenceChangeListener(this);

So that the class is notified when the preference is changed at workspace instance scope.

Making this change in core.resources and it works for a bit, but when running the full automated testsuite the tests fail as the listeners is lost.

Adding a Node change listener may fix this, but would seem to be overkill as I'd then need to implement another 2 methods. Also doing so requires using more magic strings and casting osgi.Preferences to IEclipsePreferences which seems wrong...

Bug 80314 suggests this should work.  Am I doing something wrong?
Comment 1 Szymon Brandys CLA 2011-03-28 05:13:42 EDT
Dj, could you take a look at the issue?
Comment 2 James Blackburn CLA 2011-03-28 05:18:33 EDT
I think I need to dig a bit deeper into where it's getting lost... 
I know it's there after plugin startup, but a few hundred tests in it's not -- I'll have to think of a creative mechanism to debug...
Comment 3 DJ Houghton CLA 2011-03-28 11:31:46 EDT
I think this is similar/dup of bug 340983.
I'm not sure what the solution is though.
Comment 4 James Blackburn CLA 2011-03-28 12:02:16 EDT
(In reply to comment #3)
> I think this is similar/dup of bug 340983.
> I'm not sure what the solution is though.

Yep bug 340983 (which has your historical perspective) is the core.resources bug for me adding a use of deprecated Plugin preferences API instead of the eclipse preferences.

It looks like there are a whole bunch of CDT preference listeners (amongst others) that don't have node change listeners and expect to persist :(
Comment 5 James Blackburn CLA 2011-03-28 12:03:21 EDT
I meant to bump this bug to major see: Bug 340983 comment 2 , Bug 340983 comment 3
Comment 6 Eclipse Genie CLA 2019-10-06 16:27:00 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.