Project: Eclipse_Platform_UI
Bug 129318 [Preferences] ScopedPreferenceStore forever disconnected after last call to removePropertyChangeListener
Reported: 2006-02-24 06:49:19 | Status: verified fixed

R3.1 and newer If ScopedPreferenceStore .removePropertyChangeListener(...) removes the last listener it calls disposePreferenceStoreListener() which disconnects the ScopedPreferenceStore from the eclipse store but does not set preferencesListener to null. Now, when the next client calls addPropertyChangeListener(...) this methods calls initializePreferencesListener() which does nothing because preferencesListener is not null. Therefore the store remains disconnected from the Eclipse preferences and hence property/pref changes are not forwarded to the added listeners. Test Case: 1. open Text editor 2. change the 'Current line highlight' color via Text Editors pref page ==> changed in editor 3. close the editor (this disconnects the scope store forever) 4. open Text editor 5. change the 'Current line highlight' color via Text Editors pref page ==> change does not happen in the editor NOTE: we did not detect this earlier because for non-string preferences this works since ScopedPreferenceStore.setValue(String, <type>) calls firePropertyChangeEvent() for all types (e.g. boolean) except for String typed preferences. Why?

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java