Bug 101619 [formatter] Formatter profiles store even though I clicked 'Cancel'
I20050624-0010 1. open the formatter preference page 2. switch from existing profile p1 to another, lets say p2 3. click 'Cancel' Expected: my formatter profile is still p1 but it is now p2.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/ProfileManager.java
addBuiltinProfiles(fProfiles, fProfilesByName);
		
		for (final Iterator iter = profiles.iterator(); iter.hasNext();) {
			final CustomProfile profile= (CustomProfile) iter.next();
			profile.setManager(this);
			fProfiles.put(profile.getID(), profile);
			fProfilesByName.add(profile);
		}
		
		Collections.sort(fProfilesByName);
		
		InstanceScope instanceScope= new InstanceScope();
		String profileId= instanceScope.getNode(JavaUI.ID_PLUGIN).get(PROFILE_KEY, null);
		
		
		if (profileId == null) { 
			profileId= DEFAULT_PROFILE; 
			IEclipsePreferences node= instanceScope.getNode(JavaCore.PLUGIN_ID);
			if (node != null) {
				String tabSetting= node.get(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, null);
				if (JavaCore.SPACE.equals(tabSetting)) {
					profileId= JAVA_PROFILE;
				}
			}
		}
		
		Profile profile= (Profile) fProfiles.get(profileId);
		if (profile == null) {
			profile= (Profile) fProfiles.get(DEFAULT_PROFILE);