Bug 26255

Summary: project compiler settings : cannot go back to worspace settings
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: martinae
Version: 2.0   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2002-11-14 05:46:32 EST
20021113
after i switched to project settings i cannot go back to workspace settings 
again
Comment 1 Adam Kiezun CLA 2002-11-14 08:31:33 EST
critical - i could not find a good workaround
Comment 2 Martin Aeschlimann CLA 2002-11-14 11:39:37 EST
the problem is in IJavaProject.setOptions, it only iterates the element in the 
new map, but not all options: cleared options are not recognixed and not 
cleared in the underlying store.

I fixed it for M3 by adding a setOptions(null) first.

	public void setOptions(Map newOptions) {

		Preferences preferences;
		if (newOptions == null){
			setPreferences(preferences = new Preferences());
		} else {
			preferences = getPreferences();
			Iterator keys = newOptions.keySet().iterator();
			while (keys.hasNext()){
				String key = (String)keys.next();
				if (!JavaModelManager.OptionNames.contains
(key)) continue; // unrecognized option
				// no filtering for encoding (custom encoding 
for project is allowed)
				String value = (String)newOptions.get(key);
				preferences.setValue(key, value);
			}
		}
		
		// persist options
		savePreferences(preferences);	
	}
Comment 3 Philipe Mulet CLA 2002-11-21 11:03:04 EST
Fixed. The preference object is always reinitialized.
Comment 4 David Audel CLA 2002-12-17 07:25:10 EST
Verified.