Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-05-29 10:01:04 -0400
committerDoug Schaefer2003-05-29 10:01:04 -0400
commit6fa98d379b63450495211d7ba640d92d92d75294 (patch)
treef4170c8f6d138bd49e3be62f50d10fd84fdfc14a /core/org.eclipse.cdt.core/build
parentc09a2402628672a285e4c57c96cc4cddba3f0330 (diff)
downloadorg.eclipse.cdt-6fa98d379b63450495211d7ba640d92d92d75294.tar.gz
org.eclipse.cdt-6fa98d379b63450495211d7ba640d92d92d75294.tar.xz
org.eclipse.cdt-6fa98d379b63450495211d7ba640d92d92d75294.zip
Patch for Sean Evoy:
- More data types for build model - New natures for managed build
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java27
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java17
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java5
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java59
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java71
-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.java117
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java24
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java25
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java30
10 files changed, 274 insertions, 124 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
index da26cb1afe..65d8309258 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java
@@ -12,9 +12,6 @@ package org.eclipse.cdt.core.build.managed;
import org.eclipse.core.resources.IResource;
-/**
- *
- */
public interface IConfiguration extends IBuildObject {
/**
@@ -36,19 +33,31 @@ public interface IConfiguration extends IBuildObject {
* @return
*/
public ITool[] getTools();
-
+
+ /**
+ * Sets the value of a boolean option for this configuration.
+ *
+ * @param option The option to change.
+ * @param value The value to apply to the option.
+ * @throws BuildException
+ */
+ public void setOption(IOption option, boolean value)
+ throws BuildException;
+
/**
- * Sets an option value for this configuration.
+ * Sets the value of a string option for this configuration.
*
- * @param option
- * @param value
+ * @param option The option that will be effected by change.
+ * @param value The value to apply to the option.
*/
public void setOption(IOption option, String value)
throws BuildException;
/**
- * Sets an option value for this configuration.
- * @param option
+ * Sets the value of a list option for this configuration.
+ *
+ * @param option The option to change.
+ * @param value The values to apply to the option.
*/
public void setOption(IOption option, String[] value)
throws BuildException;
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
index 1004a71123..9543517ada 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
@@ -49,13 +49,6 @@ public interface IOption extends IBuildObject {
public String getCommand();
/**
- * @return a <code>String</code> containing the default value for the
- * enumerated option.
- */
- public String getDefaultEnumName ();
-
-
- /**
* @return <code>String</code> containing the command associated with the
* enumeration name.
*/
@@ -76,6 +69,16 @@ public interface IOption extends IBuildObject {
public String [] getStringListValue() throws BuildException;
/**
+ * @return a <code>String</code> containing the selected enumeration in an
+ * enumerated option. For an option that has not been changed by the user,
+ * the receiver will answer with the default defined in the plugin manifest.
+ * If the user has modified the selection, the receiver will answer with the
+ * overridden selection.
+ */
+ public String getSelectedEnum ();
+
+
+ /**
* Returns the current value for this option if it is a String
*
* @return
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
index 2527dcfbe9..3a44a11fa4 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java
@@ -30,6 +30,11 @@ public interface ITarget extends IBuildObject {
* @return
*/
public IResource getOwner();
+
+ /**
+ * @return the <code>ITarget</code> that is the parent of the receiver.
+ */
+ public ITarget getParent();
/**
* Returns the list of platform specific tools associated with this
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
index 25605d1648..149affb08b 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
@@ -91,6 +91,16 @@ public class ManagedBuildManager {
}
/**
+ * @return
+ */
+ public static Map getExtensionTargetMap() {
+ if (extensionTargetMap == null) {
+ extensionTargetMap = new HashMap();
+ }
+ return extensionTargetMap;
+ }
+
+ /**
* Returns the targets owned by this project. If none are owned,
* an empty array is returned.
*
@@ -108,6 +118,7 @@ public class ManagedBuildManager {
}
}
+
public static ITarget getTarget(IResource resource, String id) {
if (resource != null) {
ResourceBuildInfo buildInfo = getBuildInfo(resource);
@@ -115,7 +126,7 @@ public class ManagedBuildManager {
return buildInfo.getTarget(id);
}
- ITarget target = (ITarget)extensionTargetMap.get(id);
+ ITarget target = (ITarget)getExtensionTargetMap().get(id);
if (target != null)
return target;
@@ -158,23 +169,48 @@ public class ManagedBuildManager {
/**
* Set the string value for an option for a given config.
*
- * @param config
- * @param option
- * @param value
+ * @param config The configuration the option belongs to.
+ * @param option The option to set the value for.
+ * @param value The boolean that the option should contain after the change.
+ */
+ public static void setOption(IConfiguration config, IOption option, boolean value) {
+ try {
+ config.setOption(option, value);
+ } catch (BuildException e) {
+ return;
+ }
+ }
+
+ /**
+ * Set the string value for an option for a given config.
+ *
+ * @param config The configuration the option belongs to.
+ * @param option The option to set the value for.
+ * @param value The value that the option should contain after the change.
*/
public static void setOption(IConfiguration config, IOption option, String value) {
+ try {
+ config.setOption(option, value);
+ } catch (BuildException e) {
+ return;
+ }
}
/**
* Set the string array value for an option for a given config.
*
- * @param config
- * @param option
- * @param value
+ * @param config The configuration the option belongs to.
+ * @param option The option to set the value for.
+ * @param value The values the option should contain after the change.
*/
public static void setOption(IConfiguration config, IOption option, String[] value) {
-
+ try {
+ config.setOption(option, value);
+ } catch (BuildException e) {
+ return;
+ }
}
+
/**
* Saves the build information associated with a project and all resources
* in the project to the build info file.
@@ -229,11 +265,10 @@ public class ManagedBuildManager {
public static void addExtensionTarget(Target target) {
if (extensionTargets == null) {
extensionTargets = new ArrayList();
- extensionTargetMap = new HashMap();
}
extensionTargets.add(target);
- extensionTargetMap.put(target.getId(), target);
+ getExtensionTargetMap().put(target.getId(), target);
}
private static void loadExtensions() {
@@ -279,6 +314,8 @@ public class ManagedBuildManager {
}
public static ResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+ // Make sure the extension information is loaded first
+ loadExtensions();
ResourceBuildInfo buildInfo = null;
try {
buildInfo = (ResourceBuildInfo)resource.getSessionProperty(buildInfoProperty);
@@ -304,4 +341,6 @@ public class ManagedBuildManager {
public static ResourceBuildInfo getBuildInfo(IResource resource) {
return getBuildInfo(resource, false);
}
+
+
}
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 7538a4e9e7..0a11759af6 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
@@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.build.managed;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.build.managed.BuildException;
@@ -36,6 +37,7 @@ public class Configuration extends BuildObject implements IConfiguration {
/**
* A fresh new configuration for a target.
+ *
* @param target
* @param id
*/
@@ -46,14 +48,28 @@ public class Configuration extends BuildObject implements IConfiguration {
target.addConfiguration(this);
}
+ /**
+ * Create a new configuration based on one already defined.
+ *
+ * @param target The <code>Target</code> the receiver will be added to.
+ * @param parent The <code>IConfiguration</code> to copy the settings from.
+ * @param id A unique ID for the configuration.
+ */
public Configuration(Target target, IConfiguration parent, String id) {
this.id = id;
+ this.name = parent.getName();
this.target = target;
this.parent = parent;
target.addConfiguration(this);
}
+ /**
+ * Create a new <code>Configuration</code> based on the specification in the plugin manifest.
+ *
+ * @param target The <code>Target</code> the receiver will be added to.
+ * @param element The element from the manifest that contains the default configuration settings.
+ */
public Configuration(Target target, IConfigurationElement element) {
this.target = target;
@@ -75,6 +91,12 @@ public class Configuration extends BuildObject implements IConfiguration {
}
}
+ /**
+ * Build a configuration from the project manifest file.
+ *
+ * @param target The <code>Target</code> the configuration belongs to.
+ * @param element The element from the manifest that contains the overridden configuration information.
+ */
public Configuration(Target target, Element element) {
this.target = target;
@@ -88,8 +110,17 @@ public class Configuration extends BuildObject implements IConfiguration {
if (element.hasAttribute("name"))
setName(element.getAttribute("name"));
- if (element.hasAttribute("parent"))
- parent = target.getParent().getConfiguration(element.getAttribute("parent"));
+ if (element.hasAttribute("parent")) {
+ // See if the target has a parent
+ ITarget targetParent = target.getParent();
+ // If so, then get my parent from it
+ if (targetParent != null) {
+ parent = targetParent.getConfiguration(element.getAttribute("parent"));
+ }
+ else {
+ parent = null;
+ }
+ }
NodeList configElements = element.getChildNodes();
for (int i = 0; i < configElements.getLength(); ++i) {
@@ -101,7 +132,13 @@ public class Configuration extends BuildObject implements IConfiguration {
}
- public void serealize(Document doc, Element element) {
+ /**
+ * Persist receiver to project file.
+ *
+ * @param doc
+ * @param element
+ */
+ public void serialize(Document doc, Element element) {
element.setAttribute("id", id);
if (name != null)
@@ -115,7 +152,7 @@ public class Configuration extends BuildObject implements IConfiguration {
ToolReference toolRef = (ToolReference)toolReferences.get(i);
Element toolRefElement = doc.createElement("toolRef");
element.appendChild(toolRefElement);
- toolRef.serealize(doc, toolRefElement);
+ toolRef.serialize(doc, toolRefElement);
}
}
@@ -206,17 +243,37 @@ public class Configuration extends BuildObject implements IConfiguration {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
+ */
+ public void setOption(IOption option, boolean value) throws BuildException {
+ // Is there a delta
+ if (option.getBooleanValue() != value)
+ createOptionReference(option).setValue(value);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
*/
public void setOption(IOption option, String value) throws BuildException {
- createOptionReference(option).setValue(value);
+ String oldValue;
+ // Check whether this is an enumerated option
+ if (option.getValueType() == IOption.ENUMERATED) {
+ oldValue = option.getEnumCommand(option.getSelectedEnum());
+ }
+ else {
+ oldValue = option.getStringValue();
+ }
+ if (!oldValue.equals(value))
+ createOptionReference(option).setValue(value);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
*/
public void setOption(IOption option, String[] value) throws BuildException {
- createOptionReference(option).setValue(value);
+ // Is there a delta
+ String[] oldValue = option.getStringListValue();
+ if(!Arrays.equals(value, oldValue))
+ createOptionReference(option).setValue(value);
}
-
}
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 37abd958fd..ccc5876d10 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
@@ -37,6 +37,7 @@ public class Option extends BuildObject implements IOption {
private String command;
private static final String[] emptyStrings = new String[0];
+ private static final String EMPTY_STRING = new String();
public Option(ITool tool) {
this.tool = tool;
@@ -64,7 +65,9 @@ public class Option extends BuildObject implements IOption {
// valueType
String valueTypeStr = element.getAttribute("valueType");
- if (valueTypeStr == null || valueTypeStr.equals("string"))
+ if (valueTypeStr == null)
+ valueType = -1;
+ else if (valueTypeStr.equals("string"))
valueType = IOption.STRING;
else if (valueTypeStr.equals("stringList"))
valueType = IOption.STRING_LIST;
@@ -107,6 +110,8 @@ public class Option extends BuildObject implements IOption {
}
value = valueList;
break;
+ default :
+ break;
}
}
@@ -140,17 +145,18 @@ public class Option extends BuildObject implements IOption {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
+ * @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
- public String getDefaultEnumName() {
- return defaultEnumName;
+ public String getEnumCommand(String name) {
+ String cmd = (String) enumCommands.get(name);
+ return (cmd == null ? new String() : cmd);
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
- public String getEnumCommand(String name) {
- return (String) enumCommands.get(name);
+ public String getSelectedEnum() {
+ return defaultEnumName;
}
/* (non-Javadoc)
@@ -167,7 +173,8 @@ public class Option extends BuildObject implements IOption {
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
*/
public String getStringValue() {
- return (String)value;
+ String v = (String) value;
+ return value == null ? EMPTY_STRING : v;
}
/* (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 5c8b744311..6961ac68dc 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
@@ -11,10 +11,9 @@
package org.eclipse.cdt.internal.core.build.managed;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Arrays;
import java.util.List;
-import java.util.Map;
-
+import java.util.ListIterator;
import org.eclipse.cdt.core.build.managed.BuildException;
import org.eclipse.cdt.core.build.managed.IOption;
@@ -23,6 +22,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.Node;
import org.w3c.dom.NodeList;
/**
@@ -33,9 +33,7 @@ public class OptionReference implements IOption {
private IOption option;
private ToolReference owner;
private Object value;
- private String defaultEnumName;
private String command;
- private Map enumCommands;
/**
* Created internally.
@@ -46,7 +44,7 @@ public class OptionReference implements IOption {
public OptionReference(ToolReference owner, IOption option) {
this.owner = owner;
this.option = option;
-
+ // Until the option reference is changed, all values will be extracted from original option
owner.addOptionReference(this);
}
@@ -63,7 +61,6 @@ public class OptionReference implements IOption {
owner.addOptionReference(this);
// value
- enumCommands = new HashMap();
switch (option.getValueType()) {
case IOption.BOOLEAN:
value = new Boolean(element.getAttribute("defaultValue"));
@@ -72,19 +69,7 @@ public class OptionReference implements IOption {
value = element.getAttribute("defaultValue");
break;
case IOption.ENUMERATED:
- List enumList = new ArrayList();
- IConfigurationElement[] enumElements = element.getChildren("optionEnum");
- for (int i = 0; i < enumElements.length; ++i) {
- String optName = enumElements[i].getAttribute("name");
- String optCommand = enumElements[i].getAttribute("command");
- enumList.add(optName);
- enumCommands.put(optName, optCommand);
- Boolean isDefault = new Boolean(enumElements[i].getAttribute("isDefault"));
- if (isDefault.booleanValue()) {
- defaultEnumName = optName;
- }
- }
- value = enumList;
+ value = option.getEnumCommand(option.getSelectedEnum());
break;
case IOption.STRING_LIST:
List valueList = new ArrayList();
@@ -112,14 +97,20 @@ public class OptionReference implements IOption {
// value
switch (option.getValueType()) {
case IOption.BOOLEAN:
+ value = new Boolean(element.getAttribute("value"));
+ break;
case IOption.STRING:
- value = element.getAttribute("value");
+ case IOption.ENUMERATED:
+ value = (String) 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"));
+ Node node = nodes.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ valueList.add(((Element)node).getAttribute("value"));
+ }
}
value = valueList;
break;
@@ -128,33 +119,29 @@ public class OptionReference implements IOption {
}
/**
- * Write out to project file.
+ * Persist receiver to project file.
*
* @param doc
* @param element
*/
- public void serealize(Document doc, Element element) {
+ public void serialize(Document doc, Element element) {
element.setAttribute("id", option.getId());
// value
switch (option.getValueType()) {
case IOption.BOOLEAN:
+ element.setAttribute("value", ((Boolean)value).toString());
+ break;
case IOption.STRING:
+ case IOption.ENUMERATED:
element.setAttribute("value", (String)value);
break;
case IOption.STRING_LIST:
- List stringList = (List)value;
- for (int i = 0; i < stringList.size(); ++i) {
+ ArrayList stringList = (ArrayList)value;
+ ListIterator iter = stringList.listIterator();
+ while (iter.hasNext()) {
Element valueElement = doc.createElement("optionValue");
- valueElement.setAttribute("value", (String)stringList.get(i));
- element.appendChild(valueElement);
- }
- break;
- case IOption.ENUMERATED:
- List enumList = (List)value;
- for (int i = 0; i < enumList.size(); ++i) {
- Element valueElement = doc.createElement("optionEnum");
- valueElement.setAttribute("value", (String)enumList.get(i));
+ valueElement.setAttribute("value", (String)iter.next());
element.appendChild(valueElement);
}
break;
@@ -183,25 +170,10 @@ public class OptionReference implements IOption {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
- */
- public String getDefaultEnumName() {
- if (value == null) {
- return option.getDefaultEnumName();
- } else {
- return defaultEnumName;
- }
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
public String getEnumCommand(String name) {
- if (value == null) {
- return option.getEnumCommand(name);
- } else {
- return (String)enumCommands.get(name);
- }
+ return option.getEnumCommand(name);
}
/* (non-Javadoc)
@@ -234,13 +206,28 @@ public class OptionReference implements IOption {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
+ */
+ public String getSelectedEnum() {
+ if (value == null) {
+ // Return the default defined for the enumeration in the manifest.
+ return option.getSelectedEnum();
+ } else {
+ // Value will contain the selection of the user
+ return (String) value;
+ }
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
*/
public String[] getStringListValue() throws BuildException {
if (value == null)
return option.getStringListValue();
- else if (getValueType() == IOption.STRING_LIST)
- return (String[])value;
+ else if (getValueType() == IOption.STRING_LIST) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
else
throw new BuildException("bad value type");
}
@@ -287,16 +274,34 @@ public class OptionReference implements IOption {
return option.equals(target);
}
+ /**
+ * @param value
+ */
+ public void setValue(boolean value) throws BuildException {
+ if (getValueType() == IOption.BOOLEAN)
+ this.value = new Boolean(value);
+ else
+ throw new BuildException("bad value type");
+ }
+
public void setValue(String value) throws BuildException {
- if (getValueType() == IOption.STRING)
+ if (getValueType() == IOption.STRING || getValueType() == IOption.ENUMERATED)
this.value = value;
else
throw new BuildException("bad value type");
}
+ /**
+ * Sets the value of the receiver to be an array of items.
+ *
+ * @param value An array of strings to place in the option reference.
+ * @throws BuildException
+ */
public void setValue(String [] value) throws BuildException {
- if (getValueType() == IOption.STRING_LIST)
- this.value = value;
+ if (getValueType() == IOption.STRING_LIST) {
+ // Just replace what the option reference is holding onto
+ this.value = new ArrayList(Arrays.asList(value));
+ }
else
throw new BuildException("bad value type");
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
index fbfd352afc..a1a36e5f0e 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
@@ -1,11 +1,16 @@
-/*
- * Created on Apr 13, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
package org.eclipse.cdt.internal.core.build.managed;
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+ * **********************************************************************/
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -16,12 +21,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-/**
- * @author dschaefe
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
public class ResourceBuildInfo {
private IResource owner;
@@ -41,7 +40,6 @@ public class ResourceBuildInfo {
if (child.getNodeName().equals("target")) {
new Target(this, (Element)child);
}
-
child = child.getNextSibling();
}
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
index 82c307135b..b9aec823e4 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java
@@ -51,11 +51,12 @@ public class Target extends BuildObject implements ITarget {
* @param parent
*/
public Target(IResource owner, ITarget parent) {
+ // Make the owner of the target the project resource
this(owner);
- this.parent = parent;
-
+
// Copy the parent's identity
- setId(parent.getId());
+ this.parent = parent;
+ setId(parent.getId() + ".1");
setName(parent.getName());
// Hook me up
@@ -136,13 +137,18 @@ public class Target extends BuildObject implements ITarget {
if (child.getNodeName().equals("configuration")) {
new Configuration(this, (Element)child);
}
-
child = child.getNextSibling();
}
}
+ /**
+ * Persist receiver to project file.
+ *
+ * @param doc
+ * @param element
+ */
public void serialize(Document doc, Element element) {
element.setAttribute("id", getId());
element.setAttribute("name", getName());
@@ -155,7 +161,7 @@ public class Target extends BuildObject implements ITarget {
Configuration config = (Configuration)configurations.get(i);
Element configElement = doc.createElement("configuration");
element.appendChild(configElement);
- config.serealize(doc, configElement);
+ config.serialize(doc, configElement);
}
}
@@ -198,7 +204,14 @@ public class Target extends BuildObject implements ITarget {
}
public ITool getTool(String id) {
- return (ITool)toolMap.get(id);
+ ITool result = null;
+ // See if receiver has it in list
+ result = (ITool)toolMap.get(id);
+ // If not, check if parent has it
+ if (result == null && parent != null) {
+ result = ((Target)parent).getTool(id);
+ }
+ return result;
}
public void addTool(ITool tool) {
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 ff77920d26..f1bb01997b 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
@@ -36,10 +36,10 @@ public class ToolReference implements ITool {
private Map optionRefMap;
/**
- * Created on the fly.
+ * Created a tool reference on the fly based on an existing tool.
*
- * @param owner
- * @param parent
+ * @param owner The <code>Configuration</code> the receiver will be added to.
+ * @param parent The <code>ITool</code>tool the reference will be based on.
*/
public ToolReference(Configuration owner, ITool parent) {
this.owner = owner;
@@ -49,10 +49,10 @@ public class ToolReference implements ITool {
}
/**
- * Created from extension.
+ * Created tool reference from an extension defined in a plugin manifest.
*
- * @param owner
- * @param element
+ * @param owner The <code>Configuration</code> the receiver will be added to.
+ * @param element The element containing build information for the reference.
*/
public ToolReference(Configuration owner, IConfigurationElement element) {
this.owner = owner;
@@ -70,6 +70,13 @@ public class ToolReference implements ITool {
}
}
+ /**
+ * Create a new tool reference based on information contained in a project file.
+ *
+ * @param owner The <code>Configuration</code> the receiver will be added to.
+ * @param element The element defined in the project file containing build information
+ * for the receiver.
+ */
public ToolReference(Configuration owner, Element element) {
this.owner = owner;
@@ -87,7 +94,14 @@ public class ToolReference implements ITool {
}
}
- public void serealize(Document doc, Element element) {
+ /**
+ * Persist receiver to project file.
+ *
+ * @param doc The persistent store for the reference information.
+ * @param element The root element in the store the receiver must use
+ * to persist settings.
+ */
+ public void serialize(Document doc, Element element) {
element.setAttribute("id", parent.getId());
if (optionReferences != null)
@@ -95,7 +109,7 @@ public class ToolReference implements ITool {
OptionReference optionRef = (OptionReference)optionReferences.get(i);
Element optionRefElement = doc.createElement("optionRef");
element.appendChild(optionRefElement);
- optionRef.serealize(doc, optionRefElement);
+ optionRef.serialize(doc, optionRefElement);
}
}

Back to the top