mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
Work for C14, add the ability to inherit a tool description via a tool
reference. Changed the schema to allow a tool reference to belong to a target. * schema/ManagedBuildTools.exsd Changed the manifest logic in the managed build manager to load and retrieve tool definitions as well as target definitions. The schema allowed for this, but the logic was missing. * src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java Made some bookeeping additions to the target so that it can store references to tools. First, the target loads any tool references it has. Then it loads tools and configurations. The target also has to consider the presence of tool references when it determines how many tools it has, so the logic that counted and returned the number of tools in the target was updated. Some key changes in this regard relate to how the target looks up the tool references it has. It now has to ask the managed build info if it has a tool definition for the reference if there are no tools defined for the target level for a given reference. * src/org/eclipse/cdt/managedbuilder/internal/core/Target.java Tool references now have the potential to be owned by either a target or a configuration. Changed the owner to the superclass of both and figure out which the parent is at runtime to perform the proper registration and information look-up. Also removed the reference to a target from a tool and the interface to extract the target from ITool. * src/org/eclipse/cdt/managedbuilder/core/ITool.java * src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java * src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java An unrelated bug had to do with a problem my testing uncovered with nested categories. The manifest reader was looking at the wrong field to determine the parent, but for the manifests we have created, this has not proven to be a problem so far. * src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java * src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
This commit is contained in:
parent
b9e2f84b0c
commit
72991c1d3e
11 changed files with 609 additions and 348 deletions
|
@ -1,3 +1,41 @@
|
||||||
|
2004-02-26
|
||||||
|
Work for C14, add the ability to inherit a tool description via a tool
|
||||||
|
reference.
|
||||||
|
|
||||||
|
Changed the schema to allow a tool reference to belong to a target.
|
||||||
|
* schema/ManagedBuildTools.exsd
|
||||||
|
|
||||||
|
Changed the manifest logic in the managed build manager to load and
|
||||||
|
retrieve tool definitions as well as target definitions. The schema
|
||||||
|
allowed for this, but the logic was missing.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
|
||||||
|
|
||||||
|
Made some bookeeping additions to the target so that it can store references
|
||||||
|
to tools. First, the target loads any tool references it has. Then it loads
|
||||||
|
tools and configurations. The target also has to consider the presence of tool
|
||||||
|
references when it determines how many tools it has, so the logic that counted
|
||||||
|
and returned the number of tools in the target was updated. Some key changes in
|
||||||
|
this regard relate to how the target looks up the tool references it has. It
|
||||||
|
now has to ask the managed build info if it has a tool definition for the reference
|
||||||
|
if there are no tools defined for the target level for a given reference.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
|
||||||
|
|
||||||
|
Tool references now have the potential to be owned by either a target or a
|
||||||
|
configuration. Changed the owner to the superclass of both and figure out
|
||||||
|
which the parent is at runtime to perform the proper registration and information
|
||||||
|
look-up. Also removed the reference to a target from a tool and the interface to
|
||||||
|
extract the target from ITool.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/ITool.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
|
||||||
|
|
||||||
|
An unrelated bug had to do with a problem my testing uncovered with nested
|
||||||
|
categories. The manifest reader was looking at the wrong field to determine
|
||||||
|
the parent, but for the manifests we have created, this has not proven to be
|
||||||
|
a problem so far.
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
|
||||||
|
* src/org/eclipse/cdt/managedbuilder/core/IOptionCategory.java
|
||||||
|
|
||||||
2004-02-24 Sean Evoy
|
2004-02-24 Sean Evoy
|
||||||
Changed the makefile generator to escape any whitespace it finds in a dependency
|
Changed the makefile generator to escape any whitespace it finds in a dependency
|
||||||
path. Now it is possible to build a project in a location with spaces but
|
path. Now it is possible to build a project in a location with spaces but
|
||||||
|
|
|
@ -298,6 +298,13 @@ Additional special types exist to flag options of special relevance to the build
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="command" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
@ -342,6 +349,7 @@ Additional special types exist to flag options of special relevance to the build
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="tool"/>
|
<element ref="tool"/>
|
||||||
<element ref="configuration"/>
|
<element ref="configuration"/>
|
||||||
|
<element ref="toolReference"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -437,7 +445,7 @@ Additional special types exist to flag options of special relevance to the build
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="id" type="string">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Used by the build model to uniquely identify the option category.
|
Used by the build model to uniquely identify the option category.
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.eclipse.core.resources.IResource;
|
||||||
public interface IConfiguration extends IBuildObject {
|
public interface IConfiguration extends IBuildObject {
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
||||||
public static final String TOOL_REF = "toolReference"; //$NON-NLS-1$
|
public static final String TOOLREF_ELEMENT_NAME = "toolReference"; //$NON-NLS-1$
|
||||||
public static final String PARENT = "parent"; //$NON-NLS-1$
|
public static final String PARENT = "parent"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ package org.eclipse.cdt.managedbuilder.core;
|
||||||
public interface IOptionCategory extends IBuildObject {
|
public interface IOptionCategory extends IBuildObject {
|
||||||
|
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String PARENT = "parent";
|
public static final String OWNER = "owner";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of children of this node in the option category tree
|
* Returns the list of children of this node in the option category tree
|
||||||
|
|
|
@ -104,7 +104,7 @@ public interface ITool extends IBuildObject {
|
||||||
* Return the target that defines this tool, if applicable
|
* Return the target that defines this tool, if applicable
|
||||||
* @return ITarget
|
* @return ITarget
|
||||||
*/
|
*/
|
||||||
public ITarget getTarget();
|
// public ITarget getTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers the command-line invocation defined for the receiver.
|
* Answers the command-line invocation defined for the receiver.
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Target;
|
import org.eclipse.cdt.managedbuilder.internal.core.Target;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -42,6 +43,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -60,10 +62,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + "." + "ManagedBuildManager"; //$NON-NLS-1$
|
public static final String INTERFACE_IDENTITY = ManagedBuilderCorePlugin.getUniqueIdentifier() + "." + "ManagedBuildManager"; //$NON-NLS-1$
|
||||||
public static final String EXTENSION_POINT_ID = "ManagedBuildInfo"; //$NON-NLS-1$
|
public static final String EXTENSION_POINT_ID = "ManagedBuildInfo"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Targets defined by extensions (i.e., not associated with a resource)
|
// This is the version of the manifest and project files that
|
||||||
|
private static final String buildInfoVersion = "2.0.0";
|
||||||
private static boolean extensionTargetsLoaded = false;
|
private static boolean extensionTargetsLoaded = false;
|
||||||
private static List extensionTargets;
|
|
||||||
private static Map extensionTargetMap;
|
private static Map extensionTargetMap;
|
||||||
|
private static List extensionTargets;
|
||||||
|
private static Map extensionToolMap;
|
||||||
|
|
||||||
// Listeners interested in build model changes
|
// Listeners interested in build model changes
|
||||||
private static Map buildModelListeners;
|
private static Map buildModelListeners;
|
||||||
|
@ -102,6 +106,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
* Safe accessor for the map of IDs to Targets
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected static Map getExtensionTargetMap() {
|
protected static Map getExtensionTargetMap() {
|
||||||
|
@ -111,6 +117,18 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return extensionTargetMap;
|
return extensionTargetMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Safe accessor for the map of IDs to Tools
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected static Map getExtensionToolMap() {
|
||||||
|
if (extensionToolMap == null) {
|
||||||
|
extensionToolMap = new HashMap();
|
||||||
|
}
|
||||||
|
return extensionToolMap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the targets owned by this project. If none are owned,
|
* Returns the targets owned by this project. If none are owned,
|
||||||
* an empty array is returned.
|
* an empty array is returned.
|
||||||
|
@ -129,6 +147,15 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answers the tool with the ID specified in the argument or <code>null</code>.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static ITool getTool(String id) {
|
||||||
|
return (ITool) getExtensionToolMap().get(id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers the result of a best-effort search to find a target with the
|
* Answers the result of a best-effort search to find a target with the
|
||||||
|
@ -153,39 +180,6 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new target for the resource based on the parentTarget.
|
|
||||||
*
|
|
||||||
* @param resource
|
|
||||||
* @param parentTarget
|
|
||||||
* @return new <code>ITarget</code> with settings based on the parent passed in the arguments
|
|
||||||
* @throws BuildException
|
|
||||||
*/
|
|
||||||
public static ITarget createTarget(IResource resource, ITarget parentTarget)
|
|
||||||
throws BuildException
|
|
||||||
{
|
|
||||||
IResource owner = parentTarget.getOwner();
|
|
||||||
|
|
||||||
if (owner != null && owner.equals(resource))
|
|
||||||
// Already added
|
|
||||||
return parentTarget;
|
|
||||||
|
|
||||||
if (resource instanceof IProject) {
|
|
||||||
// Must be an extension target (why?)
|
|
||||||
if (owner != null)
|
|
||||||
throw new BuildException("addTarget: owner not null");
|
|
||||||
} else {
|
|
||||||
// Owner must be owned by the project containing this resource
|
|
||||||
if (owner == null)
|
|
||||||
throw new BuildException("addTarget: null owner");
|
|
||||||
if (!owner.equals(resource.getProject()))
|
|
||||||
throw new BuildException("addTarget: owner not project");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Passed validation
|
|
||||||
return new Target(resource, parentTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default configuration for the project. Note that this will also
|
* Sets the default configuration for the project. Note that this will also
|
||||||
* update the default target if needed.
|
* update the default target if needed.
|
||||||
|
@ -384,7 +378,50 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
getExtensionTargetMap().put(target.getId(), target);
|
getExtensionTargetMap().put(target.getId(), target);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private stuff
|
/**
|
||||||
|
* @param tool
|
||||||
|
*/
|
||||||
|
public static void addExtensionTool(Tool tool) {
|
||||||
|
getExtensionToolMap().put(tool.getId(), tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new target for the resource based on the parentTarget.
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
* @param parentTarget
|
||||||
|
* @return new <code>ITarget</code> with settings based on the parent passed in the arguments
|
||||||
|
* @throws BuildException
|
||||||
|
*/
|
||||||
|
public static ITarget createTarget(IResource resource, ITarget parentTarget)
|
||||||
|
throws BuildException
|
||||||
|
{
|
||||||
|
IResource owner = parentTarget.getOwner();
|
||||||
|
|
||||||
|
if (owner != null && owner.equals(resource))
|
||||||
|
// Already added
|
||||||
|
return parentTarget;
|
||||||
|
|
||||||
|
if (resource instanceof IProject) {
|
||||||
|
// Must be an extension target (why?)
|
||||||
|
if (owner != null)
|
||||||
|
throw new BuildException("addTarget: owner not null");
|
||||||
|
} else {
|
||||||
|
// Owner must be owned by the project containing this resource
|
||||||
|
if (owner == null)
|
||||||
|
throw new BuildException("addTarget: null owner");
|
||||||
|
if (!owner.equals(resource.getProject()))
|
||||||
|
throw new BuildException("addTarget: owner not project");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Passed validation
|
||||||
|
return new Target(resource, parentTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Load the build information for the specified resource from its project
|
||||||
|
* file. Pay attention to the version number too.
|
||||||
|
*/
|
||||||
private static ManagedBuildInfo loadBuildInfo(IProject project) {
|
private static ManagedBuildInfo loadBuildInfo(IProject project) {
|
||||||
ManagedBuildInfo buildInfo = null;
|
ManagedBuildInfo buildInfo = null;
|
||||||
IFile file = project.getFile(FILE_NAME);
|
IFile file = project.getFile(FILE_NAME);
|
||||||
|
@ -408,26 +445,44 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* Since the class does not have a constructor, but all public methods
|
* Since the class does not have a constructor but all public methods
|
||||||
* call this method first, it is effectively a startup method
|
* call this method first, it is effectively a startup method
|
||||||
*/
|
*/
|
||||||
private static void loadExtensions() {
|
private static void loadExtensions() {
|
||||||
if (extensionTargetsLoaded)
|
if (extensionTargetsLoaded)
|
||||||
return;
|
return;
|
||||||
extensionTargetsLoaded = true;
|
|
||||||
|
|
||||||
IExtensionPoint extensionPoint = ManagedBuilderCorePlugin.getDefault().getDescriptor().getExtensionPoint(EXTENSION_POINT_ID);
|
// Get those extensions
|
||||||
|
IPluginDescriptor descriptor = ManagedBuilderCorePlugin.getDefault().getDescriptor();
|
||||||
|
// Get the version of the manifest
|
||||||
|
/* PluginVersionIdentifier version = descriptor.getVersionIdentifier();
|
||||||
|
if (version.isGreaterThan(new PluginVersionIdentifier(buildInfoVersion))) {
|
||||||
|
//TODO: The version of the Plug-in is greater than what the manager thinks it understands
|
||||||
|
}
|
||||||
|
*/ // We can read the manifest
|
||||||
|
IExtensionPoint extensionPoint = descriptor.getExtensionPoint(EXTENSION_POINT_ID);
|
||||||
IExtension[] extensions = extensionPoint.getExtensions();
|
IExtension[] extensions = extensionPoint.getExtensions();
|
||||||
for (int i = 0; i < extensions.length; ++i) {
|
for (int i = 0; i < extensions.length; ++i) {
|
||||||
IExtension extension = extensions[i];
|
IExtension extension = extensions[i];
|
||||||
IConfigurationElement[] elements = extension.getConfigurationElements();
|
IConfigurationElement[] elements = extension.getConfigurationElements();
|
||||||
for (int j = 0; j < elements.length; ++j) {
|
// Load the tools first
|
||||||
IConfigurationElement element = elements[j];
|
for (int toolIndex = 0; toolIndex < elements.length; ++toolIndex) {
|
||||||
|
IConfigurationElement element = elements[toolIndex];
|
||||||
|
// Load the targets
|
||||||
|
if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
||||||
|
new Tool(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int targetIndex = 0; targetIndex < elements.length; ++targetIndex) {
|
||||||
|
IConfigurationElement element = elements[targetIndex];
|
||||||
|
// Load the targets
|
||||||
if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
|
if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
|
||||||
new Target(element);
|
new Target(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Let's never do that again
|
||||||
|
extensionTargetsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -518,6 +573,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return (IManagedBuildInfo) findBuildInfo(resource, false);
|
return (IManagedBuildInfo) findBuildInfo(resource, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getBuildInfoVersion() {
|
||||||
|
return buildInfoVersion;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -582,4 +641,5 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
map.put(project, list);
|
map.put(project, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,16 +41,44 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
private List toolReferences;
|
private List toolReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fresh new configuration for a target.
|
* Build a configuration from the project manifest file.
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target The <code>Target</code> the configuration belongs to.
|
||||||
* @param id
|
* @param element The element from the manifest that contains the overridden configuration information.
|
||||||
*/
|
*/
|
||||||
public Configuration(Target target, String id) {
|
public Configuration(Target target, Element element) {
|
||||||
this.id = id;
|
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|
||||||
|
// id
|
||||||
|
setId(element.getAttribute(IConfiguration.ID));
|
||||||
|
|
||||||
|
// hook me up
|
||||||
target.addConfiguration(this);
|
target.addConfiguration(this);
|
||||||
|
|
||||||
|
// name
|
||||||
|
if (element.hasAttribute(IConfiguration.NAME))
|
||||||
|
setName(element.getAttribute(IConfiguration.NAME));
|
||||||
|
|
||||||
|
if (element.hasAttribute(IConfiguration.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(IConfiguration.PARENT));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeList configElements = element.getChildNodes();
|
||||||
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
|
Node configElement = configElements.item(i);
|
||||||
|
if (configElement.getNodeName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
||||||
|
new ToolReference(this, (Element)configElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,75 +167,53 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
IConfigurationElement[] configElements = element.getChildren();
|
IConfigurationElement[] configElements = element.getChildren();
|
||||||
for (int l = 0; l < configElements.length; ++l) {
|
for (int l = 0; l < configElements.length; ++l) {
|
||||||
IConfigurationElement configElement = configElements[l];
|
IConfigurationElement configElement = configElements[l];
|
||||||
if (configElement.getName().equals(IConfiguration.TOOL_REF)) {
|
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
||||||
new ToolReference(this, configElement);
|
new ToolReference(this, configElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a configuration from the project manifest file.
|
* A fresh new configuration for a target.
|
||||||
*
|
*
|
||||||
* @param target The <code>Target</code> the configuration belongs to.
|
* @param target
|
||||||
* @param element The element from the manifest that contains the overridden configuration information.
|
* @param id
|
||||||
*/
|
*/
|
||||||
public Configuration(Target target, Element element) {
|
public Configuration(Target target, String id) {
|
||||||
|
this.id = id;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
|
||||||
// id
|
|
||||||
setId(element.getAttribute(IConfiguration.ID));
|
|
||||||
|
|
||||||
// hook me up
|
|
||||||
target.addConfiguration(this);
|
target.addConfiguration(this);
|
||||||
|
|
||||||
// name
|
|
||||||
if (element.hasAttribute(IConfiguration.NAME))
|
|
||||||
setName(element.getAttribute(IConfiguration.NAME));
|
|
||||||
|
|
||||||
if (element.hasAttribute(IConfiguration.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(IConfiguration.PARENT));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
parent = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NodeList configElements = element.getChildNodes();
|
|
||||||
for (int i = 0; i < configElements.getLength(); ++i) {
|
|
||||||
Node configElement = configElements.item(i);
|
|
||||||
if (configElement.getNodeName().equals(IConfiguration.TOOL_REF)) {
|
|
||||||
new ToolReference(this, (Element)configElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist receiver to project file.
|
* Adds a tool reference to the receiver.
|
||||||
*
|
*
|
||||||
* @param doc
|
* @param toolRef
|
||||||
* @param element
|
|
||||||
*/
|
*/
|
||||||
public void serialize(Document doc, Element element) {
|
public void addToolReference(ToolReference toolRef) {
|
||||||
element.setAttribute(IConfiguration.ID, id);
|
getLocalToolReferences().add(toolRef);
|
||||||
|
}
|
||||||
|
|
||||||
if (name != null)
|
/**
|
||||||
element.setAttribute(IConfiguration.NAME, name);
|
* @param option
|
||||||
|
* @return
|
||||||
if (parent != null)
|
*/
|
||||||
element.setAttribute(IConfiguration.PARENT, parent.getId());
|
public OptionReference createOptionReference(IOption option) {
|
||||||
|
if (option instanceof OptionReference) {
|
||||||
// Serialize only the tool references defined in the configuration
|
OptionReference optionRef = (OptionReference)option;
|
||||||
Iterator iter = getLocalToolReferences().listIterator();
|
ToolReference toolRef = optionRef.getToolReference();
|
||||||
while (iter.hasNext()) {
|
if (toolRef.ownedByConfiguration(this))
|
||||||
ToolReference toolRef = (ToolReference) iter.next();
|
return optionRef;
|
||||||
Element toolRefElement = doc.createElement(IConfiguration.TOOL_REF);
|
else {
|
||||||
element.appendChild(toolRefElement);
|
toolRef = new ToolReference(this, toolRef);
|
||||||
toolRef.serialize(doc, toolRefElement);
|
return toolRef.createOptionReference(option);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToolReference toolRef = getToolReference(option.getTool());
|
||||||
|
if (toolRef == null)
|
||||||
|
toolRef = new ToolReference(this, option.getTool());
|
||||||
|
return toolRef.createOptionReference(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,11 +284,6 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
|
|
||||||
// Replace tools with local overrides
|
// Replace tools with local overrides
|
||||||
for (int i = 0; i < tools.length; ++i) {
|
for (int i = 0; i < tools.length; ++i) {
|
||||||
ITool tool = tools[i];
|
|
||||||
if (tool == null) {
|
|
||||||
// May have been filtered out
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ToolReference ref = getToolReference(tools[i]);
|
ToolReference ref = getToolReference(tools[i]);
|
||||||
if (ref != null)
|
if (ref != null)
|
||||||
tools[i] = ref;
|
tools[i] = ref;
|
||||||
|
@ -291,21 +292,6 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param targetElement
|
|
||||||
*/
|
|
||||||
public void reset(IConfigurationElement element) {
|
|
||||||
// I just need to reset the tool references
|
|
||||||
getLocalToolReferences().clear();
|
|
||||||
IConfigurationElement[] configElements = element.getChildren();
|
|
||||||
for (int l = 0; l < configElements.length; ++l) {
|
|
||||||
IConfigurationElement configElement = configElements[l];
|
|
||||||
if (configElement.getName().equals(IConfiguration.TOOL_REF)) {
|
|
||||||
new ToolReference(this, configElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
|
||||||
*/
|
*/
|
||||||
|
@ -356,7 +342,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
return getTarget().getOwner();
|
return getTarget().getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Returns the reference for a given tool or <code>null</code> if one is not
|
* Returns the reference for a given tool or <code>null</code> if one is not
|
||||||
* found.
|
* found.
|
||||||
*
|
*
|
||||||
|
@ -366,6 +352,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
private ToolReference getToolReference(ITool tool) {
|
private ToolReference getToolReference(ITool tool) {
|
||||||
// See if the receiver has a reference to the tool
|
// See if the receiver has a reference to the tool
|
||||||
ToolReference ref = null;
|
ToolReference ref = null;
|
||||||
|
if (tool == null) return ref;
|
||||||
Iterator iter = getLocalToolReferences().listIterator();
|
Iterator iter = getLocalToolReferences().listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
ToolReference temp = (ToolReference)iter.next();
|
ToolReference temp = (ToolReference)iter.next();
|
||||||
|
@ -374,29 +361,46 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToolReference(ToolReference toolRef) {
|
/**
|
||||||
getLocalToolReferences().add(toolRef);
|
* @param targetElement
|
||||||
|
*/
|
||||||
|
public void reset(IConfigurationElement element) {
|
||||||
|
// I just need to reset the tool references
|
||||||
|
getLocalToolReferences().clear();
|
||||||
|
IConfigurationElement[] configElements = element.getChildren();
|
||||||
|
for (int l = 0; l < configElements.length; ++l) {
|
||||||
|
IConfigurationElement configElement = configElements[l];
|
||||||
|
if (configElement.getName().equals(IConfiguration.TOOLREF_ELEMENT_NAME)) {
|
||||||
|
new ToolReference(this, configElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionReference createOptionReference(IOption option) {
|
/**
|
||||||
if (option instanceof OptionReference) {
|
* Persist receiver to project file.
|
||||||
OptionReference optionRef = (OptionReference)option;
|
*
|
||||||
ToolReference toolRef = optionRef.getToolReference();
|
* @param doc
|
||||||
if (toolRef.getConfiguration().equals(this))
|
* @param element
|
||||||
return optionRef;
|
*/
|
||||||
else {
|
public void serialize(Document doc, Element element) {
|
||||||
toolRef = new ToolReference(this, toolRef);
|
element.setAttribute(IConfiguration.ID, id);
|
||||||
return toolRef.createOptionReference(option);
|
|
||||||
}
|
if (name != null)
|
||||||
} else {
|
element.setAttribute(IConfiguration.NAME, name);
|
||||||
ToolReference toolRef = getToolReference(option.getTool());
|
|
||||||
if (toolRef == null)
|
if (parent != null)
|
||||||
toolRef = new ToolReference(this, option.getTool());
|
element.setAttribute(IConfiguration.PARENT, parent.getId());
|
||||||
return toolRef.createOptionReference(option);
|
|
||||||
|
// Serialize only the tool references defined in the configuration
|
||||||
|
Iterator iter = getLocalToolReferences().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ToolReference toolRef = (ToolReference) iter.next();
|
||||||
|
Element toolRefElement = doc.createElement(IConfiguration.TOOLREF_ELEMENT_NAME);
|
||||||
|
element.appendChild(toolRefElement);
|
||||||
|
toolRef.serialize(doc, toolRefElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,5 +459,10 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
createOptionReference(option).setValue(value);
|
createOptionReference(option).setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
return new String("Configuration: ") + getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public OptionCategory(Tool tool, IConfigurationElement element) {
|
public OptionCategory(Tool tool, IConfigurationElement element) {
|
||||||
String parentId = element.getAttribute(IOptionCategory.PARENT);
|
String parentId = element.getAttribute(IOptionCategory.OWNER);
|
||||||
if (parentId != null)
|
if (parentId != null)
|
||||||
owner = tool.getOptionCategory(element.getAttribute(IOptionCategory.PARENT));
|
owner = tool.getOptionCategory(parentId);
|
||||||
else
|
else
|
||||||
owner = tool;
|
owner = tool;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.core.boot.BootLoader;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -49,16 +50,23 @@ public class Target extends BuildObject implements ITarget {
|
||||||
private List targetOSList;
|
private List targetOSList;
|
||||||
private Map toolMap;
|
private Map toolMap;
|
||||||
private List toolList;
|
private List toolList;
|
||||||
|
private List toolReferences;
|
||||||
|
|
||||||
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
|
private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
|
||||||
private static final String EMPTY_STRING = new String();
|
private static final String EMPTY_STRING = new String();
|
||||||
|
|
||||||
public Target(IResource owner) {
|
/* (non-Javadoc)
|
||||||
|
* Set the resource that owns the target.
|
||||||
|
*
|
||||||
|
* @param owner
|
||||||
|
*/
|
||||||
|
protected Target(IResource owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a target owned by a resource based on a parent target
|
* Create a copy of the target specified in the argument,
|
||||||
|
* that is owned by the owned by the specified resource.
|
||||||
*
|
*
|
||||||
* @param owner
|
* @param owner
|
||||||
* @param parent
|
* @param parent
|
||||||
|
@ -132,17 +140,9 @@ public class Target extends BuildObject implements ITarget {
|
||||||
|
|
||||||
// Get the clean command
|
// Get the clean command
|
||||||
cleanCommand = element.getAttribute(CLEAN_COMMAND);
|
cleanCommand = element.getAttribute(CLEAN_COMMAND);
|
||||||
if (cleanCommand == null) {
|
|
||||||
// See if it defined in the parent
|
|
||||||
cleanCommand = parent.getCleanCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the make command
|
// Get the make command
|
||||||
makeCommand = element.getAttribute(MAKE_COMMAND);
|
makeCommand = element.getAttribute(MAKE_COMMAND);
|
||||||
if (makeCommand == null) {
|
|
||||||
// See if it defined in the parent
|
|
||||||
makeCommand = parent.getMakeCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the comma-separated list of valid OS
|
// Get the comma-separated list of valid OS
|
||||||
String os = element.getAttribute(OS_LIST);
|
String os = element.getAttribute(OS_LIST);
|
||||||
|
@ -154,23 +154,21 @@ public class Target extends BuildObject implements ITarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IConfigurationElement[] targetElements = element.getChildren();
|
// Load any tool references we might have
|
||||||
int k;
|
IConfigurationElement[] toolRefs = element.getChildren(IConfiguration.TOOLREF_ELEMENT_NAME);
|
||||||
// Load the tools first
|
for (int i=0; i < toolRefs.length; ++i) {
|
||||||
for (k = 0; k < targetElements.length; ++k) {
|
new ToolReference(this, toolRefs[i]);
|
||||||
IConfigurationElement targetElement = targetElements[k];
|
}
|
||||||
if (targetElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
// Then load any tools defined for the target
|
||||||
new Tool(this, targetElement);
|
IConfigurationElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
|
||||||
}
|
for (int j = 0; j < tools.length; ++j) {
|
||||||
|
new Tool(this, tools[j]);
|
||||||
}
|
}
|
||||||
// Then load the configurations which may have tool references
|
// Then load the configurations which may have tool references
|
||||||
for (k = 0; k < targetElements.length; ++k) {
|
IConfigurationElement[] configs = element.getChildren(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
||||||
IConfigurationElement targetElement = targetElements[k];
|
for (int k = 0; k < configs.length; ++k) {
|
||||||
if (targetElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
|
new Configuration(this, configs[k]);
|
||||||
new Configuration(this, targetElement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,6 +288,20 @@ public class Target extends BuildObject implements ITarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-javadoc)
|
||||||
|
* A safe accesor method. It answers the tool reference list in the
|
||||||
|
* receiver.
|
||||||
|
*
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
protected List getLocalToolReferences() {
|
||||||
|
if (toolReferences == null) {
|
||||||
|
toolReferences = new ArrayList();
|
||||||
|
toolReferences.clear();
|
||||||
|
}
|
||||||
|
return toolReferences;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getMakeArguments()
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getMakeArguments()
|
||||||
*/
|
*/
|
||||||
|
@ -311,7 +323,17 @@ public class Target extends BuildObject implements ITarget {
|
||||||
*/
|
*/
|
||||||
public String getMakeCommand() {
|
public String getMakeCommand() {
|
||||||
// Return the name of the make utility
|
// Return the name of the make utility
|
||||||
return (makeCommand == null) ? parent.getMakeCommand() : makeCommand;
|
if (makeCommand == null) {
|
||||||
|
// If I have a parent, ask it
|
||||||
|
if (parent != null) {
|
||||||
|
return parent.getMakeCommand();
|
||||||
|
} else {
|
||||||
|
// The user has forgotten to specify a command in the plugin manifets.
|
||||||
|
return new String("make");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return makeCommand;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -351,14 +373,26 @@ public class Target extends BuildObject implements ITarget {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNumTools() {
|
private int getToolCount() {
|
||||||
|
// Count the tools that belong to the target
|
||||||
int n = getToolList().size();
|
int n = getToolList().size();
|
||||||
|
// Count the references the target has
|
||||||
|
n += getLocalToolReferences().size();
|
||||||
|
// Count the tools in the parent
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
n += ((Target)parent).getNumTools();
|
n += ((Target)parent).getToolCount();
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Tail-recursion method that creates a lits of tools and tool reference
|
||||||
|
* walking the receiver's parent hierarchy.
|
||||||
|
*
|
||||||
|
* @param toolArray
|
||||||
|
* @param start
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private int addToolsToArray(ITool[] toolArray, int start) {
|
private int addToolsToArray(ITool[] toolArray, int start) {
|
||||||
int n = start;
|
int n = start;
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
|
@ -368,9 +402,19 @@ public class Target extends BuildObject implements ITarget {
|
||||||
toolArray[n++] = (ITool)getToolList().get(i);
|
toolArray[n++] = (ITool)getToolList().get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add local tool references
|
||||||
|
for (int j = 0; j < getLocalToolReferences().size(); ++j) {
|
||||||
|
toolArray[n++] = (ITool)getLocalToolReferences().get(j);
|
||||||
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* A safe accessor method for the list of tools maintained by the
|
||||||
|
* target
|
||||||
|
*
|
||||||
|
*/
|
||||||
private List getToolList() {
|
private List getToolList() {
|
||||||
if (toolList == null) {
|
if (toolList == null) {
|
||||||
toolList = new ArrayList();
|
toolList = new ArrayList();
|
||||||
|
@ -379,6 +423,10 @@ public class Target extends BuildObject implements ITarget {
|
||||||
return toolList;
|
return toolList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* A safe accessor for the tool map
|
||||||
|
*
|
||||||
|
*/
|
||||||
private Map getToolMap() {
|
private Map getToolMap() {
|
||||||
if (toolMap == null) {
|
if (toolMap == null) {
|
||||||
toolMap = new HashMap();
|
toolMap = new HashMap();
|
||||||
|
@ -387,11 +435,33 @@ public class Target extends BuildObject implements ITarget {
|
||||||
return toolMap;
|
return toolMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Returns the reference for a given tool or <code>null</code> if one is not
|
||||||
|
* found.
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @return ToolReference
|
||||||
|
*/
|
||||||
|
private ToolReference getToolReference(ITool tool) {
|
||||||
|
// See if the receiver has a reference to the tool
|
||||||
|
ToolReference ref = null;
|
||||||
|
if (tool == null) return ref;
|
||||||
|
Iterator iter = getLocalToolReferences().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ToolReference temp = (ToolReference)iter.next();
|
||||||
|
if (temp.references(tool)) {
|
||||||
|
ref = temp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#getTools()
|
||||||
*/
|
*/
|
||||||
public ITool[] getTools() {
|
public ITool[] getTools() {
|
||||||
ITool[] toolArray = new ITool[getNumTools()];
|
ITool[] toolArray = new ITool[getToolCount()];
|
||||||
addToolsToArray(toolArray, 0);
|
addToolsToArray(toolArray, 0);
|
||||||
return toolArray;
|
return toolArray;
|
||||||
}
|
}
|
||||||
|
@ -413,13 +483,18 @@ public class Target extends BuildObject implements ITarget {
|
||||||
ITool result = null;
|
ITool result = null;
|
||||||
|
|
||||||
// See if receiver has it in list
|
// See if receiver has it in list
|
||||||
result = (ITool) getToolMap().get(id);
|
result = (ITool) getToolMap().get(id);
|
||||||
|
|
||||||
// If not, check if parent has it
|
// If not, check if parent has it
|
||||||
if (result == null && parent != null) {
|
if (result == null && parent != null) {
|
||||||
result = ((Target)parent).getTool(id);
|
result = ((Target)parent).getTool(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If not defined in parents, check if defined at all
|
||||||
|
if (result == null) {
|
||||||
|
result = ManagedBuildManager.getTool(id);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +529,21 @@ public class Target extends BuildObject implements ITarget {
|
||||||
*/
|
*/
|
||||||
public String getCleanCommand() {
|
public String getCleanCommand() {
|
||||||
// Return the command used to remove files
|
// Return the command used to remove files
|
||||||
return cleanCommand == null ? EMPTY_STRING : cleanCommand;
|
if (cleanCommand == null) {
|
||||||
|
if (parent != null) {
|
||||||
|
return parent.getCleanCommand();
|
||||||
|
} else {
|
||||||
|
// User forgot to specify it. Guess based on OS.
|
||||||
|
if (BootLoader.getOS().equals("OS_WIN32")) {
|
||||||
|
return new String("del");
|
||||||
|
} else {
|
||||||
|
return new String("rm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// This was spec'd in the manifest
|
||||||
|
return cleanCommand;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -559,6 +648,15 @@ public class Target extends BuildObject implements ITarget {
|
||||||
return new Configuration(this, parent, id);
|
return new Configuration(this, parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a tool reference to the receiver.
|
||||||
|
*
|
||||||
|
* @param toolRef
|
||||||
|
*/
|
||||||
|
public void addToolReference(ToolReference toolRef) {
|
||||||
|
getLocalToolReferences().add(toolRef);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setArtifactExtension(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#setArtifactExtension(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -595,6 +693,13 @@ public class Target extends BuildObject implements ITarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
return new String("Target: ") + getName();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITarget#updateOwner(org.eclipse.core.resources.IResource)
|
* @see org.eclipse.cdt.managedbuilder.core.ITarget#updateOwner(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,8 +21,8 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,96 +47,27 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private String outputExtension;
|
private String outputExtension;
|
||||||
private String outputFlag;
|
private String outputFlag;
|
||||||
private String outputPrefix;
|
private String outputPrefix;
|
||||||
private ITarget target;
|
|
||||||
|
|
||||||
public Tool(Target target) {
|
|
||||||
this.target = target;
|
public Tool(IConfigurationElement element) {
|
||||||
|
loadFromManifest(element);
|
||||||
|
|
||||||
|
// hook me up
|
||||||
|
ManagedBuildManager.addExtensionTool(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to create a new tool in the build model based on the information
|
* Constructor to create a new tool for a target based on the information
|
||||||
* defined in the plugin.xml manifest.
|
* defined in the plugin.xml manifest.
|
||||||
*
|
*
|
||||||
* @param target The target the receiver will belong to.
|
* @param target The target the receiver will belong to.
|
||||||
* @param element The element containing the information.
|
* @param element The element containing the information.
|
||||||
*/
|
*/
|
||||||
public Tool(Target target, IConfigurationElement element) {
|
public Tool(Target target, IConfigurationElement element) {
|
||||||
this(target);
|
loadFromManifest(element);
|
||||||
|
|
||||||
// id
|
|
||||||
setId(element.getAttribute(ITool.ID));
|
|
||||||
|
|
||||||
// hook me up
|
// hook me up
|
||||||
target.addTool(this);
|
target.addTool(this);
|
||||||
|
|
||||||
// name
|
|
||||||
setName(element.getAttribute(ITool.NAME));
|
|
||||||
|
|
||||||
// Get the nature filter
|
|
||||||
String nature = element.getAttribute(NATURE);
|
|
||||||
if (nature == null || "both".equals(nature)) {
|
|
||||||
natureFilter = FILTER_BOTH;
|
|
||||||
} else if ("cnature".equals(nature)) {
|
|
||||||
natureFilter = FILTER_C;
|
|
||||||
} else if ("ccnature".equals(nature)) {
|
|
||||||
natureFilter = FILTER_CC;
|
|
||||||
} else {
|
|
||||||
natureFilter = FILTER_BOTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the supported input file extension
|
|
||||||
String inputs = element.getAttribute(ITool.SOURCES) == null ?
|
|
||||||
new String() :
|
|
||||||
element.getAttribute(ITool.SOURCES);
|
|
||||||
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
|
|
||||||
while (tokenizer.hasMoreElements()) {
|
|
||||||
getInputExtensions().add(tokenizer.nextElement());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the interface (header file) extensions
|
|
||||||
String headers = element.getAttribute(INTERFACE_EXTS);
|
|
||||||
if (headers == null) {
|
|
||||||
headers = new String();
|
|
||||||
}
|
|
||||||
tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
|
|
||||||
while (tokenizer.hasMoreElements()) {
|
|
||||||
getInterfaceExtensions().add(tokenizer.nextElement());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the output extension
|
|
||||||
outputExtension = element.getAttribute(ITool.OUTPUTS) == null ?
|
|
||||||
new String() :
|
|
||||||
element.getAttribute(ITool.OUTPUTS);
|
|
||||||
|
|
||||||
// Get the tool invocation
|
|
||||||
command = element.getAttribute(ITool.COMMAND) == null ?
|
|
||||||
new String() :
|
|
||||||
element.getAttribute(ITool.COMMAND);
|
|
||||||
|
|
||||||
// Get the flag to control output
|
|
||||||
outputFlag = element.getAttribute(ITool.OUTPUT_FLAG) == null ?
|
|
||||||
new String() :
|
|
||||||
element.getAttribute(ITool.OUTPUT_FLAG);
|
|
||||||
|
|
||||||
// Get the output prefix
|
|
||||||
outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX) == null ?
|
|
||||||
new String() :
|
|
||||||
element.getAttribute(ITool.OUTPUT_PREFIX);
|
|
||||||
|
|
||||||
// set up the category map
|
|
||||||
categoryMap = new HashMap();
|
|
||||||
addOptionCategory(this);
|
|
||||||
|
|
||||||
// Check for options
|
|
||||||
IConfigurationElement[] toolElements = element.getChildren();
|
|
||||||
for (int l = 0; l < toolElements.length; ++l) {
|
|
||||||
IConfigurationElement toolElement = toolElements[l];
|
|
||||||
if (toolElement.getName().equals(ITool.OPTION)) {
|
|
||||||
new Option(this, toolElement);
|
|
||||||
} else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
|
|
||||||
new OptionCategory(this, toolElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOptionCategory getOptionCategory(String id) {
|
public IOptionCategory getOptionCategory(String id) {
|
||||||
|
@ -247,10 +178,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITarget getTarget() {
|
/* public ITarget getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
|
||||||
*/
|
*/
|
||||||
|
@ -401,6 +332,80 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return getInterfaceExtensions().contains(ext);
|
return getInterfaceExtensions().contains(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void loadFromManifest(IConfigurationElement element) {
|
||||||
|
// id
|
||||||
|
setId(element.getAttribute(ITool.ID));
|
||||||
|
|
||||||
|
// name
|
||||||
|
setName(element.getAttribute(ITool.NAME));
|
||||||
|
|
||||||
|
// Get the nature filter
|
||||||
|
String nature = element.getAttribute(NATURE);
|
||||||
|
if (nature == null || "both".equals(nature)) {
|
||||||
|
natureFilter = FILTER_BOTH;
|
||||||
|
} else if ("cnature".equals(nature)) {
|
||||||
|
natureFilter = FILTER_C;
|
||||||
|
} else if ("ccnature".equals(nature)) {
|
||||||
|
natureFilter = FILTER_CC;
|
||||||
|
} else {
|
||||||
|
natureFilter = FILTER_BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the supported input file extension
|
||||||
|
String inputs = element.getAttribute(ITool.SOURCES) == null ?
|
||||||
|
new String() :
|
||||||
|
element.getAttribute(ITool.SOURCES);
|
||||||
|
StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
|
||||||
|
while (tokenizer.hasMoreElements()) {
|
||||||
|
getInputExtensions().add(tokenizer.nextElement());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the interface (header file) extensions
|
||||||
|
String headers = element.getAttribute(INTERFACE_EXTS);
|
||||||
|
if (headers == null) {
|
||||||
|
headers = new String();
|
||||||
|
}
|
||||||
|
tokenizer = new StringTokenizer(headers, DEFAULT_SEPARATOR);
|
||||||
|
while (tokenizer.hasMoreElements()) {
|
||||||
|
getInterfaceExtensions().add(tokenizer.nextElement());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the output extension
|
||||||
|
outputExtension = element.getAttribute(ITool.OUTPUTS) == null ?
|
||||||
|
new String() :
|
||||||
|
element.getAttribute(ITool.OUTPUTS);
|
||||||
|
|
||||||
|
// Get the tool invocation
|
||||||
|
command = element.getAttribute(ITool.COMMAND) == null ?
|
||||||
|
new String() :
|
||||||
|
element.getAttribute(ITool.COMMAND);
|
||||||
|
|
||||||
|
// Get the flag to control output
|
||||||
|
outputFlag = element.getAttribute(ITool.OUTPUT_FLAG) == null ?
|
||||||
|
new String() :
|
||||||
|
element.getAttribute(ITool.OUTPUT_FLAG);
|
||||||
|
|
||||||
|
// Get the output prefix
|
||||||
|
outputPrefix = element.getAttribute(ITool.OUTPUT_PREFIX) == null ?
|
||||||
|
new String() :
|
||||||
|
element.getAttribute(ITool.OUTPUT_PREFIX);
|
||||||
|
|
||||||
|
// set up the category map
|
||||||
|
categoryMap = new HashMap();
|
||||||
|
addOptionCategory(this);
|
||||||
|
|
||||||
|
// Check for options
|
||||||
|
IConfigurationElement[] toolElements = element.getChildren();
|
||||||
|
for (int l = 0; l < toolElements.length; ++l) {
|
||||||
|
IConfigurationElement toolElement = toolElements[l];
|
||||||
|
if (toolElement.getName().equals(ITool.OPTION)) {
|
||||||
|
new Option(this, toolElement);
|
||||||
|
} else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
|
||||||
|
new OptionCategory(this, toolElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,10 +16,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITarget;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -31,23 +31,27 @@ import org.w3c.dom.NodeList;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ToolReference implements ITool {
|
public class ToolReference implements ITool {
|
||||||
|
private String command;
|
||||||
private ITool parent;
|
|
||||||
private IConfiguration owner;
|
|
||||||
private List optionReferences;
|
private List optionReferences;
|
||||||
private Map optionRefMap;
|
private Map optionRefMap;
|
||||||
|
private IBuildObject owner;
|
||||||
|
private ITool parent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created a tool reference on the fly based on an existing tool.
|
* Created a tool reference on the fly based on an existing tool.
|
||||||
*
|
*
|
||||||
* @param owner The <code>Configuration</code> the receiver will be added to.
|
* @param owner The <code>BuildObject</code> the receiver will be added to.
|
||||||
* @param parent The <code>ITool</code>tool the reference will be based on.
|
* @param parent The <code>ITool</code>tool the reference will be based on.
|
||||||
*/
|
*/
|
||||||
public ToolReference(Configuration owner, ITool parent) {
|
public ToolReference(BuildObject owner, ITool parent) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
owner.addToolReference(this);
|
if (owner instanceof Configuration) {
|
||||||
|
((Configuration)owner).addToolReference(this);
|
||||||
|
} else if (owner instanceof Target) {
|
||||||
|
((Target)owner).addToolReference(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,15 +66,19 @@ public class ToolReference implements ITool {
|
||||||
/**
|
/**
|
||||||
* Created tool reference from an extension defined in a plugin manifest.
|
* Created tool reference from an extension defined in a plugin manifest.
|
||||||
*
|
*
|
||||||
* @param owner The <code>Configuration</code> the receiver will be added to.
|
* @param owner The <code>BuildObject</code> the receiver will be added to.
|
||||||
* @param element The element containing build information for the reference.
|
* @param element The element containing build information for the reference.
|
||||||
*/
|
*/
|
||||||
public ToolReference(Configuration owner, IConfigurationElement element) {
|
public ToolReference(BuildObject owner, IConfigurationElement element) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
if (owner instanceof Configuration) {
|
||||||
parent = ((Target)owner.getTarget()).getTool(element.getAttribute(ID));
|
Target target = (Target) ((Configuration)owner).getTarget();
|
||||||
|
parent = target.getTool(element.getAttribute(ID));
|
||||||
owner.addToolReference(this);
|
((Configuration)owner).addToolReference(this);
|
||||||
|
} else if (owner instanceof Target) {
|
||||||
|
parent = ((Target)owner).getTool(element.getAttribute(ID));
|
||||||
|
((Target)owner).addToolReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
IConfigurationElement[] toolElements = element.getChildren();
|
IConfigurationElement[] toolElements = element.getChildren();
|
||||||
for (int m = 0; m < toolElements.length; ++m) {
|
for (int m = 0; m < toolElements.length; ++m) {
|
||||||
|
@ -88,13 +96,17 @@ public class ToolReference implements ITool {
|
||||||
* @param element The element defined in the project file containing build information
|
* @param element The element defined in the project file containing build information
|
||||||
* for the receiver.
|
* for the receiver.
|
||||||
*/
|
*/
|
||||||
public ToolReference(Configuration owner, Element element) {
|
public ToolReference(BuildObject owner, Element element) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|
||||||
Target parentTarget = (Target)owner.getTarget();
|
if (owner instanceof Configuration) {
|
||||||
parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute("id"));
|
Target parentTarget = (Target) ((Configuration)owner).getTarget();
|
||||||
|
parent = ((Target)parentTarget.getParent()).getTool(element.getAttribute(ID));
|
||||||
owner.addToolReference(this);
|
((Configuration)owner).addToolReference(this);
|
||||||
|
} else if (owner instanceof Target) {
|
||||||
|
parent = ((Target)((Target)owner).getParent()).getTool(element.getAttribute(ID));
|
||||||
|
((Target)owner).addToolReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
NodeList configElements = element.getChildNodes();
|
NodeList configElements = element.getChildNodes();
|
||||||
for (int i = 0; i < configElements.getLength(); ++i) {
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
|
@ -105,28 +117,14 @@ public class ToolReference implements ITool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean ownedByConfiguration(IConfiguration config) {
|
||||||
* Persist receiver to project file.
|
if (owner instanceof Configuration) {
|
||||||
*
|
return ((IConfiguration)owner).equals(config);
|
||||||
* @param doc The persistent store for the reference information.
|
} else {
|
||||||
* @param element The root element in the store the receiver must use
|
return false;
|
||||||
* to persist settings.
|
|
||||||
*/
|
|
||||||
public void serialize(Document doc, Element element) {
|
|
||||||
element.setAttribute(ITool.ID, parent.getId());
|
|
||||||
Iterator iter = getLocalOptionRefs().listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
OptionReference optionRef = (OptionReference) iter.next();
|
|
||||||
Element optionRefElement = doc.createElement(ITool.OPTION_REF);
|
|
||||||
element.appendChild(optionRefElement);
|
|
||||||
optionRef.serialize(doc, optionRefElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfiguration getConfiguration() {
|
|
||||||
return owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ITool getTool() {
|
public ITool getTool() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
@ -247,10 +245,14 @@ public class ToolReference implements ITool {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getTarget()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getTarget()
|
||||||
*/
|
*/
|
||||||
public ITarget getTarget() {
|
/* public ITarget getTarget() {
|
||||||
return owner.getTarget();
|
if (owner instanceof IConfiguration) {
|
||||||
|
return ((IConfiguration)owner).getTarget();
|
||||||
|
} else {
|
||||||
|
return (ITarget)owner;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getTopOptionCategory()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getTopOptionCategory()
|
||||||
*/
|
*/
|
||||||
|
@ -395,4 +397,38 @@ public class ToolReference implements ITool {
|
||||||
return parent.getOutputExtension(inputExtension);
|
return parent.getOutputExtension(inputExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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(ITool.ID, parent.getId());
|
||||||
|
Iterator iter = getLocalOptionRefs().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
OptionReference optionRef = (OptionReference) iter.next();
|
||||||
|
Element optionRefElement = doc.createElement(ITool.OPTION_REF);
|
||||||
|
element.appendChild(optionRefElement);
|
||||||
|
optionRef.serialize(doc, optionRefElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
String answer = new String();
|
||||||
|
|
||||||
|
if (parent != null) {
|
||||||
|
answer += "Reference to tool: " + parent.getName(); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
if (answer.length() > 0) {
|
||||||
|
return answer;
|
||||||
|
} else {
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue