Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/build')
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java25
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IConfiguration.java18
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java9
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java28
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java34
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java21
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java50
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/BuildObject.java50
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java10
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java83
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java72
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java46
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java96
13 files changed, 428 insertions, 114 deletions
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java
new file mode 100644
index 00000000000..335c2239c7e
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IBuildObject.java
@@ -0,0 +1,25 @@
+/*
+ * Created on Apr 9, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.cdt.core.build.managed;
+
+/**
+ * @author dschaefe
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface IBuildObject {
+
+ public String getId();
+
+ public void setId(String id);
+
+ public String getName();
+
+ public void setName(String name);
+
+}
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 9fef24e56bf..5f03a2d9808 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
@@ -15,16 +15,10 @@ import org.eclipse.core.resources.IResource;
/**
*
*/
-public interface IConfiguration {
+public interface IConfiguration extends IBuildObject {
/**
- * Returns the name of this configuration
- * @return
- */
- public String getName();
-
- /**
- * Returns the platform for this configuration.
+ * Returns the target for this configuration.
*
* @return
*/
@@ -37,14 +31,6 @@ public interface IConfiguration {
public IResource getOwner();
/**
- * Returns the configuration from which this configuration inherits
- * properties.
- *
- * @return
- */
- public IConfiguration getParent();
-
- /**
* Returns the tools that are used in this configuration.
*
* @return
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 c9496aab0bc..6ce56a5adde 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
@@ -13,7 +13,7 @@ package org.eclipse.cdt.core.build.managed;
/**
*
*/
-public interface IOption {
+public interface IOption extends IBuildObject {
// Type for the value of the option
public static final int STRING = 0;
@@ -34,6 +34,13 @@ public interface IOption {
public IOptionCategory getCategory();
/**
+ * Set the option category for this option.
+ *
+ * @param category
+ */
+ public void setCategory(IOptionCategory category);
+
+ /**
* Returns the name of this option.
*
* @return
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java
index 8d66327e806..780286266e2 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOptionCategory.java
@@ -13,30 +13,42 @@ package org.eclipse.cdt.core.build.managed;
/**
*
*/
-public interface IOptionCategory {
+public interface IOptionCategory extends IBuildObject {
/**
- * Returns the name of the option category.
+ * Returns the list of children of this node in the option category tree
*
* @return
*/
- public String getName();
-
+ public IOptionCategory[] getChildCategories();
+
/**
- * Returns the options that have been assigned to this category.
+ * Returns a new child category for this category.
*
* @return
*/
- public IOption[] getOptions();
+ public IOptionCategory createChildCategory();
/**
- * Returns the list of children of this node in the option category tree
+ * Returns the options in this category for a given tool.
*
+ * @param tool
* @return
*/
- public IOptionCategory[] getChildCategories();
+ public IOption[] getOptions(ITool tool);
+ /**
+ * Returns the category that owns this category, or null if this is the
+ * top category for a tool.
+ *
+ * @return
+ */
public IOptionCategory getOwner();
+ /**
+ * Returns the tool that ultimately owns this category.
+ *
+ * @return
+ */
public ITool getTool();
}
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 eb4f682ac52..f8d1125d252 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
@@ -16,23 +16,9 @@ import org.eclipse.core.resources.IResource;
* This class represents targets for the managed build process. A target
* is some type of resource built using a given collection of tools.
*/
-public interface ITarget {
+public interface ITarget extends IBuildObject {
/**
- * Gets the name for the target.
- *
- * @return
- */
- public String getName();
-
- /**
- * Gets the parent for the target.
- *
- * @return
- */
- public ITarget getParent();
-
- /**
* Gets the resource that this target is applied to.
*
* @return
@@ -48,27 +34,33 @@ public interface ITarget {
public ITool[] getTools();
/**
+ * Creates a new tool.
+ *
+ * @return
+ */
+ public ITool createTool();
+
+ /**
* Returns all of the configurations defined by this target.
* @return
*/
public IConfiguration[] getConfigurations();
/**
- * Creates a new configuration for the given resource.
+ * Creates a new configuration for this target.
*
- * @param resource
* @return
*/
- public IConfiguration addConfiguration(IResource resource)
+ public IConfiguration createConfiguration()
throws BuildException;
/**
- * Creates a new configuration for the given resource based on the parent config
- * @param resource
+ * Creates a new configuration based on the parent config for this target.
+ *
* @param parentConfig
* @return
*/
- public IConfiguration addConfiguration(IResource resource, IConfiguration parentConfig)
+ public IConfiguration createConfiguration(IConfiguration parentConfig)
throws BuildException;
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
index 881048f9f16..cd336f98d91 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
@@ -13,31 +13,26 @@ package org.eclipse.cdt.core.build.managed;
/**
*
*/
-public interface ITool {
+public interface ITool extends IBuildObject {
/**
- * Returns the name of the tool.
- *
- * @return
- */
- public String getName();
-
- /**
* Return the target that defines this tool, if applicable
* @return
*/
public ITarget getTarget();
/**
- * Returns the tool that this tool inherits properties from.
- * @return
+ * Returns the options that may be customized for this tool.
*/
- public ITool getParent();
+ public IOption[] getOptions();
/**
- * Returns the options that may be customized for this tool.
+ * Creates a new option for this tool. Generally, this should only be
+ * done by the extension and project data loaders.
+ *
+ * @return
*/
- public IOption[] getOptions();
+ public IOption createOption();
/**
* Options are organized into categories for UI purposes.
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 ec0c2fae021..92689e7281a 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
@@ -11,7 +11,9 @@
package org.eclipse.cdt.core.build.managed;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.build.managed.Configuration;
@@ -138,6 +140,15 @@ public class ManagedBuildManager {
return newTarget;
}
+ /**
+ * Saves the build information associated with a project and all resources
+ * in the project to the build info file.
+ *
+ * @param project
+ */
+ public static void saveBuildInfo(IProject project) {
+ }
+
// Private stuff
private static List extensionTargets;
@@ -147,6 +158,7 @@ public class ManagedBuildManager {
return;
extensionTargets = new ArrayList();
+ Map targetMap = new HashMap();
IExtensionPoint extensionPoint
= CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ManagedBuildInfo");
@@ -157,17 +169,49 @@ public class ManagedBuildManager {
for (int j = 0; j < elements.length; ++j) {
IConfigurationElement element = elements[j];
if (element.getName().equals("target")) {
- Target target = new Target(null);
+ String parentId = element.getAttribute("parent");
+ Target target = null;
+ if (parentId != null)
+ target = new Target(null, (Target)targetMap.get(parentId));
+ else
+ target = new Target(null);
target.setName(element.getAttribute("name"));
extensionTargets.add(target);
+ targetMap.put(element.getAttribute("id"), target);
IConfigurationElement[] targetElements = element.getChildren();
for (int k = 0; k < targetElements.length; ++k) {
IConfigurationElement targetElement = targetElements[k];
if (targetElement.getName().equals("tool")) {
- Tool tool = new Tool(targetElement.getAttribute("name"), target);
+ ITool tool = target.createTool();
+ tool.setName(targetElement.getAttribute("name"));
+
+ Map categoryMap = new HashMap();
+ categoryMap.put(targetElement.getAttribute("id"), tool.getTopOptionCategory());
+ IConfigurationElement[] toolElements = targetElement.getChildren();
+ for (int l = 0; l < toolElements.length; ++l) {
+ IConfigurationElement toolElement = toolElements[l];
+ if (toolElement.getName().equals("option")) {
+ IOption option = tool.createOption();
+ option.setName(toolElement.getAttribute("name"));
+
+ String categoryId = toolElement.getAttribute("category");
+ if (categoryId != null)
+ option.setCategory((IOptionCategory)categoryMap.get(categoryId));
+ } else if (toolElement.getName().equals("optionCategory")) {
+ IOptionCategory owner = (IOptionCategory)categoryMap.get(toolElement.getAttribute("owner"));
+ IOptionCategory category = owner.createChildCategory();
+ category.setName(toolElement.getAttribute("name"));
+ categoryMap.put(toolElement.getAttribute("id"), category);
+ }
+ }
} else if (targetElement.getName().equals("configuration")) {
- target.addConfiguration(new Configuration(target));
+ try {
+ IConfiguration config = target.createConfiguration();
+ config.setName(targetElement.getAttribute("name"));
+ } catch (BuildException e) {
+ // Not sure what to do here.
+ }
}
}
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/BuildObject.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/BuildObject.java
new file mode 100644
index 00000000000..97c8f9a0c9f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/BuildObject.java
@@ -0,0 +1,50 @@
+/*
+ * Created on Apr 9, 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;
+
+import org.eclipse.cdt.core.build.managed.IBuildObject;
+
+/**
+ * @author dschaefe
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BuildObject implements IBuildObject {
+
+ protected String id;
+ protected String name;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildObject#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildObject#setName(java.lang.String)
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
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 5835b12b698..fb30338428f 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
@@ -20,9 +20,8 @@ import org.eclipse.core.resources.IResource;
/**
*
*/
-public class Configuration implements IConfiguration {
+public class Configuration extends BuildObject implements IConfiguration {
- private String name;
private ITarget target;
private IConfiguration parent;
private List toolReference;
@@ -43,13 +42,6 @@ public class Configuration implements IConfiguration {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.IConfiguration#setName(java.lang.String)
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
public ITool[] getTools() {
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 d8f8234f355..44e0cb3d423 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,9 +10,90 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.build.managed;
+import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IOption;
+import org.eclipse.cdt.core.build.managed.IOptionCategory;
+import org.eclipse.cdt.core.build.managed.ITool;
+
/**
*
*/
-public class Option {
+public class Option extends BuildObject implements IOption {
+
+ private ITool tool;
+ private IOptionCategory category;
+
+ public Option(ITool tool) {
+ this.tool = tool;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
+ */
+ public String[] getApplicableValues() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
+ */
+ public IOptionCategory getCategory() {
+ return (category != null) ? category : getTool().getTopOptionCategory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
+ */
+ public String[] getStringListValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
+ */
+ public String getStringValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getTool()
+ */
+ public ITool getTool() {
+ return tool;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
+ */
+ public int getValueType() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String)
+ */
+ public IOption setStringValue(IConfiguration config, String value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setStringValue(org.eclipse.cdt.core.build.managed.IConfiguration, java.lang.String[])
+ */
+ public IOption setStringValue(IConfiguration config, String[] value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
+ */
+ public void setCategory(IOptionCategory category) {
+ this.category = category;
+ }
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java
index 5909e1acc10..fe6f5125a5b 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionCategory.java
@@ -10,9 +10,79 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.build.managed;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.core.build.managed.IOption;
+import org.eclipse.cdt.core.build.managed.IOptionCategory;
+import org.eclipse.cdt.core.build.managed.ITool;
+
/**
*
*/
-public class OptionCategory {
+public class OptionCategory extends BuildObject implements IOptionCategory {
+
+ private IOptionCategory owner;
+ private List children;
+
+ private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
+
+ public OptionCategory(IOptionCategory owner) {
+ this.owner = owner;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
+ */
+ public IOptionCategory[] getChildCategories() {
+ if (children != null)
+ return (IOptionCategory[])children.toArray(new IOptionCategory[children.size()]);
+ else
+ return emtpyCategories;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#createChildCategory()
+ */
+ public IOptionCategory createChildCategory() {
+ IOptionCategory category = new OptionCategory(this);
+
+ if (children == null)
+ children = new ArrayList();
+ children.add(category);
+
+ return category;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
+ */
+ public IOptionCategory getOwner() {
+ return owner;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
+ */
+ public ITool getTool() {
+ // This will stop at the Tool's top category
+ return owner.getTool();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ */
+ public IOption[] getOptions(ITool tool) {
+ List myOptions = new ArrayList();
+ IOption[] allOptions = tool.getOptions();
+
+ for (int i = 0; i < allOptions.length; ++i) {
+ IOption option = allOptions[i];
+ if (option.getCategory().equals(this))
+ myOptions.add(option);
+ }
+
+ return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
+ }
}
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 300fade816d..1163de980ca 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
@@ -17,21 +17,21 @@ import org.eclipse.cdt.core.build.managed.BuildException;
import org.eclipse.cdt.core.build.managed.IConfiguration;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
-import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
/**
*
*/
-public class Target implements ITarget {
+public class Target extends BuildObject implements ITarget {
- private String name;
private ITarget parent;
private IResource owner;
private List tools;
private List configurations;
+ private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+
public Target(IResource owner) {
this.owner = owner;
}
@@ -61,10 +61,6 @@ public class Target implements ITarget {
return parent;
}
- public void setName(String name) {
- this.name = name;
- }
-
public IResource getOwner() {
return owner;
}
@@ -95,53 +91,55 @@ public class Target implements ITarget {
return toolArray;
}
- public void addTool(ITool tool){
+ public ITool createTool() {
+ ITool tool = new Tool(this);
+
if (tools == null)
tools = new ArrayList();
tools.add(tool);
+
+ return tool;
}
public IConfiguration[] getConfigurations() {
- return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]);
+ if (configurations != null)
+ return (IConfiguration[])configurations.toArray(new IConfiguration[configurations.size()]);
+ else
+ return emptyConfigs;
}
- public void addConfiguration(IConfiguration configuration) {
+ private void addLocalConfiguration(IConfiguration configuration) {
if (configurations == null)
configurations = new ArrayList();
configurations.add(configuration);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITarget#addConfiguration(org.eclipse.core.resources.IResource)
- */
- public IConfiguration addConfiguration(IResource resource)
+ public IConfiguration createConfiguration()
throws BuildException
{
- Target target = (Target)ManagedBuildManager.addTarget(resource, this);
- IConfiguration config = new Configuration(target);
- target.addConfiguration(config);
- return null;
+ IConfiguration config = new Configuration(this);
+ addLocalConfiguration(config);
+ return config;
}
- public IConfiguration addConfiguration(IResource resource, IConfiguration parentConfig)
+ public IConfiguration createConfiguration(IConfiguration parentConfig)
throws BuildException
{
IResource parentOwner = parentConfig.getOwner();
- if (resource instanceof IProject) {
+ if (owner instanceof IProject) {
// parent must be owned by the same project
- if (!resource.equals(parentOwner))
+ if (!owner.equals(parentOwner))
throw new BuildException("addConfiguration: parent must be in same project");
} else {
// parent must be owned by the project
- if (!resource.getProject().equals(parentOwner))
+ if (!owner.getProject().equals(parentOwner))
throw new BuildException("addConfiguration: parent must be in owning project");
}
// Validation passed
- Target target = (Target)ManagedBuildManager.addTarget(resource, this);
IConfiguration config = new Configuration(parentConfig);
- target.addConfiguration(config);
+ addLocalConfiguration(config);
return config;
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
index 4462a9b2925..7be57edd7cf 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
@@ -10,50 +10,112 @@
**********************************************************************/
package org.eclipse.cdt.internal.core.build.managed;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IOptionCategory;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
/**
- *
+ * Represents a tool that can be invoked during a build.
+ * Note that this class implements IOptionCategory to represent the top
+ * category.
*/
-public class Tool implements ITool {
+public class Tool extends BuildObject implements ITool, IOptionCategory {
- private String name;
private ITarget target;
+ private List options;
+ private IOptionCategory topOptionCategory;
+ private List childOptionCategories;
- public Tool(String name) {
- this.name = name;
- }
+ private static IOption[] emptyOptions = new IOption[0];
+ private static IOptionCategory[] emptyCategories = new IOptionCategory[0];
- public Tool(String name, Target target) {
- this(name);
+ public Tool(Target target) {
this.target = target;
}
- public String getName() {
- return name;
- }
-
public ITarget getTarget() {
return target;
}
public IOption[] getOptions() {
- return null;
+ if (options != null)
+ return (IOption[])options.toArray(new IOption[options.size()]);
+ else
+ return emptyOptions;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#createOption()
+ */
+ public IOption createOption() {
+ IOption option = new Option(this);
+
+ if (options == null)
+ options = new ArrayList();
+ options.add(option);
+
+ return option;
}
public IOptionCategory getTopOptionCategory() {
- return null;
+ return this;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITool#getParent()
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
*/
- public ITool getParent() {
- // TODO Auto-generated method stub
+ public IOptionCategory[] getChildCategories() {
+ if (childOptionCategories != null)
+ return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
+ else
+ return emptyCategories;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#createChildCategory()
+ */
+ public IOptionCategory createChildCategory() {
+ IOptionCategory category = new OptionCategory(this);
+
+ if (childOptionCategories == null)
+ childOptionCategories = new ArrayList();
+ childOptionCategories.add(category);
+
+ return category;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
+ */
+ public IOptionCategory getOwner() {
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
+ */
+ public ITool getTool() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
+ */
+ public IOption[] getOptions(ITool tool) {
+ List myOptions = new ArrayList();
+ IOption[] allOptions = tool.getOptions();
+
+ for (int i = 0; i < allOptions.length; ++i) {
+ IOption option = allOptions[i];
+ if (option.getCategory() == null || option.getCategory().equals(this))
+ myOptions.add(option);
+ }
+
+ return (IOption[])myOptions.toArray(new IOption[myOptions.size()]);
+ }
+
}

Back to the top