diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java index 92abd8fedbe..ba8910af075 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java @@ -395,6 +395,7 @@ public interface IOption extends IBuildObject { * of its superclass and false if it overrides other attributes. * * @return boolean + * @deprecated */ public boolean overridesOnlyValue(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java index 08385ddd043..c881fd5df63 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java @@ -704,13 +704,13 @@ public class Configuration extends BuildObject implements IConfiguration { IOption retOpt = option; if (option.getBooleanValue() != value) { if (option.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. IOption newSuperClass = option; - if (option.overridesOnlyValue()) { + if (((Option)option).wasOptRef()) { newSuperClass = option.getSuperClass(); } // Create an Option element for the managed build project file (.CDTBUILD) @@ -738,13 +738,13 @@ public class Configuration extends BuildObject implements IConfiguration { oldValue = option.getStringValue(); if (oldValue != null && !oldValue.equals(value)) { if (option.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. IOption newSuperClass = option; - if (option.overridesOnlyValue()) { + if (((Option)option).wasOptRef()) { newSuperClass = option.getSuperClass(); } // Create an Option element for the managed build project file (.CDTBUILD) @@ -792,13 +792,13 @@ public class Configuration extends BuildObject implements IConfiguration { } if(!Arrays.equals(value, oldValue)) { if (option.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. IOption newSuperClass = option; - if (option.overridesOnlyValue()) { + if (((Option)option).wasOptRef()) { newSuperClass = option.getSuperClass(); } // Create an Option element for the managed build project file (.CDTBUILD) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java index d1dccbb1167..8561f59c3de 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java @@ -232,7 +232,7 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions { IOption ourOpt = (IOption)ourOpts.get(i); int j; for (j = 0; j < options.length; j++) { - if (options[j].overridesOnlyValue()) { + if (((Option)options[j]).wasOptRef()) { if (ourOpt.getSuperClass() != null // Remove assumption that ALL options must have superclasses && ourOpt.getSuperClass().getId().equals(options[j].getSuperClass().getId())) { options[j] = ourOpt; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java index 68d3ea0be99..431732cd3c3 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java @@ -78,6 +78,8 @@ public class Option extends BuildObject implements IOption { private boolean verified = false; private boolean isValid = true; /** False for options which are invalid. getOption() * routines will ignore invalid options. */ + private boolean wasOptRef = false; /** True for options which are created because of an + * MBS 2.0 model OptionReference element /* * C O N S T R U C T O R S @@ -303,7 +305,13 @@ public class Option extends BuildObject implements IOption { // Determine if there needs to be a browse button String browseTypeStr = element.getAttribute(BROWSE_TYPE); - if (browseTypeStr == null || browseTypeStr.equals(NONE)) { + if (browseTypeStr == null) { + // Set to null, to indicate no browse type specification + // This will allow any superclasses to be searched for the + // browse type specification, and thus inherited, if found, + // which they should be + browseType = null; + } else if (browseTypeStr.equals(NONE)) { browseType = new Integer(BROWSE_NONE); } else if (browseTypeStr.equals(FILE)) { browseType = new Integer(BROWSE_FILE); @@ -315,7 +323,13 @@ public class Option extends BuildObject implements IOption { // Get the resourceFilter attribute String resFilterStr = element.getAttribute(RESOURCE_FILTER); - if (resFilterStr == null || resFilterStr.equals(ALL)) { + if (resFilterStr == null) { + // Set to null, to indicate no resource filter specification + // This will allow any superclasses to be searched for the + // resource filter specification, and thus inherited, if found, + // which they should be + resourceFilter = null; + } else if (resFilterStr.equals(ALL)) { resourceFilter = new Integer(FILTER_ALL); } else if (resFilterStr.equals(FILE)) { resourceFilter = new Integer(FILTER_FILE); @@ -496,8 +510,15 @@ public class Option extends BuildObject implements IOption { // Determine if there needs to be a browse button if (element.hasAttribute(BROWSE_TYPE)) { String browseTypeStr = element.getAttribute(BROWSE_TYPE); - if (browseTypeStr == null || browseTypeStr.equals(NONE)) { - browseType = new Integer(BROWSE_NONE); + + if (browseTypeStr == null) { + // Set to null, to indicate no browse type specification + // This will allow any superclasses to be searched for the + // browse type specification, and thus inherited, if found, + // which they should be + browseType = null; + } else if (browseTypeStr.equals(NONE)) { + browseType = new Integer(BROWSE_NONE); } else if (browseTypeStr.equals(FILE)) { browseType = new Integer(BROWSE_FILE); } else if (browseTypeStr.equals(DIR)) { @@ -515,8 +536,14 @@ public class Option extends BuildObject implements IOption { // Get the resourceFilter attribute if (element.hasAttribute(RESOURCE_FILTER)) { String resFilterStr = element.getAttribute(RESOURCE_FILTER); - if (resFilterStr == null || resFilterStr.equals(ALL)) { - resourceFilter = new Integer(FILTER_ALL); + if (resFilterStr == null) { + // Set to null, to indicate no resource filter specification + // This will allow any superclasses to be searched for the + // resource filter specification, and thus inherited, if found, + // which they should be + resourceFilter = null; + } else if (resFilterStr.equals(ALL)) { + resourceFilter = new Integer(FILTER_ALL); } else if (resFilterStr.equals(FILE)) { resourceFilter = new Integer(FILTER_FILE); } else if (resFilterStr.equals(PROJECT)) { @@ -1477,6 +1504,7 @@ public class Option extends BuildObject implements IOption { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOption#overridesOnlyValue() + * Deprecated since 3.0.1 */ public boolean overridesOnlyValue() { if (superClass != null && @@ -1709,6 +1737,18 @@ public class Option extends BuildObject implements IOption { return isValid; } + /** + * @return Returns true if this Option was created from an MBS 2.0 model + * OptionReference element. + */ + public boolean wasOptRef() { + return wasOptRef; + } + + public void setWasOptRef(boolean was) { + wasOptRef = was; + } + /** * @return Returns the version. */ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java index bc25d63c41a..3eca00f38c8 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceConfiguration.java @@ -777,12 +777,12 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi newSuperClass = newSuperClass.getSuperClass(); } if (newSuperClass.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. - if (newSuperClass.overridesOnlyValue()) { + if (((Option)newSuperClass).wasOptRef()) { newSuperClass = newSuperClass.getSuperClass(); } } @@ -817,12 +817,12 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi newSuperClass = newSuperClass.getSuperClass(); } if (newSuperClass.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. - if (newSuperClass.overridesOnlyValue()) { + if (((Option)newSuperClass).wasOptRef()) { newSuperClass = newSuperClass.getSuperClass(); } } @@ -880,12 +880,12 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi newSuperClass = newSuperClass.getSuperClass(); } if (newSuperClass.isExtensionElement()) { - // If the extension element is only overriding the "value" of its superclass, hook the + // If the extension element was created from an MBS 2.0 model OptionReference element, hook the // new option up to its superclass directly. This is to avoid references to oddly id'ed // elements that are automatically generated from V2.0 model optionReferences. If these // end up in the project file, then the project could have a problem when the integration // provider switches to providing the new model. - if (newSuperClass.overridesOnlyValue()) { + if (((Option)newSuperClass).wasOptRef()) { newSuperClass = newSuperClass.getSuperClass(); } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java index be8e1122645..faec831b34a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java @@ -1091,6 +1091,7 @@ public class Target extends BuildObject implements ITarget { // Set the option attributes newOption.setValue(optRef.getValue()); newOption.setValueType(optRef.getValueType()); + ((Option)newOption).setWasOptRef(true); } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java index a80e4fcacfd..ec1bec9a00e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java @@ -2511,7 +2511,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { case IManagedDependencyGenerator.TYPE_EXTERNAL: IResource[] res = depGen.findDependencies(resource, project); for (int i=0; i