write file even through only project profile name was changed (IDEA-25257)

This commit is contained in:
anna
2009-11-24 17:48:51 +03:00
parent 29682549fe
commit 1051931237
@@ -59,6 +59,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
protected Map<String, Profile> myProfiles = new HashMap<String, Profile>();
protected final DependencyValidationManager myHolder;
protected List<ProfileChangeAdapter> myProfilesListener = new ArrayList<ProfileChangeAdapter>();
@NonNls private static final String PROJECT_DEFAULT_PROFILE_NAME = "Project Default";
public DefaultProjectProfileManager(final Project project, final String profileType, final DependencyValidationManager holder) {
myProject = project;
@@ -142,7 +143,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
}
}
if (profiles != null) {
if (profiles != null || !Comparing.strEqual(PROJECT_PROFILE, PROJECT_DEFAULT_PROFILE_NAME)) {
DefaultJDOMExternalizer.writeExternal(this, element);
final Element version = new Element("version");
version.setAttribute("value", VERSION);
@@ -188,13 +189,12 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
public Profile getProjectProfileImpl(){
if (isPlatform() || !USE_PROJECT_PROFILE) return myApplicationProfileManager.getRootProfile();
if (PROJECT_PROFILE == null || myProfiles.isEmpty()){
@NonNls final String projectProfileName = "Project Default";
setProjectProfile(projectProfileName);
setProjectProfile(PROJECT_DEFAULT_PROFILE_NAME);
final Profile projectProfile = myApplicationProfileManager.createProfile();
projectProfile.copyFrom(myApplicationProfileManager.getRootProfile());
projectProfile.setLocal(false);
projectProfile.setName(projectProfileName);
myProfiles.put(projectProfileName, projectProfile);
projectProfile.setName(PROJECT_DEFAULT_PROFILE_NAME);
myProfiles.put(PROJECT_DEFAULT_PROFILE_NAME, projectProfile);
} else if (!myProfiles.containsKey(PROJECT_PROFILE)){
final String projectProfileAttempt = myProfiles.keySet().iterator().next();
setProjectProfile(projectProfileAttempt);