summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaltasar Belyavsky2012-02-11 08:29:43 (EST)
committerAndrew Gvozdev2012-02-12 09:02:29 (EST)
commit88bf01e541760bb2aeeb82656f80d5ed9ffbf67b (patch)
tree5a0719b75156e25763d6ee6899a5b72ce737e0ea
parent6b66aef60bc1a3ee2f5fa862ed63f48721b1c15f (diff)
downloadorg.eclipse.cdt-88bf01e541760bb2aeeb82656f80d5ed9ffbf67b.zip
org.eclipse.cdt-88bf01e541760bb2aeeb82656f80d5ed9ffbf67b.tar.gz
org.eclipse.cdt-88bf01e541760bb2aeeb82656f80d5ed9ffbf67b.tar.bz2
bug 340219: Project metadata files are saved unnecessarily, patch to
address .cproject file modifications
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java34
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/SetCProjectDescriptionOperation.java16
2 files changed, 25 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
index f4a3927..e140e2f 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
+ * Baltasar Belyavsky (Texas Instruments) - bug 340219: Project metadata files are saved unnecessarily
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
@@ -50,7 +51,6 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
private boolean fIsReadOnly;
private boolean fIsModified;
private HashMap<QualifiedName, Object> fPropertiesMap;
-// private boolean fNeedsActiveCfgIdPersistence;
private boolean fIsLoading;
private boolean fIsApplying;
private boolean fIsCreating;
@@ -549,17 +549,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
return cfg;
}
- @Override
- public boolean isModified() {
+ boolean needsDescriptionPersistence() {
if(fIsModified)
return true;
- if(fActiveCfgInfo.fIsCfgModified)
- return true;
-
- if(fSettingCfgInfo.fIsCfgModified)
- return true;
-
if(fPrefs.isModified())
return true;
@@ -573,6 +566,20 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
return false;
}
+ @Override
+ public boolean isModified() {
+ if(needsDescriptionPersistence())
+ return true;
+
+ if(needsActiveCfgPersistence())
+ return true;
+
+ if(needsSettingCfgPersistence())
+ return true;
+
+ return false;
+ }
+
private void setModified(boolean modified){
fIsModified = modified;
@@ -665,13 +672,6 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
}
}
-// boolean checkPersistCfgChanges(boolean force){
-// boolean stored = false;
-// stored |= checkPersistActiveCfg(force);
-// stored |= checkPersistSettingCfg(force);
-// return stored;
-// }
-
boolean checkPersistActiveCfg(String oldId, boolean force){
return fActiveCfgInfo.store(oldId, force);
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/SetCProjectDescriptionOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/SetCProjectDescriptionOperation.java
index d8414d4..2734232 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/SetCProjectDescriptionOperation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/SetCProjectDescriptionOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
+ * Baltasar Belyavsky (Texas Instruments) - bug 340219: Project metadata files are saved unnecessarily
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
@@ -65,14 +66,14 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
AbstractCProjectDescriptionStorage.fireAboutToApplyEvent(fSetDescription, fOldDescriptionCache);
CProjectDescription fNewDescriptionCache = null;
SettingsContext context = new SettingsContext(project);
- boolean modified = false;
+ boolean needsSerialization = false;
if(fSetDescription != null){
ICStorageElement newEl = null;
ICSettingsStorage newStorage = null;
try {
ICStorageElement base = fSetDescription.getRootStorageElement();
- modified = fSetDescription.isModified();
+ needsSerialization = fSetDescription.needsDescriptionPersistence();
// el = base;
// FIXME JBB there is deep magic going on here. The project descriptions are being
// changed in non-obvious ways
@@ -94,13 +95,11 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
boolean envStates[] = getEnvStates(fNewDescriptionCache);
try {
fPrjDescStorage.setThreadLocalProjectDesc(fNewDescriptionCache);
- modified |= fNewDescriptionCache.applyDatas(context);
+ fNewDescriptionCache.applyDatas(context);
} finally {
fPrjDescStorage.setThreadLocalProjectDesc(null);
setEnvStates(fNewDescriptionCache, envStates);
}
- } else {
- modified = fOldDescriptionCache != null;
}
ICDescriptionDelta delta = mngr.createDelta(fNewDescriptionCache, fOldDescriptionCache);
@@ -143,7 +142,7 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
try {
IWorkspaceRunnable toRun = null;
if(fNewDescriptionCache != null && !CProjectDescriptionManager.checkFlags(fFlags, ICProjectDescriptionManager.SET_NO_SERIALIZE)){
- if(modified || isPersistentCoreSettingChanged(event)){
+ if(needsSerialization || isPersistentCoreSettingChanged(event)){
toRun = fPrjDescStorage.createDesSerializationRunnable();
if (toRun != null)
context.addWorkspaceRunnable(toRun);
@@ -182,7 +181,8 @@ public class SetCProjectDescriptionOperation extends CModelOperation {
return true;
int flags = delta.getChangeFlags();
- if(flags != 0 && flags != ICDescriptionDelta.ACTIVE_CFG)
+ // check for any flag except ACTIVE_CFG and SETTING_CFG
+ if((flags & ~(ICDescriptionDelta.ACTIVE_CFG | ICDescriptionDelta.SETTING_CFG)) != 0)
return true;
return false;