Bug 49691 - JavaProject looses property listeners on preferences
Summary: JavaProject looses property listeners on preferences
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 39421
  Show dependency tree
 
Reported: 2004-01-08 10:01 EST by Christof Marti CLA
Modified: 2004-08-19 05:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christof Marti CLA 2004-01-08 10:01:58 EST
JavaProject#setOptions(Map) always sets *new* Preferences. Listeners on the old
preferences do not receive events from the new preferences. It is therefore not
possible to use listeners on the project preferences.
Comment 1 Frederic Fusier CLA 2004-01-20 04:06:57 EST
Side effect of bug 26255. We need to change the way we're resetting preferences 
to avoid loosing property listeners...
Comment 2 Frederic Fusier CLA 2004-01-20 11:46:32 EST
One question: how do you get project preferences although there are not 
accessible using IJavaProject interface?
Comment 3 Christof Marti CLA 2004-01-20 12:21:45 EST
Using the internal API. The problem is that I need a way to listen on the
project preferences (not using the internal API of course).
Comment 4 Frederic Fusier CLA 2004-01-21 09:04:00 EST
Fixed.

Talking about this with Philippe, we would advice not to use an internal API to 
solve your problem of listening to preferences changes.

However, we'll fix this bug as we have a way to change this at low cost, but 
this is NOT an encouragement to internal API usage!

If you think there's absolutely no other way for you to solve your problem, 
then you have to open a new feature request to make these preferences 
accessible using an official API...

Some internal info about this bug fix:
-------------------------------------
Modify JavaProject.setOptions(Map) as we always use existing preferences 
instead of recreate them. Add a reset to default value for all options which 
are not present in given map.

Also remove default value initialisation in getOptions(boolean) method. When 
inheriting from JavaCore options, only initialize map with JavaCore.getOptions
() one. Previous code which set all keys value with default value has been 
removed as for JavaProject due to the fact that default value is _always_ 
invalid...

Modify existing test case test07 in jdt.core.tests.model.OptionTests
Comment 5 Dani Megert CLA 2004-02-02 12:50:32 EST
Christof, did you file a PR for the new listener API? If so, what's the number?
If not, please file it.
Comment 6 David Audel CLA 2004-02-11 11:25:24 EST
Verified for 3.0M7
Comment 7 Christof Marti CLA 2004-08-19 05:14:43 EDT
Comment 5: I filed bug 72234 as a follow-up.