Community
Participate
Working Groups
steps: 1. change the project "text file encoding" to Other->UTF-8 2. close the project, then close eclipse 3. open eclipse, then open the project 4. the "text file encoding" setting reset to "Inherited from container (MS950)
Bug was categorized as JDT/APT - I don't think it has anything to do with either. I'll attempt to recategorize it.
I can't reproduce it on Build id: I20070809-1105. Could you check if it still occurs on the newest version?
yes, i tried , it works fine. And i was thinking about why it happened at that time... finally i got the point: if we have viewed the "text file encoding" property before opening the project (as step 3.), after opened the project, the encoding will reset to "Inherited from container (MS950)"
I can reproduce the issue indeed. I'm changing the priority since the team has other issues to address. A patch would be accepted.
Created attachment 185125 [details] Patch v.0.1 The problem is that ProjectPreferences are initialized only upon creation so changing open-close state of project cannot change already initialized preferences. What we should do is to initialize project preferences each time the project is opened. The attached patch solves the problem. There is still an issue with line delimiter but the preference for line delimiter is handled directly from UI so it needs a separate bug. Szymon B., do you think we could fix this in 3.7 M5?
Created attachment 185134 [details] Patch v.0.2 Patch that fixes problems with encoding and with line delimiter.
Created attachment 185139 [details] Patch v.0.3, minor changes added
Created attachment 185424 [details] Patch v.0.4
Created attachment 185543 [details] Patch v.0.5
Szymon, could you sync the patch to HEAD?
Created attachment 185703 [details] Patch v.0.6, rebased to HEAD
Created attachment 185720 [details] Patch v.0.6 changed If there are two (or more) threads accessing project prefs, each may create a ProjectPreferences instance and only one of these will be added to the preferences tree. I think there is a chance that a wrong instance will be initialized during project opening. My patch seems to be safer.
Dj, could you look at the 'patch v.0.6 (rebased to HEAD)' and 'patch v.0.6 changed' and comment.
I opened separate bug 333101 for UI part.
I found one more issue with ProjectPreferences. If a project is closed and LineDelimiterEditor tries to get preferences (it creates nodes during look up), ProjectPreferences#load is called and silently returns, because the pref file is not accessible. Right after that ProjectPreferences#loaded is called and it adds core.runtime.prefs to the list of loaded nodes, what is wrong. Of course the fix for bug 333101 hides the problem, however there may be other places where people create nodes on look up. #loaded should not add anything to loadedNodes if #load fails.
Created attachment 186377 [details] Patch v.0.7 Added changes from comment 15.
*** Bug 162818 has been marked as a duplicate of this bug. ***
The fix is in HEAD. Thanks.
The bug is nicely fixed! There's one remaining issue though, see bug 334362.