mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for [Bug 203614] ICDescriptor.saveProjectData() doesn't always serialize to . cproject
This commit is contained in:
parent
a76abebd0c
commit
46d9a5d1b8
7 changed files with 52 additions and 21 deletions
|
@ -279,11 +279,11 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
void doneInitialization(){
|
||||
if(isReadOnly()){
|
||||
if(fRootStorageElement != null)
|
||||
((InternalXmlStorageElement)fRootStorageElement).setReadOnly(true);
|
||||
((InternalXmlStorageElement)fRootStorageElement).setReadOnly(true, false);
|
||||
if(fSettingsStorageElement != null)
|
||||
((InternalXmlStorageElement)fSettingsStorageElement).setReadOnly(true);
|
||||
((InternalXmlStorageElement)fSettingsStorageElement).setReadOnly(true, false);
|
||||
if(fStorage != null)
|
||||
fStorage.setReadOnly(true);
|
||||
fStorage.setReadOnly(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,16 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
if(isReadOnly())
|
||||
throw ExceptionFactory.createIsReadOnlyException();
|
||||
fIsModified = modified;
|
||||
|
||||
if(!modified){
|
||||
if(fMacros != null)
|
||||
fMacros.setDirty(false);
|
||||
|
||||
if(fEnvironment != null)
|
||||
fEnvironment.setDirty(false);
|
||||
}
|
||||
}
|
||||
|
||||
void setModified(){
|
||||
setModified(true);
|
||||
}
|
||||
|
|
|
@ -232,11 +232,16 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
|||
return modified;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void doneApplying(){
|
||||
doneInitializing();
|
||||
fIsApplying = false;
|
||||
|
||||
try {
|
||||
((InternalXmlStorageElement)getRootStorageElement()).setReadOnly(true, false);
|
||||
} catch (CoreException e1) {
|
||||
}
|
||||
|
||||
setModified(false);
|
||||
}
|
||||
|
||||
void doneLoadding(){
|
||||
|
@ -502,6 +507,20 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setModified(boolean modified){
|
||||
fIsModified = modified;
|
||||
|
||||
if(!modified){
|
||||
fActiveCfgInfo.fIsModified = false;
|
||||
|
||||
fSettingCfgInfo.fIsModified = false;
|
||||
|
||||
fPrefs.setModified(false);
|
||||
|
||||
//no need to do that for config cache since they always maintain the "isModified == false"
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return fIsReadOnly && !(fIsLoadding || fIsApplying);
|
||||
|
|
|
@ -709,11 +709,6 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
} finally {
|
||||
clearDescriptionApplying(project);
|
||||
}
|
||||
|
||||
try {
|
||||
((InternalXmlStorageElement)des.getRootStorageElement()).setReadOnly(true);
|
||||
} catch (CoreException e1) {
|
||||
}
|
||||
}
|
||||
}finally{
|
||||
CProjectDescription d = clearDescriptionLoadding(project);
|
||||
|
|
|
@ -95,6 +95,10 @@ public class CProjectDescriptionPreferences implements ICProjectDescriptionPrefe
|
|||
&& !fSuperPreference.settingsEqual((CProjectDescriptionPreferences)CProjectDescriptionManager.getInstance().getProjectDescriptionWorkspacePreferences(false)));
|
||||
}
|
||||
|
||||
void setModified(boolean modified){
|
||||
fIsModified = modified;
|
||||
}
|
||||
|
||||
public boolean isReadOnly(){
|
||||
return fIsReadOnly;
|
||||
}
|
||||
|
|
|
@ -170,11 +170,12 @@ public class CStorage implements ICSettingsStorage{
|
|||
return false;
|
||||
}
|
||||
|
||||
void setReadOnly(boolean readOnly){
|
||||
void setReadOnly(boolean readOnly, boolean keepModify){
|
||||
fIsReadOnly = readOnly;
|
||||
fIsDirty &= keepModify;
|
||||
for(Iterator iter = fStorageElementMap.values().iterator(); iter.hasNext();){
|
||||
InternalXmlStorageElement el = (InternalXmlStorageElement)iter.next();
|
||||
el.setReadOnly(readOnly);
|
||||
el.setReadOnly(readOnly, keepModify);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,16 @@ public class InternalXmlStorageElement extends XmlStorageElement {
|
|||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly){
|
||||
setReadOnly(readOnly, true);
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean readOnly, boolean keepModify){
|
||||
fIsReadOnly = readOnly;
|
||||
fIsDirty &= keepModify;
|
||||
|
||||
ICStorageElement children[] = getChildren(false);
|
||||
for(int i = 0; i < children.length; i++){
|
||||
((InternalXmlStorageElement)children[i]).setReadOnly(readOnly);
|
||||
((InternalXmlStorageElement)children[i]).setReadOnly(readOnly, keepModify);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,11 +45,14 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
|||
mngr.notifyListeners(event);
|
||||
CProjectDescription fNewDescriptionCache = null;
|
||||
SettingsContext context = new SettingsContext(project);
|
||||
boolean modified;
|
||||
boolean modified = false;
|
||||
|
||||
if(fSetDescription != null){
|
||||
InternalXmlStorageElement el = null;
|
||||
try {
|
||||
el = mngr.copyElement((InternalXmlStorageElement)fSetDescription.getRootStorageElement(), false);
|
||||
InternalXmlStorageElement base = (InternalXmlStorageElement)fSetDescription.getRootStorageElement();
|
||||
modified = base.isDirty();
|
||||
el = mngr.copyElement(base, false);
|
||||
} catch (CoreException e2) {
|
||||
}
|
||||
|
||||
|
@ -63,7 +66,7 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
|||
fNewDescriptionCache = new CProjectDescription(fSetDescription, true, el, creating);
|
||||
try {
|
||||
mngr.setDescriptionApplying(project, fNewDescriptionCache);
|
||||
modified = fNewDescriptionCache.applyDatas(context);
|
||||
modified |= fNewDescriptionCache.applyDatas(context);
|
||||
} finally {
|
||||
mngr.clearDescriptionApplying(project);
|
||||
}
|
||||
|
@ -105,11 +108,6 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
|
|||
// ExternalSettingsManager.getInstance().updateDepentents(delta);
|
||||
|
||||
if(fNewDescriptionCache != null){
|
||||
try {
|
||||
((InternalXmlStorageElement)fNewDescriptionCache.getRootStorageElement()).setReadOnly(true);
|
||||
} catch (CoreException e1) {
|
||||
}
|
||||
|
||||
fNewDescriptionCache.doneApplying();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue