Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Krasilnikov2008-02-19 11:25:39 -0500
committerOleg Krasilnikov2008-02-19 11:25:39 -0500
commit6b54153645a8d7687a7f0d42286a4cdd962a2fe3 (patch)
treeb88e9043e36dc7dcdc98cbb686988ae949e01e99
parentddc04e4d51c4744356fbe0b374ec51df46ab7650 (diff)
downloadorg.eclipse.cdt-6b54153645a8d7687a7f0d42286a4cdd962a2fe3.tar.gz
org.eclipse.cdt-6b54153645a8d7687a7f0d42286a4cdd962a2fe3.tar.xz
org.eclipse.cdt-6b54153645a8d7687a7f0d42286a4cdd962a2fe3.zip
Bug #219174 : inconsistent file-level tool option propagation
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java100
1 files changed, 53 insertions, 47 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
index acf69646b4..66a6f7527e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceInfo.java
@@ -30,8 +30,6 @@ import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
-import org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolListModification;
-import org.eclipse.cdt.managedbuilder.tcmodification.IToolListModification;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -347,9 +345,53 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
return config != null;
}
-// public boolean isParentInfoInherited() {
-// return inheritParentInfo;
-// }
+ private void propagate(IHoldsOptions parent, IOption option, Object oldValue, Object value) {
+ if (! (parent instanceof ITool))
+ return;
+ ITool tool = (ITool)parent;
+ String sup = option.getId();
+ IOption op = option;
+ while (op.getSuperClass() != null) {
+ op = op.getSuperClass();
+ sup = op.getId();
+ }
+ IResourceInfo[] ris = getChildResourceInfos();
+ for (int i=0; i<ris.length; i++) {
+ IResourceInfo ri = ris[i];
+ ITool[] ts = ri.getTools();
+ for (int j=0; j<ts.length; j++ ) {
+ ITool t = ts[j];
+ if (t.getDefaultInputExtension() != tool.getDefaultInputExtension())
+ continue;
+ op = t.getOptionBySuperClassId(sup);
+ if (op == null)
+ continue;
+ try {
+ if (value instanceof Boolean) {
+ boolean b = ((Boolean)oldValue).booleanValue();
+ if (b == op.getBooleanValue() && b != ((Boolean)value).booleanValue())
+ ri.setOption(t, op, ((Boolean)value).booleanValue());
+ } else if (value instanceof String) {
+ String s = (String)oldValue;
+ if (s.equals(op.getStringValue()) && ! s.equals((String)value))
+ ri.setOption(t, op, (String)value);
+ } else if (value instanceof String[]) {
+ String[] s = (String[])oldValue;
+ if (Arrays.equals(s, op.getStringListValue()) &&
+ ! Arrays.equals(s, (String[])value))
+ ri.setOption(t, op, (String[])value);
+ } else if (value instanceof OptionStringValue[]) {
+ OptionStringValue[] s = (OptionStringValue[])oldValue;
+ if (Arrays.equals(s, op.getBasicStringListValueElements()) &&
+ ! Arrays.equals(s, (OptionStringValue[])value))
+ ri.setOption(t, op, (OptionStringValue[])value);
+ }
+ break;
+ } catch (BuildException e) {}
+ }
+ }
+
+ }
public IOption setOption(IHoldsOptions parent, IOption option, boolean value) throws BuildException {
// Is there a change?
@@ -358,10 +400,10 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
if (oldVal != value) {
retOpt = parent.getOptionToSet(option, false);
retOpt.setValue(value);
-// if(resourceData != null)
-// ((ISettingsChangeListener)resourceData).optionChanged(this, parent, option, new Boolean(oldVal));
+ propagate(parent, option,
+ (oldVal ? Boolean.TRUE : Boolean.FALSE),
+ (value ? Boolean.TRUE : Boolean.FALSE));
NotificationManager.getInstance().optionChanged(this, parent, option, new Boolean(oldVal));
-// rebuildNeeded = true;
}
return retOpt;
}
@@ -373,10 +415,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
if (oldValue != null && !oldValue.equals(value)) {
retOpt = parent.getOptionToSet(option, false);
retOpt.setValue(value);
-// if(resourceData != null)
-// ((ISettingsChangeListener)resourceData).optionChanged(this, parent, option, oldValue);
+ propagate(parent, option, oldValue, value);
NotificationManager.getInstance().optionChanged(this, parent, option, oldValue);
-// rebuildNeeded = true;
}
return retOpt;
}
@@ -389,21 +429,6 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
case IOption.STRING_LIST :
oldValue = option.getBasicStringListValue();
break;
-// case IOption.STRING_LIST :
-// oldValue = option.getStringListValue();
-// break;
-// case IOption.INCLUDE_PATH :
-// oldValue = option.getIncludePaths();
-// break;
-// case IOption.PREPROCESSOR_SYMBOLS :
-// oldValue = option.getDefinedSymbols();
-// break;
-// case IOption.LIBRARIES :
-// oldValue = option.getLibraries();
-// break;
-// case IOption.OBJECTS :
-// oldValue = option.getUserObjects();
-// break;
default :
oldValue = new String[0];
break;
@@ -411,10 +436,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
if(!Arrays.equals(value, oldValue)) {
retOpt = parent.getOptionToSet(option, false);
retOpt.setValue(value);
-// if(resourceData != null)
-// ((ISettingsChangeListener)resourceData).optionChanged(this, parent, option, oldValue);
+ propagate(parent, option, oldValue, value);
NotificationManager.getInstance().optionChanged(this, parent, option, oldValue);
-// rebuildNeeded = true;
}
return retOpt;
}
@@ -427,21 +450,6 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
case IOption.STRING_LIST :
oldValue = ((Option)option).getBasicStringListValueElements();
break;
-// case IOption.STRING_LIST :
-// oldValue = option.getStringListValue();
-// break;
-// case IOption.INCLUDE_PATH :
-// oldValue = option.getIncludePaths();
-// break;
-// case IOption.PREPROCESSOR_SYMBOLS :
-// oldValue = option.getDefinedSymbols();
-// break;
-// case IOption.LIBRARIES :
-// oldValue = option.getLibraries();
-// break;
-// case IOption.OBJECTS :
-// oldValue = option.getUserObjects();
-// break;
default :
oldValue = new OptionStringValue[0];
break;
@@ -449,10 +457,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
if(!Arrays.equals(value, oldValue)) {
retOpt = parent.getOptionToSet(option, false);
((Option)retOpt).setValue(value);
-// if(resourceData != null)
-// ((ISettingsChangeListener)resourceData).optionChanged(this, parent, option, oldValue);
+ propagate(parent, option, oldValue, value);
NotificationManager.getInstance().optionChanged(this, parent, option, oldValue);
-// rebuildNeeded = true;
}
return retOpt;
}

Back to the top