1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 04:45:38 +02:00

Additional option enablement functionality and tests

Additional value handler functionality
This commit is contained in:
Mikhail Sennikovsky 2005-12-12 18:10:39 +00:00
parent fba4d49389
commit 512462b093
18 changed files with 1936 additions and 188 deletions

View file

@ -4942,6 +4942,974 @@
</toolChain>
</configuration>
</projectType>
<!-- enablement testing -->
<projectType
id="cdt.managedbuild.target.enablement.exe"
isAbstract="false"
isTest="false"
name="enablement.exe"
projectEnvironmentSupplier="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
projectMacroSupplier="org.eclipse.cdt.managedbuilder.core.tests.TestMacro">
<configuration
name="One"
id="cdt.managedbuild.config.enablement.exe.debug"
cleanCommand="rm -rf"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
<toolChain
archList="all"
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
configurationMacroSupplier="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
id="cdt.managedbuild.toolchain.enablement.exe.debug"
isToolChainSupported="org.eclipse.cdt.managedbuilder.core.tests.TestMacro"
name="Dbg ToolChain"
osList="solaris,linux,hpux,aix,qnx"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<targetPlatform
id="cdt.managedbuild.target.enablement.platform.exe.debug"
name="Dbg Platform"
binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE"
osList="solaris,linux,hpux,aix,qnx"
archList="all">
</targetPlatform>
<builder
id="cdt.managedbuild.target.enablement.builder.exe.debug"
name="Dbg Builder"
command="make"
arguments="-k"
variableFormat="@="
isVariableCaseSensitive="false"
reservedMacroNames="PATH"
buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
</builder>
<tool
id="enablement.this.child_1.2.3"
superClass="enablement.this">
<option
id="enablement.macro.test.string"
defaultValue="000"
superClass="gnu.c.compiler.option30.optimization.flags"
value="111"
valueType="string">
</option>
<option
valueType="stringList"
name="ass"
superClass="gnu.cpp.compiler.option30.preprocessor.undef"
id="enablement.macro.test.list">
<listOptionValue value="x"/>
<listOptionValue value="y"/>
<listOptionValue value="z"/>
</option>
<envVarBuildPath
pathType="buildpathInclude"
variableList="CFGI,CFG0,PRJI">
</envVarBuildPath>
<envVarBuildPath
pathType="buildpathLibrary"
variableList="CFGL,PRJL">
</envVarBuildPath>
</tool>
<tool
id="enablement.other.child"
superClass="enablement.other">
</tool>
<tool
id="enablement.this.child.2_1.2.3"
superClass="enablement.this"/>
</toolChain>
</configuration>
</projectType>
<tool
name="compiler.gnu.c"
id="enablement.this"
isAbstract="true"
sources="c"
command="gcc"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
headerExtensions="h"
natureFilter="cnature"
outputs="o"
outputFlag="-o">
<optionCategory
owner="enablement.this"
name="Preproc"
id="testgnu.enablement.c.compiler.category.preprocessor">
</optionCategory>
<option
defaultValue="false"
name="1a"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="test1"
commandFalse="cmdF"
id="enablement.command.c1"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="c1">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="2"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="c2"
commandFalse="cmdF"
id="enablement.command.c2"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="test">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="3"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.commandFalse.c1"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="c1">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="4"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="c2"
id="enablement.commandFalse.c2"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="test">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="5"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.command.c1.commandFalse.cF1"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="c1">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="6"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.command.cmd.commandFalse.cmdF"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="test">
<checkString string="1" value="2"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="test">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="7"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.command.c1.commandFalse.cmdF"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="2"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="c1">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="8"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.command.cmd.commandFalse.cF1"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="test">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="9"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.ui.en"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="UI_ENABLEMENT">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="10"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.ui.vis"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="UI_VISIBILITY">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="11"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.cmd.us"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="2"/>
</enablement>
<enablement type="CMD_USAGE">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="12"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.cmdUs.or.uiVis"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="CMD_USAGE|UI_VISIBILITY">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="13"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.uiEn.or.uiVis"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="UI_ENABLEMENT|UI_VISIBILITY">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="14"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.all"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="ALL">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="15"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.all.ac.vh"
valueType="boolean"
applicabilityCalculator="org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests"
valueHandlerExtraArgument="org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="ALL">
<checkString string="1" value="1"/>
</enablement>
</option>
<!-- marker -->
<option
defaultValue="false"
name="16"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.all.cF1.ac.vh"
valueType="boolean"
applicabilityCalculator="org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests"
valueHandlerExtraArgument="org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="ALL">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="17"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.all.cF.cmdF"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="2"/>
</enablement>
<enablement type="ALL">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="18"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.all.cF.cF1"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement>
<enablement type="ALL">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="19"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="this.boolean"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption/>
</enablement>
</option>
<option
defaultValue="false"
name="20"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.boolean.True"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.boolean" value="true"/>
</enablement>
</option>
<option
defaultValue="false"
name="21"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.boolean.False"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.boolean" value="false"/>
</enablement>
</option>
<option
defaultValue="false"
name="22"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.string.Q.empty"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.string" value=""/>
</enablement>
</option>
<option
defaultValue="false"
name="23"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.string.Q.test a b c"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.string" value="test a b c"/>
</enablement>
</option>
<option
defaultValue="false"
name="24"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.enum.Q.testgnu.enablement.c.optimization.level.optimize"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.enum" value="testgnu.enablement.c.optimization.level.optimize"/>
</enablement>
</option>
<option
defaultValue="false"
name="25"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.Q.true"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption value="true"/>
</enablement>
</option>
<option
defaultValue="false"
name="26"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.string.Q.start ${ParentVersion} stop"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.string" value="start ${ParentVersion} stop"/>
</enablement>
</option>
<option
defaultValue="false"
name="27"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.string.Q.other.string"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.string" otherOptionId="other.string" otherHolderId="enablement.other"/>
</enablement>
</option>
<option
defaultValue="false"
name="28"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOpt.all.Q.this.boolean.Q.other.boolean"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkOption optionId="this.boolean" otherOptionId="other.boolean" otherHolderId="enablement.other"/>
</enablement>
</option>
<option
defaultValue="false"
name="29"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkString"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkString string="1.2.3" value="${ParentVersion}"/>
</enablement>
</option>
<option
defaultValue="false"
name="30"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkString.2"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkString value="1.2.3" string="${ParentVersion}"/>
</enablement>
</option>
<option
defaultValue="false"
name="31"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkString.3"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<checkString value="a ${ParentVersion} b" string="a ${ParentVersion} b"/>
</enablement>
</option>
<option
defaultValue="false"
name="32"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkFalse.false"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<false/>
</enablement>
</option>
<option
defaultValue="false"
name="33"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkNot.false"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<not>
<checkString string="1" value="1"/>
</not>
</enablement>
</option>
<option
defaultValue="false"
name="34"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkOr.true"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<or>
<checkString string="1" value="2"/>
<checkString string="1" value="1"/>
</or>
</enablement>
</option>
<option
defaultValue="false"
name="35"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkAnd.false"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement type="ALL">
<and>
<checkString string="1" value="2"/>
<checkString string="1" value="1"/>
</and>
</enablement>
</option>
<option
defaultValue="false"
name="36"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="cmd"
commandFalse="cmdF"
id="enablement.checkHolder.true.1.false.2"
valueType="boolean">
<!--enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="cF1">
<checkString string="1" value="1"/>
</enablement-->
<enablement>
<checkHolder holderId="enablement.this.child_1.2.3"/>
</enablement>
</option>
<option
defaultValue="false"
name="Posix.Nostdinc"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="-nostdinc"
id="testgnu.enablement.c.compiler.option.preprocessor.nostdinc"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="test">
<checkString string="1" value="1"/>
</enablement>
<enablement type="UI_ENABLEMENT">
<checkString string="1" value="1"/>
</enablement>
<enablement type="UI_VISIBILITY">
<checkString string="1" value="1"/>
</enablement>
<enablement type="CMD_USAGE">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="Posix.Nostdinc"
category="testgnu.enablement.c.compiler.category.preprocessor"
commandFalse="-nostdinc"
id="testgnu1.enablement.c.compiler.option.preprocessor.nostdinc"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="test">
<checkString string="1" value="1"/>
</enablement>
</option>
<option
defaultValue="false"
name="Posix.PreprocOnly"
category="testgnu.enablement.c.compiler.category.preprocessor"
command="-E"
id="testgnu.enablement.c.compiler.option.preprocessor.preprocess"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="command" value="test">
<checkString string="1" value="2"/>
</enablement>
<enablement type="UI_ENABLEMENT">
<checkString string="1" value="2"/>
</enablement>
<enablement type="UI_VISIBILITY">
<checkString string="1" value="2"/>
</enablement>
<enablement type="CMD_USAGE">
<checkString string="1" value="2"/>
</enablement>
</option>
<option
defaultValue="false"
name="Posix.PreprocOnly"
category="testgnu.enablement.c.compiler.category.preprocessor"
commandFalse="-E"
id="testgnu1.enablement.c.compiler.option.preprocessor.preprocess"
valueType="boolean">
<enablement type="CONTAINER_ATTRIBUTE" attribute="commandFalse" value="test">
<checkString string="1" value="2"/>
</enablement>
</option>
<optionCategory
owner="enablement.this"
name="Symbols"
id="testgnu.enablement.c.compiler.category.symbols">
</optionCategory>
<option
name="Posix.DefSym"
category="testgnu.enablement.c.compiler.category.symbols"
command="-D"
id="testgnu.enablement.c.compiler.option.preprocessor.def.symbols"
valueType="definedSymbols">
</option>
<option
name="Posix.UndefSym"
category="testgnu.enablement.c.compiler.category.symbols"
command="-U"
id="testgnu.enablement.c.compiler.option.preprocessor.undef.symbol"
valueType="stringList">
</option>
<optionCategory
owner="enablement.this"
name="Dirs"
id="testgnu.enablement.c.compiler.category.dirs">
</optionCategory>
<option
name="Posix.InclPaths"
category="testgnu.enablement.c.compiler.category.dirs"
command="-I"
id="testgnu.enablement.c.compiler.option.include.paths"
valueType="includePath"
browseType="directory">
</option>
<optionCategory
owner="enablement.this"
name="Optimize"
id="testgnu.enablement.c.compiler.category.optimization">
</optionCategory>
<option
name="Posix.OptLevel"
category="testgnu.enablement.c.compiler.category.optimization"
id="this.enum"
valueType="enumerated">
<enumeratedOptionValue
name="Posix.Optimize.None"
isDefault="false"
command="-O0"
id="testgnu.enablement.c.optimization.level.none">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Optimize.Optimize"
command="-O1"
id="testgnu.enablement.c.optimization.level.optimize">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Optimize.More"
isDefault="true"
command="-O2"
id="testgnu.enablement.c.optimization.level.more">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Optimize.Most"
command="-O3"
id="testgnu.enablement.c.optimization.level.most">
</enumeratedOptionValue>
</option>
<option
name="Posix.Optimize.Flags"
category="testgnu.enablement.c.compiler.category.optimization"
id="this.string"
valueType="string">
</option>
<optionCategory
owner="enablement.this"
name="Debug"
id="testgnu.enablement.c.compiler.category.debug">
</optionCategory>
<option
name="Posix.DebugLevel"
category="testgnu.enablement.c.compiler.category.debug"
id="testgnu.enablement.c.compiler.option.debugging.level"
valueType="enumerated">
<enumeratedOptionValue
name="Posix.Debug.None"
isDefault="false"
id="testgnu.enablement.c.debugging.level.none">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Min"
command="-g1"
id="testgnu.enablement.c.debugging.level.minimal">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Def"
isDefault="true"
command="-g"
id="testgnu.enablement.c.debugging.level.default">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Max"
isDefault="false"
command="-g3"
id="testgnu.enablement.c.debugging.level.max">
</enumeratedOptionValue>
</option>
<option
name="Posix.Debug.Other"
category="testgnu.enablement.c.compiler.category.debug"
id="testgnu.enablement.c.compiler.option.debugging.other"
valueType="string">
</option>
<option
defaultValue="false"
name="Posix.Debug.gprof"
category="testgnu.enablement.c.compiler.category.debug"
command="-pg"
id="testgnu.enablement.c.compiler.option.debugging.gprof"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Debug.prof"
category="testgnu.enablement.c.compiler.category.debug"
command="-p"
id="testgnu.enablement.c.compiler.option.debugging.prof"
valueType="boolean">
</option>
<optionCategory
owner="enablement.this"
name="Warn"
id="testgnu.enablement.c.compiler.category.warnings">
</optionCategory>
<option
defaultValue="false"
name="Posix.Warn.Syntax"
category="testgnu.enablement.c.compiler.category.warnings"
command="-fsyntax-only"
id="testgnu.enablement.c.compiler.option.warnings.syntax"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Warn.Pedandic"
category="testgnu.enablement.c.compiler.category.warnings"
command="-pedantic"
id="testgnu.enablement.c.compiler.option.warnings.pedantic"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Warn.PedErrors"
category="testgnu.enablement.c.compiler.category.warnings"
command="-pedantic-errors"
id="testgnu.enablement.c.compiler.option.warnings.pedantic.error"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Warn.nowarn"
category="testgnu.enablement.c.compiler.category.warnings"
command="-w"
id="testgnu.enablement.c.compiler.option.warnings.nowarn"
valueType="boolean">
</option>
<option
defaultValue="true"
name="Posix.Warn.allwarn"
category="testgnu.enablement.c.compiler.category.warnings"
command="-Wall"
id="testgnu.enablement.c.compiler.option.warnings.allwarn"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Warn.toerrs"
category="testgnu.enablement.c.compiler.category.warnings"
command="-Werror"
id="testgnu.enablement.c.compiler.option.warnings.toerrors"
valueType="boolean">
</option>
<optionCategory
owner="enablement.this"
name="Misc"
id="testgnu.enablement.c.compiler.category.other">
</optionCategory>
<option
defaultValue="-c -fmessage-length=0"
name="OtherFlags"
category="testgnu.enablement.c.compiler.category.other"
id="testgnu.enablement.c.compiler.option.misc.other"
valueType="string">
</option>
<option
defaultValue="false"
name="Posix.Verbose"
category="testgnu.enablement.c.compiler.category.other"
command="-v"
id="testgnu.enablement.c.compiler.option.misc.verbose"
valueType="boolean">
</option>
<option
defaultValue="false"
name="Posix.Ansi"
category="testgnu.enablement.c.compiler.category.other"
command="-ansi"
id="testgnu.enablement.c.compiler.option.misc.ansi"
valueType="boolean">
</option>
</tool>
<tool
name="compiler.gnu.c"
id="enablement.other"
isAbstract="true"
sources="cpp"
command="gcc"
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
headerExtensions="h"
natureFilter="cnature"
outputs="o"
outputFlag="-o">
<optionCategory
owner="enablement.other"
name="Misc"
id="cat.ather">
</optionCategory>
<option
defaultValue="false"
name="Posix.Ansi"
category="cat.ather"
command="-ansi"
id="other.boolean"
valueType="boolean"/>
<option
defaultValue="otherVal ${ParentVersion}"
name="OtherFlags"
category="cat.ather"
id="other.string"
valueType="string">
</option>
<option
name="Posix.DebugLevel"
category="cat.ather"
id="other.enum"
valueType="enumerated">
<enumeratedOptionValue
name="Posix.Debug.None"
isDefault="false"
id="testgnu.enablement.c.debugging.level.none">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Min"
command="-g1"
id="other.enum.minimal">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Def"
isDefault="true"
command="-g"
id="other.enum.default">
</enumeratedOptionValue>
<enumeratedOptionValue
name="Posix.Debug.Max"
isDefault="false"
command="-g3"
id="other.enum.max">
</enumeratedOptionValue>
</option>
</tool>
</extension>
</plugin>

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.testplugin;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
@ -18,6 +19,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.zip.ZipFile;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
@ -28,7 +30,7 @@ import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
@ -38,11 +40,11 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
@ -79,7 +81,7 @@ public class ManagedBuildTestHelper {
workspace.setDescription(workspaceDesc);
IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
//description.setLocation(root.getLocation());
project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID);
}
} else {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@ -102,6 +104,33 @@ public class ManagedBuildTestHelper {
return project;
}
static public IProject createProject(
final String name,
final String projectTypeId) {
try {
return createProject(name,
null,
ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID,
projectTypeId);
} catch (CoreException e) {
TestCase.fail(e.getLocalizedMessage());
}
return null;
}
static public IFile createFile(IProject project, String name){
IFile file = project.getFile(name);
if( file.exists() ){
try {
// file.create( new ByteArrayInputStream( "#include <stdio.h>\n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null );
file.create( new ByteArrayInputStream( new byte[0] ), false, null );
} catch (CoreException e) {
TestCase.fail(e.getLocalizedMessage());
}
}
return file;
}
/**
* Remove the <code>IProject</code> with the name specified in the argument from the
* receiver's workspace.

View file

@ -25,6 +25,7 @@ import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject30MakefileTests;
import org.eclipse.cdt.managedbuilder.core.tests.ManagedProjectUpdateTests;
import org.eclipse.cdt.managedbuilder.core.tests.MultiVersionSupportTests;
import org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests;
import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests;
/**
@ -57,6 +58,7 @@ public class AllManagedBuildTests {
suite.addTest(ManagedBuildMacrosTests.suite());
suite.addTest(ManagedBuildTCSupportedTest.suite());
suite.addTest(MultiVersionSupportTests.suite());
suite.addTest(OptionEnablementTests.suite());
//$JUnit-END$
return suite;
}

View file

@ -0,0 +1,544 @@
/*******************************************************************************
* Copyright (c) 2005 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
public class OptionEnablementTests extends TestCase
implements IManagedOptionValueHandler,
IOptionApplicability{
private static boolean fEnUiVisible;
private static boolean fEnUiEnabled;
private static boolean fEnCmdUsed;
private static boolean fHandleValueCalled;
private static final String thisEnumIds[] = new String[]{"testgnu.enablement.c.optimization.level.optimize", "testgnu.enablement.c.optimization.level.more"};
private static final String thisStrings[] = new String[]{
// "",
// "test a b c",
// "some buggy string",
"start 1.2.3 stop"};
public boolean handleValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, int event) {
// TODO Auto-generated method stub
return false;
}
public boolean isDefaultValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument) {
// TODO Auto-generated method stub
return false;
}
public boolean isEnumValueAppropriate(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, String enumValue) {
// TODO Auto-generated method stub
return false;
}
public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) {
return fEnCmdUsed;
}
public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) {
return fEnUiVisible;
}
public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) {
return fEnUiEnabled;
}
public static Test suite() {
return new TestSuite(OptionEnablementTests.class);
}
private void resetValueHandler(){
fHandleValueCalled = false;
}
private void setEnablement(boolean cmdUs, boolean uiVis, boolean uiEn){
fEnUiVisible = uiVis;
fEnUiEnabled = uiEn;
fEnCmdUsed = cmdUs;
}
public void testEnablement(){
resetValueHandler();
IProject project = ManagedBuildTestHelper.createProject("en",
"cdt.managedbuild.target.enablement.exe");
IFile aFile = ManagedBuildTestHelper.createFile(project, "a.c");
IFile bFile = ManagedBuildTestHelper.createFile(project, "b.c");
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IConfiguration cfg = info.getManagedProject().getConfigurations()[0];
assertFalse(fHandleValueCalled);
doTestEnablement(cfg);
doEnumAllValues(cfg);
ManagedBuildTestHelper.removeProject("en");
}
private void doEnumAllValues(IBuildObject cfgBo){
ITool thisTool = getTool(cfgBo,"enablement.this.child_1.2.3");
ITool otherTool = getTool(cfgBo,"enablement.other");
IBuildObject thisCfg = thisTool.getParent();
IBuildObject otherCfg = otherTool.getParent();
for(int i = 0; i < thisStrings.length; i++){
String strVal = thisStrings[i];
setOption(cfgBo, thisTool, "this.string", strVal);
doTestEnablement(cfgBo);
}
/*
for(int i = 0; i < thisEnumIds.length; i++){
String strVal = thisEnumIds[i];
setOption(cfgBo, thisTool, "this.enum", strVal);
doTestEnablement(cfgBo);
}
*/
setOption(cfgBo, thisTool, "this.boolean", false);
doTestEnablement(cfgBo);
setOption(cfgBo, thisTool, "this.boolean", true);
doTestEnablement(cfgBo);
}
private ITool getTool(IBuildObject cfgBo, String id){
IResourceConfiguration rcCfg = null;
IConfiguration cfg = null;
ITool tool = null;
if(cfgBo instanceof IResourceConfiguration){
rcCfg = (IResourceConfiguration)rcCfg;
cfg = rcCfg.getParent();
ITool tools[] = rcCfg.getTools();
for(int i = 0; i < tools.length; i++){
for(ITool tmp = tools[i]; tmp != null; tmp=tmp.getSuperClass()){
if(tmp.getId().equals(id)){
tool = tools[i];
break;
}
}
}
} else if(cfgBo instanceof IConfiguration){
cfg = (IConfiguration)cfgBo;
tool = cfg.getToolsBySuperClassId(id)[0];
} else
fail("wrong argument");
return tool;
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, String id, boolean value){
return setOption(cfg, holder, holder.getOptionBySuperClassId(id), value);
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, IOption option, boolean value){
try{
if(cfg instanceof IConfiguration)
return ((IConfiguration)cfg).setOption(holder, option, value);
else if(cfg instanceof IResourceConfiguration)
return ((IResourceConfiguration)cfg).setOption(holder, option, value);
} catch(BuildException e){
fail(e.getLocalizedMessage());
}
fail("wrong arg");
return null;
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, String id, String value){
return setOption(cfg, holder, holder.getOptionBySuperClassId(id), value);
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, IOption option, String value){
try{
if(cfg instanceof IConfiguration)
return ((IConfiguration)cfg).setOption(holder, option, value);
else if(cfg instanceof IResourceConfiguration)
return ((IResourceConfiguration)cfg).setOption(holder, option, value);
} catch(BuildException e){
fail(e.getLocalizedMessage());
}
fail("wrong arg");
return null;
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, String id, String value[]){
return setOption(cfg, holder, holder.getOptionBySuperClassId(id), value);
}
private IOption setOption(IBuildObject cfg, IHoldsOptions holder, IOption option, String value[]){
try{
if(cfg instanceof IConfiguration)
return ((IConfiguration)cfg).setOption(holder, option, value);
else if(cfg instanceof IResourceConfiguration)
return ((IResourceConfiguration)cfg).setOption(holder, option, value);
} catch(BuildException e){
fail(e.getLocalizedMessage());
}
fail("wrong arg");
return null;
}
private void doTestEnablement(IBuildObject cfg){
ITool tool = getTool(cfg, "enablement.this.child_1.2.3");
ITool otherTool = getTool(cfg, "enablement.other");
ITool tool2 = getTool(cfg, "enablement.this.child.2_1.2.3");
// IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IOption thisBoolean = tool.getOptionBySuperClassId("this.boolean");
IOption thisString = tool.getOptionBySuperClassId("this.string");
IOption thisEnum = tool.getOptionBySuperClassId("this.enum");
IOption otherString = otherTool.getOptionBySuperClassId("other.string");
IOption otherBoolean = otherTool.getOptionBySuperClassId("other.boolean");
try{
IOption option = tool.getOptionBySuperClassId("enablement.command.c1");
assertEquals(option.getCommand(), "c1");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.command.c2");
assertEquals(option.getCommand(), "c2");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.commandFalse.c1");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "c1");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.commandFalse.c2");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "c2");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.command.c1.commandFalse.cF1");
assertEquals(option.getCommand(), "c1");
assertEquals(option.getCommandFalse(), "cF1");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.command.cmd.commandFalse.cmdF");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.command.c1.commandFalse.cmdF");
assertEquals(option.getCommand(), "c1");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.command.cmd.commandFalse.cF1");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.ui.en");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.ui.vis");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.cmd.us");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.cmdUs.or.uiVis");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.uiEn.or.uiVis");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.all");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.all.ac.vh");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
setEnablement(false, false, false);
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
setEnablement(false, true, false);
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
setEnablement(false, false, true);
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
setEnablement(true, false, false);
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
setEnablement(false, false, false);
option = tool.getOptionBySuperClassId("enablement.all.cF1.ac.vh");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
setEnablement(true, false, true);
option = tool.getOptionBySuperClassId("enablement.all.cF.cmdF");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.all.cF.cF1");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cF1");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("this.boolean");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.boolean.True");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisBoolean.getBooleanValue() == true,
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisBoolean.getBooleanValue() == true,
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisBoolean.getBooleanValue() == true,
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.boolean.False");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisBoolean.getBooleanValue() == false,
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisBoolean.getBooleanValue() == false,
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisBoolean.getBooleanValue() == false,
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.empty");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisString.getStringValue().equals(""),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(""),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(""),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.test a b c");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisString.getStringValue().equals("test a b c"),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisString.getStringValue().equals("test a b c"),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisString.getStringValue().equals("test a b c"),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.enum.Q.testgnu.enablement.c.optimization.level.optimize");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
String id = thisEnum.getEnumeratedId(thisEnum.getStringValue());
if(id == null)
id = "";
assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.Q.true");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(option.getBooleanValue() == true,
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(option.getBooleanValue()== true,
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(option.getBooleanValue() == true,
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.start ${ParentVersion} stop");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.other.string");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.other.string");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertEquals(thisString.getStringValue().equals(otherString.getStringValue()),
option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkString");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkString.2");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkString.3");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkFalse.false");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkNot.false");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkOr.true");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkAnd.false");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool.getOptionBySuperClassId("enablement.checkHolder.true.1.false.2");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option));
assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option));
option = tool2.getOptionBySuperClassId("enablement.checkHolder.true.1.false.2");
assertEquals(option.getCommand(), "cmd");
assertEquals(option.getCommandFalse(), "cmdF");
assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool2, option));
assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool2, option));
assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool2, option));
}catch (BuildException e){
fail(e.getLocalizedMessage());
}
}
}

View file

@ -1626,6 +1626,7 @@ If the &quot;buildPathResolver&quot; attribute is specified, the &quot;pathDelim
<element ref="checkOption"/>
<element ref="checkString"/>
<element ref="false"/>
<element ref="checkHolder"/>
</choice>
<attribute name="type" type="string" use="default" value="ALL">
<annotation>
@ -1635,11 +1636,35 @@ Can contain the following values:
UI_VISIBILITY – the given enablement expression specifies whether the option is to be visible in UI,
UI_ENABLEMENT – the given enablement expression specifies the enable state of the controls that represent the option in UI,
CMD_USAGE – the given enablement expression specifies whether the option is to be used in command line
CONTAINER_ATTRIBUTE - the given enablement expressions specifies thecontainer attribute value
ALL – this value means the combination of all the above values.
Several types could be specified simultaneously using the &quot;|&quot; as a delimiter, e.g.:
type=&quot;UI_VISIBILITY|CMD_USAGE&quot;
</documentation>
</annotation>
</attribute>
<attribute name="attribute">
<annotation>
<documentation>
This attribute should be used only for the CONTAINER_ATTRIBUTE enablement to specify the name of the attribute for which this enablement applies. Currently the following option attributes are supported:
&quot;command&quot;
&quot;commandFalse&quot;
</documentation>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="command">
</enumeration>
<enumeration value="commandFalse">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="value" type="string">
<annotation>
<documentation>
This attribute should be used only for the CONTAINER_ATTRIBUTE enablement to specify the value of the attribute specified in the &quot;attribute&quot; for which this enablement applies
</documentation>
</annotation>
</attribute>
@ -1659,6 +1684,7 @@ type=&quot;UI_VISIBILITY|CMD_USAGE&quot;
<element ref="not"/>
<element ref="checkOption"/>
<element ref="checkString"/>
<element ref="checkHolder"/>
</sequence>
</complexType>
</element>
@ -1676,6 +1702,7 @@ type=&quot;UI_VISIBILITY|CMD_USAGE&quot;
<element ref="not"/>
<element ref="checkOption"/>
<element ref="checkString"/>
<element ref="checkHolder"/>
</sequence>
</complexType>
</element>
@ -1693,6 +1720,7 @@ type=&quot;UI_VISIBILITY|CMD_USAGE&quot;
<element ref="not"/>
<element ref="checkOption"/>
<element ref="checkString"/>
<element ref="checkHolder"/>
</choice>
</complexType>
</element>
@ -1723,7 +1751,6 @@ type=&quot;UI_VISIBILITY|CMD_USAGE&quot;
<documentation>
Specifies the expected value. If the current option value matches the value specified in this attribute, the checkOption element is treated as true, otherwise – as false.
The expected value could be specified either as a string that may contain build macros or as a regular expression. During the comparison, the build macros are resolved and the option value is checked to match the resulting string or regular expression. The way the expected value is specified and treated depends on the value of the isRegex attribute
</documentation>
</annotation>
</attribute>
@ -1761,7 +1788,7 @@ The expected value could be specified either as a string that may contain build
<attribute name="string" type="string" use="required">
<annotation>
<documentation>
Represents the string to be checked. The string will typically contain the build macros.
Represents the string to be checked. The string will typically contain the build macros.
</documentation>
</annotation>
</attribute>
@ -1771,7 +1798,6 @@ The expected value could be specified either as a string that may contain build
Specifies the expected value. If the current string specified in the “string” attribute matches the value specified in this attribute, the checkString element is treated as true, otherwise – as false.
The expected value could be specified either as a string that might contain the build macros or as a regular expression.
The way the value is specified and treated depends on the value of the isRegex attribute.
</documentation>
</annotation>
</attribute>
@ -1793,6 +1819,23 @@ The way the value is specified and treated depends on the value of the isRegex a
</annotation>
</element>
<element name="checkHolder">
<annotation>
<documentation>
Performs the holder check.
</documentation>
</annotation>
<complexType>
<attribute name="holderId" type="string" use="required">
<annotation>
<documentation>
Specifies the holder id to be checked. The checkHolder is treated as true if the id specified in this attribute matches with the option&apos;s holder id or the id of some holder&apos;s super-class. Otherwise the checkHolder is treated as false.
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>

View file

@ -141,4 +141,19 @@ public interface IHoldsOptions extends IBuildObject {
*/
public void createOptions(IHoldsOptions superClass);
/**
* This method should be called in order to obtain the option whose value and attributes could be directly changed/adjusted
*
* @param id the option to be modified
* @param adjustExtension if false, modifications are to be made for the non-extension element
* (only for some particular configuration associated with some eclipse project)
* This is the most common use of this method.
*
* True is allowed only while while handling the LOAD value handler event.
* In this case modifications are to be made for the extension element.
* This could be used for adjusting extension options
* Note: changing this option will affect all non-extension configurations using this option!
*/
IOption getOptionToSet(IOption option, boolean adjustExtension) throws BuildException;
}

View file

@ -38,6 +38,10 @@ public interface IManagedOptionValueHandler{
* button (or the OK button). The valueHandler can
* transfer the value of the option to its own
* back-end. */
public final int EVENT_LOAD = 5; /** Posted when the managed build extensions (defined in the manifext files)extension option isThe option has been set by pressing the Apply
* are loadded.
* The handler is allowed to adjust the extension elements
*/
/**
* Handles transfer between values between UI element and

View file

@ -16,6 +16,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -26,7 +27,6 @@ import java.util.Map;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;
import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -49,6 +49,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListener;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.core.BooleanExpressionApplicabilityCalculator;
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.DefaultManagedConfigElement;
@ -76,21 +77,18 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
@ -2028,7 +2026,61 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
}
}
}
performAdjustments();
}
private static void performAdjustments(){
IProjectType types[] = getDefinedProjectTypes();
for(int i = 0; i < types.length; i++){
IConfiguration cfgs[] = types[i].getConfigurations();
for(int j = 0; j < cfgs.length; j++){
adjustConfig(cfgs[j]);
}
}
for(int i = 0; i < types.length; i++){
IConfiguration cfgs[] = types[i].getConfigurations();
for(int j = 0; j < cfgs.length; j++){
performValueHandlerEvent(cfgs[j], IManagedOptionValueHandler.EVENT_LOAD);
}
}
}
private static void adjustConfig(IConfiguration cfg){
IToolChain tc = cfg.getToolChain();
adjustHolder(cfg, tc);
ITool tools[] = cfg.getTools();
for(int i = 0; i < tools.length; i++){
adjustHolder(cfg, tools[i]);
}
IResourceConfiguration rcCfgs[] = cfg.getResourceConfigurations();
for(int i = 0; i <rcCfgs.length; i++){
ITool rcTools[] = rcCfgs[i].getTools();
for(int j = 0; j < rcTools.length; j++){
adjustHolder(rcCfgs[i], rcTools[j]);
}
}
}
private static void adjustHolder(IBuildObject cfg, IHoldsOptions holder){
IOption options[] = holder.getOptions();
for(int i = 0; i < options.length; i++){
Option option = (Option)options[i];
BooleanExpressionApplicabilityCalculator calc =
option.getBooleanExpressionCalculator();
if(calc != null)
calc.performAdjustment(cfg,holder,option);
}
}
private static void loadConfigElements(IManagedConfigElement[] elements, String revision) {
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {

View file

@ -58,4 +58,14 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab
}
return true;
}
public boolean performAdjustment(IBuildObject configuration,
IHoldsOptions holder, IOption option){
boolean adjusted = false;
for(int i = 0; i < fExpressions.length; i++){
if(fExpressions[i].performAdjustment(configuration, holder, option))
adjusted = true;
}
return adjusted;
}
}

View file

@ -717,27 +717,8 @@ public class Configuration extends BuildObject implements IConfiguration {
// Is there a change?
IOption retOpt = option;
if (option.getBooleanValue() != value) {
if (option.isExtensionElement()) {
// 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)option).wasOptRef()) {
newSuperClass = option.getSuperClass();
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
}
return retOpt;
@ -751,27 +732,8 @@ public class Configuration extends BuildObject implements IConfiguration {
String oldValue;
oldValue = option.getStringValue();
if (oldValue != null && !oldValue.equals(value)) {
if (option.isExtensionElement()) {
// 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)option).wasOptRef()) {
newSuperClass = option.getSuperClass();
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
}
return retOpt;
@ -805,27 +767,8 @@ public class Configuration extends BuildObject implements IConfiguration {
break;
}
if(!Arrays.equals(value, oldValue)) {
if (option.isExtensionElement()) {
// 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)option).wasOptRef()) {
newSuperClass = option.getSuperClass();
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
rebuildNeeded = true;
}
return retOpt;

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Option;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -190,7 +189,8 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement) {
Option option = new Option(this, superClass, Id, name, isExtensionElement);
addOption(option);
setDirty(true);
if(!isExtensionElement)
setDirty(true);
return option;
}
@ -474,7 +474,8 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
Iterator iter = optionElements.listIterator();
while (iter.hasNext()) {
Option option = (Option) iter.next();
option.setDirty(false);
if(!option.isExtensionElement())
option.setDirty(false);
}
}
}
@ -507,4 +508,56 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
}
}
}
public IOption getOptionToSet(IOption option, boolean adjustExtension) throws BuildException{
IOption setOption = null;
if(option.getOptionHolder() != this)
option = getOptionBySuperClassId(option.getId());
if(adjustExtension){
for(; option != null && !option.isExtensionElement(); option=option.getSuperClass()){}
if(option != null){
IHoldsOptions holder = option.getOptionHolder();
if(holder == this)
setOption = option;
else {
IOption newSuperClass = option;
if (((Option)option).wasOptRef()) {
newSuperClass = option.getSuperClass();
}
// Create a new extension Option element
String subId;
subId = newSuperClass.getId() + ".adjusted." + new Integer(ManagedBuildManager.getRandomNumber()); //$NON-NLS-1$ //$NON-NLS-2$
setOption = createOption(newSuperClass, subId, null, true);
((Option)setOption).setAdjusted(true);
setOption.setValueType(option.getValueType());
}
}
} else {
if(option.getOptionHolder() == this && !option.isExtensionElement()){
setOption = option;
} else {
IOption newSuperClass = option;
for(;
newSuperClass != null && !newSuperClass.isExtensionElement();
newSuperClass = newSuperClass.getSuperClass()){}
if (((Option)newSuperClass).wasOptRef()) {
newSuperClass = newSuperClass.getSuperClass();
}
if(((Option)newSuperClass).isAdjustedExtension()){
newSuperClass = newSuperClass.getSuperClass();
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
setOption = createOption(newSuperClass, subId, null, false);
setOption.setValueType(option.getValueType());
}
}
return setOption;
}
}

View file

@ -74,6 +74,7 @@ public class Option extends BuildObject implements IOption {
private String valueHandlerExtraArgument;
private IConfigurationElement applicabilityCalculatorElement = null;
private IOptionApplicability applicabilityCalculator = null;
private BooleanExpressionApplicabilityCalculator booleanExpressionCalculator = null;
// Miscellaneous
private boolean isExtensionOption = false;
private boolean isDirty = false;
@ -83,6 +84,8 @@ public class Option extends BuildObject implements IOption {
* routines will ignore invalid options. */
private boolean wasOptRef = false; /** True for options which are created because of an
* MBS 2.0 model OptionReference element
*/
private boolean isUdjusted = false;
/*
* C O N S T R U C T O R S
@ -250,6 +253,8 @@ public class Option extends BuildObject implements IOption {
category = option.category;
applicabilityCalculatorElement = option.applicabilityCalculatorElement;
applicabilityCalculator = option.applicabilityCalculator;
booleanExpressionCalculator = option.booleanExpressionCalculator;
if (option.valueHandlerElement != null) {
valueHandlerElement = option.valueHandlerElement;
@ -259,7 +264,8 @@ public class Option extends BuildObject implements IOption {
valueHandlerExtraArgument = new String(option.valueHandlerExtraArgument);
}
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
/*
@ -346,15 +352,17 @@ public class Option extends BuildObject implements IOption {
resourceFilter = new Integer(FILTER_PROJECT);
}
//get enablements
IManagedConfigElement enablements[] = element.getChildren(OptionEnablementExpression.NAME);
if(enablements.length > 0)
booleanExpressionCalculator = new BooleanExpressionApplicabilityCalculator(enablements);
// get the applicability calculator, if any
String applicabilityCalculatorStr = element.getAttribute(APPLICABILITY_CALCULATOR);
if (applicabilityCalculatorStr != null && element instanceof DefaultManagedConfigElement) {
applicabilityCalculatorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
} else {
IManagedConfigElement enablements[] = element.getChildren(OptionEnablementExpression.NAME);
if(enablements.length > 0)
applicabilityCalculator = new BooleanExpressionApplicabilityCalculator(enablements);
applicabilityCalculator = booleanExpressionCalculator;
}
// valueHandler
@ -1329,7 +1337,8 @@ public class Option extends BuildObject implements IOption {
*/
public void setDefaultValue(Object v) {
defaultValue = v;
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
/* (non-Javadoc)
@ -1343,7 +1352,8 @@ public class Option extends BuildObject implements IOption {
} else {
categoryId = null;
}
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
}
@ -1354,7 +1364,8 @@ public class Option extends BuildObject implements IOption {
if (cmd == null && command == null) return;
if (cmd == null || command == null || !cmd.equals(command)) {
command = cmd;
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1365,7 +1376,8 @@ public class Option extends BuildObject implements IOption {
if (cmd == null && commandFalse == null) return;
if (cmd == null || commandFalse == null || !cmd.equals(commandFalse)) {
commandFalse = cmd;
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1376,7 +1388,8 @@ public class Option extends BuildObject implements IOption {
if (tooltip == null && tip == null) return;
if (tooltip == null || tip == null || !tooltip.equals(tip)) {
tip = tooltip;
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1386,7 +1399,8 @@ public class Option extends BuildObject implements IOption {
public void setResourceFilter(int filter) {
if (resourceFilter == null || !(filter == resourceFilter.intValue())) {
resourceFilter = new Integer(filter);
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1396,7 +1410,8 @@ public class Option extends BuildObject implements IOption {
public void setBrowseType(int type) {
if (browseType == null || !(type == browseType.intValue())) {
browseType = new Integer(type);
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1409,7 +1424,8 @@ public class Option extends BuildObject implements IOption {
} else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
@ -1423,7 +1439,8 @@ public class Option extends BuildObject implements IOption {
} else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
@ -1446,7 +1463,8 @@ public class Option extends BuildObject implements IOption {
else {
throw new BuildException(ManagedMakeMessages.getResourceString("Option.error.bad_value_type")); //$NON-NLS-1$
}
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
/* (non-Javadoc)
@ -1454,7 +1472,8 @@ public class Option extends BuildObject implements IOption {
*/
public void setValue(Object v) {
value = v;
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
/* (non-Javadoc)
@ -1464,7 +1483,8 @@ public class Option extends BuildObject implements IOption {
// TODO: Verify that this is a valid type
if (valueType == null || valueType.intValue() != type) {
valueType = new Integer(type);
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
}
@ -1485,7 +1505,8 @@ public class Option extends BuildObject implements IOption {
*/
public void setValueHandlerElement(IConfigurationElement element) {
valueHandlerElement = element;
setDirty(true);
if(!isExtensionElement())
setDirty(true);
}
/* (non-Javadoc)
@ -1536,7 +1557,8 @@ public class Option extends BuildObject implements IOption {
valueHandlerExtraArgument == null ||
!extraArgument.equals(valueHandlerExtraArgument)) {
valueHandlerExtraArgument = extraArgument;
isDirty = true;
if(!isExtensionElement())
isDirty = true;
}
}
@ -1815,5 +1837,17 @@ public class Option extends BuildObject implements IOption {
public void setVersion(PluginVersionIdentifier version) {
// Do nothing
}
public BooleanExpressionApplicabilityCalculator getBooleanExpressionCalculator(){
return booleanExpressionCalculator;
}
public boolean isAdjustedExtension(){
return isUdjusted;
}
public void setAdjusted(boolean adjusted) {
isUdjusted = adjusted;
}
}

View file

@ -766,32 +766,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
if (option.getBooleanValue() != value) {
// If this resource config does not already override this option, then we need to
// create a new option
if (getHoldersParent(option) != this) {
IOption newSuperClass = option;
if (!newSuperClass.isExtensionElement()) {
newSuperClass = newSuperClass.getSuperClass();
}
if (newSuperClass.isExtensionElement()) {
// 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 (((Option)newSuperClass).wasOptRef()) {
newSuperClass = newSuperClass.getSuperClass();
}
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);
@ -806,32 +782,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
if (oldValue != null && !oldValue.equals(value)) {
// If this resource config does not already override this option, then we need to
// create a new option
if (getHoldersParent(option) != this) {
IOption newSuperClass = option;
if (!newSuperClass.isExtensionElement()) {
newSuperClass = newSuperClass.getSuperClass();
}
if (newSuperClass.isExtensionElement()) {
// 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 (((Option)newSuperClass).wasOptRef()) {
newSuperClass = newSuperClass.getSuperClass();
}
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);
@ -867,34 +819,8 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
break;
}
if(!Arrays.equals(value, oldValue)) {
// If this resource config does not already override this option, then we need to
// create a new option
if (getHoldersParent(option) != this) {
IOption newSuperClass = option;
if (!newSuperClass.isExtensionElement()) {
newSuperClass = newSuperClass.getSuperClass();
}
if (newSuperClass.isExtensionElement()) {
// 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 (((Option)newSuperClass).wasOptRef()) {
newSuperClass = newSuperClass.getSuperClass();
}
}
// Create an Option element for the managed build project file (.CDTBUILD)
String subId;
int nnn = ManagedBuildManager.getRandomNumber();
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
retOpt = holder.createOption(newSuperClass, subId, null, false);
retOpt.setValueType(option.getValueType());
retOpt.setValue(value);
setDirty(true);
} else {
option.setValue(value);
}
retOpt = holder.getOptionToSet(option, false);
retOpt.setValue(value);
// TODO: This causes the entire project to be rebuilt. Is there a way to only have this
// file rebuilt? "Clean" its output? Change its modification date?
parent.setRebuildState(true);

View file

@ -1244,4 +1244,8 @@ public class ToolReference implements IToolReference {
public String getManagedBuildRevision() {
return null;
}
public IOption getOptionToSet(IOption option, boolean adjustExtension){
return null;
}
}

View file

@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2005 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.enablement;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
public class CheckHolderExpression implements IBooleanExpression {
public static final String NAME = "checkHolder"; //$NON-NLS-1$
public static final String HOLDER_ID = "holderId"; //$NON-NLS-1$
private String fHolderId;
public CheckHolderExpression(IManagedConfigElement element){
fHolderId = element.getAttribute(HOLDER_ID);
}
public boolean evaluate(IBuildObject configuration, IHoldsOptions holder,
IOption option) {
if(fHolderId != null){
for(; holder != null; holder = getHolderSuperClass(holder)){
if(fHolderId.equals(holder.getId()))
return true;
}
return false;
}
return true;
}
private IHoldsOptions getHolderSuperClass(IHoldsOptions holder){
if(holder instanceof ITool)
return ((ITool)holder).getSuperClass();
else if(holder instanceof IToolChain)
return ((IToolChain)holder).getSuperClass();
return null;
}
}

View file

@ -46,6 +46,8 @@ public abstract class CompositeExpression implements IBooleanExpression {
return new CheckStringExpression(element);
else if(FalseExpression.NAME.equals(name))
return new FalseExpression(element);
else if(CheckHolderExpression.NAME.equals(name))
return new CheckHolderExpression(element);
return null;
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.internal.enablement;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@ -25,21 +26,55 @@ public class OptionEnablementExpression extends AndExpression{
public static final String TYPE_UI_VISIBILITY = "UI_VISIBILITY"; //$NON-NLS-1$
public static final String TYPE_UI_ENABLEMENT = "UI_ENABLEMENT"; //$NON-NLS-1$
public static final String TYPE_CMD_USAGE = "CMD_USAGE"; //$NON-NLS-1$
public static final String TYPE_CONTAINER_ATTRIBUTE = "CONTAINER_ATTRIBUTE"; //$NON-NLS-1$
public static final String TYPE_ALL = "ALL"; //$NON-NLS-1$
public static final String FLAG_DELIMITER = "|"; //$NON-NLS-1$
public static final String ATTRIBUTE = "attribute"; //$NON-NLS-1$
public static final String VALUE = "value"; //$NON-NLS-1$
private static final String fSupportedAttributes[] = {
IOption.COMMAND,
IOption.COMMAND_FALSE,
};
public static final int FLAG_UI_VISIBILITY = 0x01;
public static final int FLAG_UI_ENABLEMENT = 0x02;
public static final int FLAG_CMD_USAGE = 0x04;
public static final int FLAG_CONTAINER_ATTRIBUTE = 0x08;
public static final int FLAG_ALL = ~0;
private int fEnablementFlags;
private String fAttribute;
private String fValue;
public OptionEnablementExpression(IManagedConfigElement element) {
super(element);
fEnablementFlags = calculateFlags(element.getAttribute(TYPE));
fAttribute = element.getAttribute(ATTRIBUTE);
fValue = element.getAttribute(VALUE);
adjustAttributeSupport();
}
private void adjustAttributeSupport(){
boolean cleanAttrFlag = true;
if(fAttribute != null && fValue != null){
for(int i = 0; i < fSupportedAttributes.length; i++){
if(fAttribute.equals(fSupportedAttributes[i])){
cleanAttrFlag = false;
break;
}
}
}
if(cleanAttrFlag){
fEnablementFlags &= ~FLAG_CONTAINER_ATTRIBUTE;
fAttribute = null;
fValue = null;
}
}
public String[] convertToList(String value, String delimiter){
@ -80,6 +115,8 @@ public class OptionEnablementExpression extends AndExpression{
flags |= FLAG_UI_ENABLEMENT;
else if(TYPE_CMD_USAGE.equals(str))
flags |= FLAG_CMD_USAGE;
else if(TYPE_CONTAINER_ATTRIBUTE.equals(str))
flags |= FLAG_CONTAINER_ATTRIBUTE;
else if(TYPE_ALL.equals(str))
flags |= FLAG_ALL;
}
@ -94,11 +131,18 @@ public class OptionEnablementExpression extends AndExpression{
IHoldsOptions holder,
IOption option,
int flags){
if(!checkFlags(flags) || evaluate(configuration, holder, option))
return true;
return false;
return evaluate(configuration, holder, option, flags, (FLAG_CONTAINER_ATTRIBUTE & flags) == 0);
}
public boolean evaluate(IBuildObject configuration,
IHoldsOptions holder,
IOption option,
int flags,
boolean bDefault){
return checkFlags(flags) ? evaluate(configuration, holder, option)
: bDefault;
}
/* public boolean evaluate(IBuildObject configuration,
IHoldsOptions holder,
IOption option) {
@ -114,4 +158,25 @@ public class OptionEnablementExpression extends AndExpression{
public int getFlags(){
return fEnablementFlags;
}
public boolean performAdjustment(IBuildObject configuration,
IHoldsOptions holder,
IOption option){
if(evaluate(configuration,holder,option,FLAG_CONTAINER_ATTRIBUTE)){
try{
if(IOption.COMMAND.equals(fAttribute)){
IOption setOption = holder.getOptionToSet(option, true);
setOption.setCommand(fValue);
}else if(IOption.COMMAND_FALSE.equals(fAttribute)){
IOption setOption = holder.getOptionToSet(option, true);
setOption.setCommandFalse(fValue);
}else
return false;
}catch (BuildException e){
return false;
}
return true;
}
return false;
}
}

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.internal.core.Option;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
import org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor;
@ -120,11 +121,12 @@ public class BuildToolSettingsPreferenceStore implements IPreferenceStore {
}
private static IOption getExtensionOption(IOption option){
do {
if(option.isExtensionElement())
return option;
} while ((option = option.getSuperClass()) != null);
return null;
for(;option != null && (!option.isExtensionElement()
|| ((Option)option).isAdjustedExtension()
|| ((Option)option).wasOptRef());
option = option.getSuperClass()){}
return option;
}
public void addPropertyChangeListener(IPropertyChangeListener listener) {
@ -269,7 +271,7 @@ public class BuildToolSettingsPreferenceStore implements IPreferenceStore {
IOption option = (IOption)options[i][1];
if(option.getId().equals(name)
|| (!option.isExtensionElement()
|| ((!option.isExtensionElement() || ((Option)option).isAdjustedExtension() || ((Option)option).wasOptRef())
&& option.getSuperClass() != null
&& option.getSuperClass().getId().equals(name)))
return options[i];