1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Apply Bob M. patch for browseType and resourceFilter attributes.

Fix problem with overridesOnlyValue uncovered by Bob's fix.
This commit is contained in:
Leo Treggiari 2005-08-23 22:01:17 +00:00
parent fece65cbf3
commit a1ccd95cad
7 changed files with 62 additions and 20 deletions

View file

@ -395,6 +395,7 @@ public interface IOption extends IBuildObject {
* of its superclass and <code>false</code> if it overrides other attributes.
*
* @return boolean
* @deprecated
*/
public boolean overridesOnlyValue();

View file

@ -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)

View file

@ -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;

View file

@ -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.
*/

View file

@ -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();
}
}

View file

@ -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);
}
}

View file

@ -2511,7 +2511,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
case IManagedDependencyGenerator.TYPE_EXTERNAL:
IResource[] res = depGen.findDependencies(resource, project);
for (int i=0; i<res.length; i++) {
IPath dep = res[i].getFullPath();
IPath dep = res[i].getProjectRelativePath();
deps.add(dep);
}
break;