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
private void updateProfilesWithName(String oldName, Profile newProfile) {
		IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
		QualifiedName key= new QualifiedName(JavaUI.ID_PLUGIN, PROFILE_KEY);
		for (int i= 0; i < projects.length; i++) {
			IProject curr= projects[i];
			if (curr.isAccessible()) {
				try {
					String profileId= curr.getPersistentProperty(key);
					if (oldName.equals(profileId)) {
						if (newProfile == null) {
							curr.setPersistentProperty(key, null); 
						} else {
							writeToPreferenceStore(newProfile, new ProjectScope(curr));
						}
					}
				} catch (CoreException e) {
					JavaPlugin.log(e);
				}
			}
		}
		
		final IEclipsePreferences uiPrefs= new InstanceScope().getNode(JavaUI.ID_PLUGIN);
		if (newProfile != null && oldName.equals(uiPrefs.get(PROFILE_KEY, null))) {
			writeToPreferenceStore(newProfile, new InstanceScope());
		}
	}
	
}