Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Applied Patch [HEADONLY]: Saving/loading option values in new build model

See IConfiguration.setOptionValue() for setting options.

Doug Schaefer
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Index: build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java,v
retrieving revision 1.7
diff -u -r1.7 Configuration.java
--- build/org/eclipse/cdt/internal/core/build/managed/Configuration.java	21 Apr 2003 19:37:46 -0000	1.7
+++ build/org/eclipse/cdt/internal/core/build/managed/Configuration.java	25 Apr 2003 14:27:57 -0000
@@ -22,6 +22,8 @@
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * 
@@ -88,6 +90,15 @@
 		
 		if (element.hasAttribute("parent"))
 			parent = target.getParent().getConfiguration(element.getAttribute("parent"));
+		
+		NodeList configElements = element.getChildNodes();
+		for (int i = 0; i < configElements.getLength(); ++i) {
+			Node configElement = configElements.item(i);
+			if (configElement.getNodeName().equals("toolRef")) {
+				new ToolReference(this, (Element)configElement);
+			}
+		}
+	
 	}
 	
 	public void serealize(Document doc, Element element) {
@@ -103,6 +114,7 @@
 			for (int i = 0; i < toolReferences.size(); ++i) {
 				ToolReference toolRef = (ToolReference)toolReferences.get(i);
 				Element toolRefElement = doc.createElement("toolRef");
+				element.appendChild(toolRefElement);
 				toolRef.serealize(doc, toolRefElement);
 			}
 	}
Index: build/org/eclipse/cdt/internal/core/build/managed/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java,v
retrieving revision 1.3
diff -u -r1.3 Option.java
--- build/org/eclipse/cdt/internal/core/build/managed/Option.java	14 Apr 2003 20:02:38 -0000	1.3
+++ build/org/eclipse/cdt/internal/core/build/managed/Option.java	25 Apr 2003 14:27:57 -0000
@@ -10,6 +10,7 @@
  **********************************************************************/
 package org.eclipse.cdt.internal.core.build.managed;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.cdt.core.build.managed.BuildException;
@@ -53,6 +54,28 @@
 		String categoryId = element.getAttribute("category");
 		if (categoryId != null)
 			setCategory(tool.getOptionCategory(categoryId));
+		
+		// valueType
+		String valueTypeStr = element.getAttribute("valueType");
+		if (valueTypeStr == null || valueTypeStr.equals("string"))
+			valueType = IOption.STRING;
+		else if (valueTypeStr.equals("stringList"))
+			valueType = IOption.STRING_LIST;
+		
+		// value
+		switch (valueType) {
+			case IOption.STRING:
+				value = element.getAttribute("value");
+				break;
+			case IOption.STRING_LIST:
+				List valueList = new ArrayList();
+				value = valueList;
+				IConfigurationElement[] valueElements = element.getChildren("optionValue");
+				for (int i = 0; i < valueElements.length; ++i) {
+					valueList.add(valueElements[i].getAttribute("value"));
+				}
+				break;
+		}
 	}
 
 	/* (non-Javadoc)
Index: build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java,v
retrieving revision 1.4
diff -u -r1.4 OptionReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java	21 Apr 2003 19:37:46 -0000	1.4
+++ build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java	25 Apr 2003 14:27:57 -0000
@@ -10,6 +10,9 @@
  **********************************************************************/
 package org.eclipse.cdt.internal.core.build.managed;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.cdt.core.build.managed.BuildException;
 import org.eclipse.cdt.core.build.managed.IOption;
 import org.eclipse.cdt.core.build.managed.IOptionCategory;
@@ -17,6 +20,7 @@
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 /**
  * 
@@ -51,6 +55,20 @@
 		option = owner.getTool().getOption(element.getAttribute("id"));
 		
 		owner.addOptionReference(this);
+
+		// value
+		switch (option.getValueType()) {
+			case IOption.STRING:
+				value = element.getAttribute("value");
+				break;
+			case IOption.STRING_LIST:
+				List valueList = new ArrayList();
+				IConfigurationElement[] valueElements = element.getChildren("optionValue");
+				for (int i = 0; i < valueElements.length; ++i) {
+					valueList.add(valueElements[i].getAttribute("value"));
+				}
+				break;
+		}
 	}
 
 	/**
@@ -64,6 +82,21 @@
 		option = owner.getTool().getOption(element.getAttribute("id"));
 		
 		owner.addOptionReference(this);
+
+		// value
+		switch (option.getValueType()) {
+			case IOption.STRING:
+				value = element.getAttribute("value");
+				break;
+			case IOption.STRING_LIST:
+				List valueList = new ArrayList();
+				NodeList nodes = element.getElementsByTagName("optionValue");
+				for (int i = 0; i < nodes.getLength(); ++i) {
+					valueList.add(((Element)nodes.item(i)).getAttribute("value"));
+				}
+				break;
+		}
+
 	}
 	
 	/**
@@ -74,7 +107,20 @@
 	 */
 	public void serealize(Document doc, Element element) {
 		element.setAttribute("id", option.getId());
-		option = owner.getOption(element.getAttribute("id"));
+		
+		// value
+		switch (option.getValueType()) {
+			case IOption.STRING:
+				element.setAttribute("value", (String)value);
+				break;
+			case IOption.STRING_LIST:
+				List valueList = (List)value;
+				for (int i = 0; i < valueList.size(); ++i) {
+					Element valueElement = doc.createElement("optionValue");
+					valueElement.setAttribute("value", (String)valueList.get(i));
+					element.appendChild(valueElement);
+				}
+		}
 	}
 	
 	/* (non-Javadoc)
Index: build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java,v
retrieving revision 1.3
diff -u -r1.3 ToolReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java	17 Apr 2003 19:21:40 -0000	1.3
+++ build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java	25 Apr 2003 14:27:57 -0000
@@ -22,6 +22,8 @@
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * 
@@ -69,6 +71,20 @@
 	}
 
 	public ToolReference(Configuration owner, Element element) {
+		this.owner = owner;
+		
+		Target parentTarget = (Target)owner.getTarget();
+		parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute("id"));
+
+		owner.addToolReference(this);
+	
+		NodeList configElements = element.getChildNodes();
+		for (int i = 0; i < configElements.getLength(); ++i) {
+			Node configElement = configElements.item(i);
+			if (configElement.getNodeName().equals("optionRef")) {
+				new OptionReference(this, (Element)configElement);
+			}
+		}
 	}
 
 	public void serealize(Document doc, Element element) {
@@ -78,6 +94,7 @@
 			for (int i = 0; i < optionReferences.size(); ++i) {
 				OptionReference optionRef = (OptionReference)optionReferences.get(i);
 				Element optionRefElement = doc.createElement("optionRef");
+				element.appendChild(optionRefElement);
 				optionRef.serealize(doc, optionRefElement);
 			}
 	}
Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd,v
retrieving revision 1.3
diff -u -r1.3 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd	9 Apr 2003 20:56:20 -0000	1.3
+++ schema/ManagedBuildTools.exsd	25 Apr 2003 14:27:57 -0000
@@ -1,330 +1,343 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.cdt.core">
-<annotation>
-      <appInfo>
-         <meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
-      </appInfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <complexType>
-         <sequence>
-            <element ref="target"/>
-            <element ref="tool"/>
-            <element ref="configuration"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="tool">
-      <complexType>
-         <sequence>
-            <element ref="option"/>
-            <element ref="optionCategory"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="sources" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="outputs" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="dependencyCalculator" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute kind="java"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="option">
-      <complexType>
-         <sequence>
-            <element ref="optionEnum"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="type" use="default" value="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-            <simpleType>
-               <restriction base="string">
-                  <enumeration value="string">
-                  </enumeration>
-                  <enumeration value="enumeration">
-                  </enumeration>
-               </restriction>
-            </simpleType>
-         </attribute>
-         <attribute name="default" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="category" type="string">
-            <annotation>
-               <documentation>
-                  This is the id of the option category for this option.  The id can be the id of the tool which is also a category.
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="optionEnum">
-      <complexType>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="configuration">
-      <complexType>
-         <sequence>
-            <element ref="toolRef"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="toolRef">
-      <complexType>
-         <sequence>
-            <element ref="optionRef"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="optionRef">
-      <complexType>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="value" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="target">
-      <annotation>
-         <documentation>
-            Represents a type of resource that is the target of the build process, for example, a Linux Library.  A target contains a sequence of tool definitions and configurations.  Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it&apos;s parent and can add to or override tools in this list.
-         </documentation>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="tool"/>
-            <element ref="configuration"/>
-         </sequence>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="isAbstract" type="boolean" use="default" value="false">
-            <annotation>
-               <documentation>
-                  This is a UI property.  If set to true, users should not be able to create project configurations targeted at this target.
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="parent" type="string">
-            <annotation>
-               <documentation>
-                  The id of a target that this tool inherits from.
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="optionCategory">
-      <complexType>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="owner" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="since"/>
-      </appInfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="examples"/>
-      </appInfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="apiInfo"/>
-      </appInfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="implementation"/>
-      </appInfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="copyright"/>
-      </appInfo>
-      <documentation>
-         
-      </documentation>
-   </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.core">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.eclipse.cdt.core" id="ManagedBuildTools" name="Managed Build Tools"/>
+      </appInfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <complexType>
+         <sequence>
+            <element ref="target"/>
+            <element ref="tool"/>
+            <element ref="configuration"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="tool">
+      <complexType>
+         <sequence>
+            <element ref="option"/>
+            <element ref="optionCategory"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="sources" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="outputs" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="dependencyCalculator" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="option">
+      <complexType>
+         <sequence>
+            <element ref="optionEnum"/>
+            <element ref="optionValue"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="valueType" use="default" value="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+            <simpleType>
+               <restriction base="string">
+                  <enumeration value="string">
+                  </enumeration>
+                  <enumeration value="stringList">
+                  </enumeration>
+               </restriction>
+            </simpleType>
+         </attribute>
+         <attribute name="value" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="category" type="string">
+            <annotation>
+               <documentation>
+                  This is the id of the option category for this option.  The id can be the id of the tool which is also a category.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="optionEnum">
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="configuration">
+      <complexType>
+         <sequence>
+            <element ref="toolRef"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="toolRef">
+      <complexType>
+         <sequence>
+            <element ref="optionRef"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="optionRef">
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="value" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="target">
+      <annotation>
+         <documentation>
+            Represents a type of resource that is the target of the build process, for example, a Linux Library.  A target contains a sequence of tool definitions and configurations.  Targets are arranged in an inheritance hierarchy where a target inherits the list of tools from it&apos;s parent and can add to or override tools in this list.
+         </documentation>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="tool"/>
+            <element ref="configuration"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="isAbstract" type="boolean" use="default" value="false">
+            <annotation>
+               <documentation>
+                  This is a UI property.  If set to true, users should not be able to create project configurations targeted at this target.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="parent" type="string">
+            <annotation>
+               <documentation>
+                  The id of a target that this tool inherits from.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="optionCategory">
+      <complexType>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="owner" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="optionValue">
+      <complexType>
+         <attribute name="value" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiInfo"/>
+      </appInfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         
+      </documentation>
+   </annotation>
+
+</schema>
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/plugin.xml,v
retrieving revision 1.9
diff -u -r1.9 plugin.xml
--- plugin.xml	23 Apr 2003 16:47:21 -0000	1.9
+++ plugin.xml	25 Apr 2003 14:28:16 -0000
@@ -42,14 +42,14 @@
             </optionCategory>
             <option
                   name="Compiler Flags"
-                  type="string"
+                  valueType="string"
                   id="linux.compiler.flags">
             </option>
             <option
                   name="Optimization Flags"
-                  default="-O"
-                  type="string"
                   category="linux.compiler.optimization"
+                  value="-O"
+                  valueType="string"
                   id="linux.compiler.optimizationFlags">
             </option>
          </tool>
@@ -106,11 +106,20 @@
             </optionCategory>
             <option
                   name="Option in Top"
+                  valueType="stringList"
                   id="topOption">
+               <optionValue
+                     value="a">
+               </optionValue>
+               <optionValue
+                     value="b">
+               </optionValue>
             </option>
             <option
                   name="Option in Category"
                   category="category"
+                  value="x"
+                  valueType="string"
                   id="childOption">
             </option>
          </tool>
@@ -124,8 +133,8 @@
             <toolRef
                   id="root.tool">
                <optionRef
-                     value="x"
-                     id="topOption">
+                     value="y"
+                     id="childOption">
                </optionRef>
             </toolRef>
          </configuration>
Index: build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java,v
retrieving revision 1.6
diff -u -r1.6 AllBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	21 Apr 2003 19:37:47 -0000	1.6
+++ build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	25 Apr 2003 14:28:16 -0000
@@ -54,7 +54,7 @@
 	 * Navigates through the build info as defined in the extensions
 	 * defined in this plugin
 	 */
-	public void testExtensions() {
+	public void testExtensions() throws Exception {
 		ITarget testRoot = null;
 		ITarget testSub = null;
 		
@@ -67,7 +67,7 @@
 			if (target.getName().equals("Test Root")) {
 				testRoot = target;
 				
-				checkRootTarget(testRoot);
+				checkRootTarget(testRoot, "x");
 				
 			} else if (target.getName().equals("Test Sub")) {
 				testSub = target;
@@ -123,7 +123,19 @@
 		for (int i = 0; i < configs.length; ++i)
 			target.createConfiguration(configs[i], target.getId() + "." + i);
 		
-		checkRootTarget(target);
+		checkRootTarget(target, "x");
+		
+		// Override the "Option in Category" option value
+		configs = target.getConfigurations();
+		ITool[] tools = configs[0].getTools();
+		IOptionCategory topCategory = tools[0].getTopOptionCategory();
+		IOptionCategory[] categories = topCategory.getChildCategories();
+		IOption[] options = categories[0].getOptions(configs[0]);
+		configs[0].setOption(options[0], "z");
+		options = categories[0].getOptions(null);
+		assertEquals("x", options[0].getStringValue());
+		options = categories[0].getOptions(configs[0]);
+		assertEquals("z", options[0].getStringValue());
 		
 		// Save, close, reopen and test again
 		ManagedBuildManager.saveBuildInfo(project);
@@ -133,7 +145,7 @@
 		
 		targets = ManagedBuildManager.getTargets(project);
 		assertEquals(1, targets.length);
-		checkRootTarget(targets[0]);
+		checkRootTarget(targets[0], "z");
 	}
 	
 	IProject createProject(String name) throws CoreException {
@@ -154,7 +166,7 @@
 		return project;	
 	}
 	
-	private void checkRootTarget(ITarget target) {
+	private void checkRootTarget(ITarget target, String oicValue) throws BuildException {
 		// Tools
 		ITool[] tools = target.getTools();
 		// Root Tool
@@ -164,7 +176,11 @@
 		IOption[] options = rootTool.getOptions();
 		assertEquals(2, options.length);
 		assertEquals("Option in Top", options[0].getName());
+		String[] valueList = options[0].getStringListValue();
+		assertEquals("a", valueList[0]);
+		assertEquals("b", valueList[1]);
 		assertEquals("Option in Category", options[1].getName());
+		assertEquals("x", options[1].getStringValue());
 		// Option Categories
 		IOptionCategory topCategory = rootTool.getTopOptionCategory();
 		assertEquals("Root Tool", topCategory.getName());
@@ -187,11 +203,34 @@
 		tools = rootConfig.getTools();
 		assertEquals(1, tools.length);
 		assertEquals("Root Tool", tools[0].getName());
+		topCategory = tools[0].getTopOptionCategory();
+		options = topCategory.getOptions(configs[0]);
+		assertEquals(1, options.length);
+		assertEquals("Option in Top", options[0].getName());
+		valueList = options[0].getStringListValue();
+		assertEquals("a", valueList[0]);
+		assertEquals("b", valueList[1]);
+		categories = topCategory.getChildCategories();
+		options = categories[0].getOptions(configs[0]);
+		assertEquals("Option in Category", options[0].getName());
+		assertEquals(oicValue, options[0].getStringValue());
 		// Root Override Config
 		assertEquals("Root Override Config", configs[1].getName());
 		tools = configs[1].getTools();
+		assertEquals(1, tools.length);
 		assertTrue(tools[0] instanceof ToolReference);
-		options = tools[0].getOptions();
+		assertEquals("Root Tool", tools[0].getName());
+		topCategory = tools[0].getTopOptionCategory();
+		options = topCategory.getOptions(configs[1]);
+		assertEquals(1, options.length);
+		assertEquals("Option in Top", options[0].getName());
+		valueList = options[0].getStringListValue();
+		assertEquals("a", valueList[0]);
+		assertEquals("b", valueList[1]);
+		categories = topCategory.getChildCategories();
+		options = categories[0].getOptions(configs[1]);
+		assertEquals("Option in Category", options[0].getName());
+		assertEquals("y", options[0].getStringValue());
 	}
-	
+
 }

Back to the top