Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-04-25 10:32:51 -0400
committerDoug Schaefer2003-04-25 10:32:51 -0400
commitb8024352d18695471a7ce69cca5f26cb63e8d579 (patch)
tree40c8832851ab36a2e447b47508d0c30d75e33eee /core/org.eclipse.cdt.core/build
parenta4a97388661006e4970ce2f2fa14614a8143d635 (diff)
downloadorg.eclipse.cdt-b8024352d18695471a7ce69cca5f26cb63e8d579.tar.gz
org.eclipse.cdt-b8024352d18695471a7ce69cca5f26cb63e8d579.tar.xz
org.eclipse.cdt-b8024352d18695471a7ce69cca5f26cb63e8d579.zip
New Build Model
- Save and load options values
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java12
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java23
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java48
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java17
4 files changed, 99 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
index 6ed0d47ee6..7538a4e9e7 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
@@ -22,6 +22,8 @@ import org.eclipse.core.resources.IResource;
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 @@ public class Configuration extends BuildObject implements IConfiguration {
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 @@ public class Configuration extends BuildObject implements IConfiguration {
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);
}
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
index e444c50552..ecb36ff2cc 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
@@ -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 @@ public class Option extends BuildObject implements IOption {
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)
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
index cfbb3f8c9e..d02eb34e68 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
@@ -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.cdt.core.build.managed.ITool;
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 @@ public class OptionReference implements IOption {
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 @@ public class OptionReference implements IOption {
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 class OptionReference implements IOption {
*/
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)
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
index ff1efc8761..ff77920d26 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
@@ -22,6 +22,8 @@ import org.eclipse.cdt.core.build.managed.ITool;
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 class ToolReference implements ITool {
}
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 @@ public class ToolReference implements ITool {
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);
}
}

Back to the top