mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Apply Symbian (Lars & Bala) patch for Shared Tool Options support
This commit is contained in:
parent
6d35ccf9b4
commit
0119b87695
35 changed files with 2675 additions and 923 deletions
|
@ -267,6 +267,8 @@
|
||||||
<element ref="tool"/>
|
<element ref="tool"/>
|
||||||
<element ref="targetPlatform"/>
|
<element ref="targetPlatform"/>
|
||||||
<element ref="builder"/>
|
<element ref="builder"/>
|
||||||
|
<element ref="optionCategory"/>
|
||||||
|
<element ref="option"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -594,6 +596,13 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="icon" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Path to a 16x16 pixel big icon that is to be displayed instead of the default icon. The path is relative to the plug-in directory which defines .buildDefinitions.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
<attribute name="versionsSupported" type="string">
|
<attribute name="versionsSupported" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
@ -912,7 +921,15 @@
|
||||||
<attribute name="owner" type="string">
|
<attribute name="owner" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Option categories can belong to a tool or be nested inside other option categories. This is the ID of the owner of the category.
|
Option categories can belong to a tool, a toolChain or be nested inside other option categories. This is the ID of the owner of the category.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="icon" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Path to a 16x16 pixel big icon that is to be displayed instead of the default icon.
|
||||||
|
The path is relative to the plug-in directory which defines .buildDefinitions.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -923,6 +940,7 @@
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as '-g' in the case of debugging symbol information for compilers.
|
An option is associated with a tool. Options can contain boolean values, a simple text string, a selection from an enumerated list, or a list of values. Options also map the value they contain to a command-line flag, such as '-g' in the case of debugging symbol information for compilers.
|
||||||
|
Options can also be associated with a toolchain. However in such a case the option must be contained in a optionCategory.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
<complexType>
|
<complexType>
|
||||||
|
@ -1080,6 +1098,23 @@ Additional special types exist to flag options of special relevance to the build
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="valueHandler" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
The id of a class that implements the IManagedOptionValueHandler interface
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="valueHandlerExtraArgument" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
An optional extra text string that is passed into the valueHandler
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
<attribute name="applicabilityCalculator" type="string">
|
<attribute name="applicabilityCalculator" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
|
@ -383,43 +383,52 @@ public interface IConfiguration extends IBuildObject {
|
||||||
/**
|
/**
|
||||||
* Sets the value of a boolean option for this configuration.
|
* Sets the value of a boolean option for this configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, boolean value)
|
public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a string option for this configuration.
|
* Sets the value of a string option for this configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option that will be effected by change.
|
* @param option The option that will be effected by change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String value)
|
public IOption setOption(IHoldsOptions parent, IOption option, String value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a list option for this configuration.
|
* Sets the value of a list option for this configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The values to apply to the option.
|
* @param value The values to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String[] value)
|
public IOption setOption(IHoldsOptions parent, IOption option, String[] value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2005 Symbian Ltd and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Symbian Ltd - Initial API and implementation
|
||||||
|
**********************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the functionality that is needed to hold options and option
|
||||||
|
* categories. The functionality has been moved from ITool to here in CDT 3.0.
|
||||||
|
* Backwards compatibility of interfaces has been maintained because ITool
|
||||||
|
* extends IHoldOptions.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public interface IHoldsOptions extends IBuildObject {
|
||||||
|
|
||||||
|
public static final String OPTION = "option"; //$NON-NLS-1$
|
||||||
|
public static final String OPTION_CAT = "optionCategory"; //$NON-NLS-1$
|
||||||
|
public static final String OPTION_REF = "optionReference"; //$NON-NLS-1$
|
||||||
|
/*
|
||||||
|
* M E T H O D S M O V E D F R O M I T O O L I N 3 . 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a child Option
|
||||||
|
*
|
||||||
|
* @param Option The superClass, if any
|
||||||
|
* @param String The id for the new option
|
||||||
|
* @param String The name for the new option
|
||||||
|
* @param boolean Indicates whether this is an extension element or a managed project element
|
||||||
|
*
|
||||||
|
* @return IOption
|
||||||
|
*/
|
||||||
|
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an option.
|
||||||
|
*
|
||||||
|
* @param option
|
||||||
|
*/
|
||||||
|
public void removeOption(IOption option);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a deprecated method for retrieving an <code>IOption</code> from
|
||||||
|
* the receiver based on an ID. It is preferred that you use the newer method
|
||||||
|
* <code>getOptionById</code>
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IHoldsOptions#getOptionById(java.lang.String)
|
||||||
|
*
|
||||||
|
* @param id unique identifier of the option to search for
|
||||||
|
* @return <code>IOption</code>
|
||||||
|
* @deprecated use getOptionById() instead
|
||||||
|
*/
|
||||||
|
public IOption getOption(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the <code>IOption</code> in the receiver with the specified
|
||||||
|
* ID. This is an efficient search in the receiver.
|
||||||
|
*
|
||||||
|
* <p>If the receiver does not have an option with that ID, the method
|
||||||
|
* returns <code>null</code>. It is the responsibility of the caller to
|
||||||
|
* verify the return value.
|
||||||
|
*
|
||||||
|
* @param id unique identifier of the option to search for
|
||||||
|
* @return <code>IOption</code>
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
public IOption getOptionById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the <code>IOption</code> in the receiver with the specified
|
||||||
|
* ID, or an option with a superclass with this id.
|
||||||
|
*
|
||||||
|
* <p>If the receiver does not have an option with that ID, the method
|
||||||
|
* returns <code>null</code>. It is the responsibility of the caller to
|
||||||
|
* verify the return value.
|
||||||
|
*
|
||||||
|
* @param id unique identifier of the option to search for
|
||||||
|
* @return <code>IOption</code>
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public IOption getOptionBySuperClassId(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the complete list of options that are available for this object.
|
||||||
|
* The list is a merging of the options specified for this object with the
|
||||||
|
* options of its superclasses. The lowest option instance in the hierarchy
|
||||||
|
* takes precedence.
|
||||||
|
*
|
||||||
|
* @return IOption[]
|
||||||
|
*/
|
||||||
|
public IOption[] getOptions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the option category children of this tool.
|
||||||
|
*
|
||||||
|
* @return IOptionCategory[]
|
||||||
|
*/
|
||||||
|
public IOptionCategory[] getChildCategories();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* M E T H O D S M O V E D F R O M T O O L I N 3 . 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the <code>IOptionCategory</code> to this Option Holder's
|
||||||
|
* list of Option Categories.
|
||||||
|
*
|
||||||
|
* @param category The option category to be added
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void addOptionCategory(IOptionCategory category);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* N E W M E T H O D S A D D E D I N 3 . 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Answers the <code>IOptionCategory</code> that has the unique identifier
|
||||||
|
* specified in the argument.
|
||||||
|
*
|
||||||
|
* @param id The unique identifier of the option category
|
||||||
|
* @return <code>IOptionCategory</code> with the id specified in the argument
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public IOptionCategory getOptionCategory(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates options from the superclass and adds it to this class.
|
||||||
|
* Each individual option in superclass, will become the superclass for
|
||||||
|
* the new option.
|
||||||
|
*
|
||||||
|
* @param IHoldsOptions The superClass
|
||||||
|
* @return
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public void createOptions(IHoldsOptions superClass);
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004 TimeSys Corporation and others.
|
* Copyright (c) 2004, 2005 TimeSys Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2005 Symbian Ltd and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Symbian Ltd - Initial API and implementation
|
||||||
|
**********************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface represents an option value handler in the managed build
|
||||||
|
* system. It is used to enable a tool integrator to use the MBS configuration
|
||||||
|
* GUI, while linking to an alternative back-end.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public interface IManagedOptionValueHandler{
|
||||||
|
|
||||||
|
public final int EVENT_OPEN = 1; /** The option is opened, i.e. its UI element
|
||||||
|
* is created. The valueHandler can override
|
||||||
|
* the value of the option. If it does not,
|
||||||
|
* the last persisted value is used. */
|
||||||
|
public final int EVENT_CLOSE = 2; /** The option is closed. i.e. its value has been
|
||||||
|
* destroyed when a configuration/resource gets deleted.
|
||||||
|
* The valuehandler can do various things assocaited with
|
||||||
|
* destroying the option such as freeing the memory
|
||||||
|
* associated with this option callback, if needed. */
|
||||||
|
public final int EVENT_SETDEFAULT = 3; /** The default value option::defaultValue has
|
||||||
|
* been set. The handleValue callback is called
|
||||||
|
* afterwards to give the handler a chance to
|
||||||
|
* override the value or to update the value in
|
||||||
|
* its back-end. Typically this event will be called
|
||||||
|
* when the Restore Defaults button is pressed. */
|
||||||
|
public final int EVENT_APPLY = 4; /** The option has been set by pressing the Apply
|
||||||
|
* button (or the OK button). The valueHandler can
|
||||||
|
* transfer the value of the option to its own
|
||||||
|
* back-end. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles transfer between values between UI element and
|
||||||
|
* back-end in different circumstances.
|
||||||
|
*
|
||||||
|
* @param configuration build configuration of option
|
||||||
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option that is handled
|
||||||
|
* @param extraArgument extra argument for handler
|
||||||
|
* @param event event to be handled
|
||||||
|
*
|
||||||
|
* @return True when the event was handled, false otherwise.
|
||||||
|
* This enables default event handling can take place.
|
||||||
|
*/
|
||||||
|
boolean handleValue(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option,
|
||||||
|
String extraArgument,
|
||||||
|
int event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the value of an option is its default value.
|
||||||
|
*
|
||||||
|
* @param configuration build configuration of option
|
||||||
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option that is handled
|
||||||
|
* @param extraArgument extra argument for handler
|
||||||
|
*
|
||||||
|
* The additional options besides configuration are supplied to
|
||||||
|
* provide enough information for querying the default value from
|
||||||
|
* a potential data storage back-end.
|
||||||
|
*
|
||||||
|
* @return True if the options value is its default value and
|
||||||
|
* False otherwise. This enables that default event handling can
|
||||||
|
* take place.
|
||||||
|
*/
|
||||||
|
boolean isDefaultValue(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option,
|
||||||
|
String extraArgument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether an enumeration value of an option is currently a
|
||||||
|
* valid choice. The use-case for this method is the case, where
|
||||||
|
* the set of valid enumerations in the plugin.xml file changes.
|
||||||
|
* The UI will remove entries from selection lists if the value
|
||||||
|
* returns false.
|
||||||
|
*
|
||||||
|
* @param configuration build configuration of option
|
||||||
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option that is handled
|
||||||
|
* @param extraArgument extra argument for handler
|
||||||
|
* @param enumValue enumeration value that is to be checked
|
||||||
|
*
|
||||||
|
* The additional options besides configuration are supplied to
|
||||||
|
* provide enough information for querying information from a
|
||||||
|
* a potential data storage back-end.
|
||||||
|
*
|
||||||
|
* @return True if the enumeration value is valid and False
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
boolean isEnumValueAppropriate(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option,
|
||||||
|
String extraArgument,
|
||||||
|
String enumValue);
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core;
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -60,17 +61,31 @@ public interface IOption extends IBuildObject {
|
||||||
public static final String TYPE_DEFINED_SYMBOLS = "definedSymbols"; //$NON-NLS-1$
|
public static final String TYPE_DEFINED_SYMBOLS = "definedSymbols"; //$NON-NLS-1$
|
||||||
public static final String VALUE = "value"; //$NON-NLS-1$
|
public static final String VALUE = "value"; //$NON-NLS-1$
|
||||||
public static final String VALUE_TYPE = "valueType"; //$NON-NLS-1$
|
public static final String VALUE_TYPE = "valueType"; //$NON-NLS-1$
|
||||||
|
public static final String VALUE_HANDLER = "valueHandler"; //$NON-NLS-1$
|
||||||
|
public static final String VALUE_HANDLER_EXTRA_ARGUMENT = "valueHandlerExtraArgument"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Schema attribute names for listOptionValue elements
|
// Schema attribute names for listOptionValue elements
|
||||||
public static final String LIST_ITEM_VALUE = "value"; //$NON-NLS-1$
|
public static final String LIST_ITEM_VALUE = "value"; //$NON-NLS-1$
|
||||||
public static final String LIST_ITEM_BUILTIN = "builtIn"; //$NON-NLS-1$
|
public static final String LIST_ITEM_BUILTIN = "builtIn"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool defining this option.
|
* Returns the parent of this option. This is an object implementing ITool
|
||||||
|
* or IToolChain.
|
||||||
*
|
*
|
||||||
* @return ITool
|
* @return IBuildObject
|
||||||
|
* @since 3.0 - changed return type from ITool to IBuildObject. The method returns
|
||||||
|
* the same object as getOptionHolder(). It is included as a convenience for clients.
|
||||||
*/
|
*/
|
||||||
public ITool getParent();
|
public IBuildObject getParent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the holder (parent) of this option. This may be an object
|
||||||
|
* implenting ITool or IToolChain, which both extend IHoldsOptions
|
||||||
|
*
|
||||||
|
* @return IHoldsOptions
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public IHoldsOptions getOptionHolder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>IOption</code> that is the superclass of this
|
* Returns the <code>IOption</code> that is the superclass of this
|
||||||
|
@ -346,6 +361,20 @@ public interface IOption extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public void setValueType(int type);
|
public void setValueType(int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value handler specified for this tool.
|
||||||
|
* @return IManagedOptionValueHandler
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public IManagedOptionValueHandler getValueHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value handlers extra argument specified for this tool
|
||||||
|
* @return String
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public String getValueHandlerExtraArgument();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this option was loaded from a manifest file,
|
* Returns <code>true</code> if this option was loaded from a manifest file,
|
||||||
* and <code>false</code> if it was loaded from a project (.cdtbuild) file.
|
* and <code>false</code> if it was loaded from a project (.cdtbuild) file.
|
||||||
|
@ -361,4 +390,15 @@ public interface IOption extends IBuildObject {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean overridesOnlyValue();
|
public boolean overridesOnlyValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <code>true</code> if this option is valid and <code>false</code>
|
||||||
|
* if the option cannot be safely used due to an error in the MBS grammar.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
* @since 3.0
|
||||||
|
*
|
||||||
|
* @pre Can only be used after Ids in MBS grammar have been resolved by pointers.
|
||||||
|
*/
|
||||||
|
public boolean isValid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,22 +20,34 @@ public interface IOptionApplicability {
|
||||||
* generated which uses this option, and in the C/C++ Build property
|
* generated which uses this option, and in the C/C++ Build property
|
||||||
* pages when displaying the current command line.
|
* pages when displaying the current command line.
|
||||||
*
|
*
|
||||||
* @param toolParent The parent tool for this option. This provides
|
* @param configuration build configuration of option
|
||||||
* a context for obtaining other information from the MBS
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
* @return true if this this option is to be used in command line
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option itself
|
||||||
|
*
|
||||||
|
* @return true if this option is to be used in command line
|
||||||
* generation, false otherwise
|
* generation, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isOptionUsedInCommandLine(ITool toolParent);
|
public boolean isOptionUsedInCommandLine(
|
||||||
|
IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is queried whenever a new option category is displayed.
|
* This method is queried whenever a new option category is displayed.
|
||||||
*
|
*
|
||||||
* @param toolParent The parent tool for this option. This provides
|
* @param configuration build configuration of option
|
||||||
* a context for obtaining other information from the MBS
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option itself
|
||||||
|
*
|
||||||
* @return true if this option should be visible in the build options page,
|
* @return true if this option should be visible in the build options page,
|
||||||
* false otherwise
|
* false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isOptionVisible(ITool toolParent);
|
public boolean isOptionVisible(
|
||||||
|
IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever the value of an option changes in the GUI, this method is
|
* Whenever the value of an option changes in the GUI, this method is
|
||||||
|
@ -43,11 +55,17 @@ public interface IOptionApplicability {
|
||||||
* this occurs when the GUI changes - the user may opt to cancel these
|
* this occurs when the GUI changes - the user may opt to cancel these
|
||||||
* changes.
|
* changes.
|
||||||
*
|
*
|
||||||
* @param toolParent The parent tool for this option. This provides
|
* @param configuration build configuration of option
|
||||||
* a context for obtaining other information from the MBS
|
* (may be IConfiguration or IResourceConfiguration)
|
||||||
|
* @param holder contains the holder of the option
|
||||||
|
* @param option the option itself
|
||||||
|
*
|
||||||
* @return true if this option should be enabled in the build options page,
|
* @return true if this option should be enabled in the build options page,
|
||||||
* or false if it should be disabled (grayed out)
|
* or false if it should be disabled (grayed out)
|
||||||
*/
|
*/
|
||||||
public boolean isOptionEnabled(ITool toolParent);
|
public boolean isOptionEnabled(
|
||||||
|
IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core;
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -17,6 +19,7 @@ public interface IOptionCategory extends IBuildObject {
|
||||||
|
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String OWNER = "owner"; //$NON-NLS-1$
|
public static final String OWNER = "owner"; //$NON-NLS-1$
|
||||||
|
public static final String ICON = "icon"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Resource Filter type
|
// Resource Filter type
|
||||||
public static final int FILTER_ALL = 0;
|
public static final int FILTER_ALL = 0;
|
||||||
|
@ -52,11 +55,36 @@ public interface IOptionCategory extends IBuildObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tool that ultimately owns this category.
|
* Returns the tool that ultimately owns this category.
|
||||||
|
* If owned by a toolChain return null.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
* @deprecated since 3.0 - use getOptionHolder() instead
|
||||||
*/
|
*/
|
||||||
public ITool getTool();
|
public ITool getTool();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the holder (parent) of this category. This may be an object
|
||||||
|
* implementing ITool or IToolChain, which both extend IHoldsOptions.
|
||||||
|
* The call can return null, for example the top option category of a tool
|
||||||
|
* will return null.
|
||||||
|
*
|
||||||
|
* Note that the name getOptionHolder() has been choosen, because Tool implements
|
||||||
|
* both ITool and IOptionCategory and ITool.getParent() exists already.
|
||||||
|
*
|
||||||
|
* @return IHoldsOptions
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public IHoldsOptions getOptionHolder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the path name of an alternative icon for the option group.
|
||||||
|
* Or null if no alternative icon was defined.
|
||||||
|
*
|
||||||
|
* @return URL
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public URL getIconPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this element has changes that need to
|
* Returns <code>true</code> if this element has changes that need to
|
||||||
* be saved in the project file, else <code>false</code>.
|
* be saved in the project file, else <code>false</code>.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004 Intel Corporation and others.
|
* Copyright (c) 2004, 2005 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -118,46 +118,56 @@ public interface IResourceConfiguration extends IBuildObject {
|
||||||
* @param command The command
|
* @param command The command
|
||||||
*/
|
*/
|
||||||
public void setToolCommand(ITool tool, String command);
|
public void setToolCommand(ITool tool, String command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a boolean option for this resource configuration.
|
* Sets the value of a boolean option for this resource configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, boolean value)
|
public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a string option for this resource configuration.
|
* Sets the value of a string option for this resource configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option that will be effected by change.
|
* @param option The option that will be effected by change.
|
||||||
* @param value The value to apply to the option.
|
* @param value The value to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String value)
|
public IOption setOption(IHoldsOptions parent, IOption option, String value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of a list option for this resource configuration.
|
* Sets the value of a list option for this resource configuration.
|
||||||
*
|
*
|
||||||
* @param tool The Tool parent of the option.
|
* @param parent The holder/parent of the option.
|
||||||
* @param option The option to change.
|
* @param option The option to change.
|
||||||
* @param value The values to apply to the option.
|
* @param value The values to apply to the option.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
*
|
*
|
||||||
* @throws BuildException
|
* @throws BuildException
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type of parent has changed from ITool to IHoldsOptions.
|
||||||
|
* Code assuming ITool as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String[] value)
|
public IOption setOption(IHoldsOptions parent, IOption option, String[] value)
|
||||||
throws BuildException;
|
throws BuildException;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
||||||
* A tool will generally process one or more resources to produce output resources.
|
* A tool will generally process one or more resources to produce output resources.
|
||||||
* Most tools have a set of options that can be used to modify the behavior of the tool.
|
* Most tools have a set of options that can be used to modify the behavior of the tool.
|
||||||
*/
|
*/
|
||||||
public interface ITool extends IBuildObject {
|
public interface ITool extends IBuildObject, IHoldsOptions {
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String COMMAND = "command"; //$NON-NLS-1$
|
public static final String COMMAND = "command"; //$NON-NLS-1$
|
||||||
public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$
|
public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$
|
||||||
|
@ -30,9 +30,6 @@ public interface ITool extends IBuildObject {
|
||||||
public static final String DEP_CALC_ID ="dependencyCalculator"; //$NON-NLS-1$
|
public static final String DEP_CALC_ID ="dependencyCalculator"; //$NON-NLS-1$
|
||||||
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
|
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
|
||||||
public static final String NATURE = "natureFilter"; //$NON-NLS-1$
|
public static final String NATURE = "natureFilter"; //$NON-NLS-1$
|
||||||
public static final String OPTION = "option"; //$NON-NLS-1$
|
|
||||||
public static final String OPTION_CAT = "optionCategory"; //$NON-NLS-1$
|
|
||||||
public static final String OPTION_REF = "optionReference"; //$NON-NLS-1$
|
|
||||||
public static final String OUTPUT_FLAG = "outputFlag"; //$NON-NLS-1$
|
public static final String OUTPUT_FLAG = "outputFlag"; //$NON-NLS-1$
|
||||||
public static final String INPUT_TYPE = "inputType"; //$NON-NLS-1$
|
public static final String INPUT_TYPE = "inputType"; //$NON-NLS-1$
|
||||||
public static final String OUTPUT_TYPE = "outputType"; //$NON-NLS-1$
|
public static final String OUTPUT_TYPE = "outputType"; //$NON-NLS-1$
|
||||||
|
@ -60,74 +57,6 @@ public interface ITool extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public IBuildObject getParent();
|
public IBuildObject getParent();
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a child Option for this tool.
|
|
||||||
*
|
|
||||||
* @param Option The superClass, if any
|
|
||||||
* @param String The id for the new option
|
|
||||||
* @param String The name for the new option
|
|
||||||
* @param boolean Indicates whether this is an extension element or a managed project element
|
|
||||||
*
|
|
||||||
* @return IOption
|
|
||||||
*/
|
|
||||||
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes an option from the tool's list.
|
|
||||||
*
|
|
||||||
* @param option
|
|
||||||
*/
|
|
||||||
public void removeOption(IOption option);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a deprecated method for retrieving an <code>IOption</code> from
|
|
||||||
* the receiver based on an ID. It is preferred that you use the newer method
|
|
||||||
* <code>getOptionById</code>
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOptionById(java.lang.String)
|
|
||||||
*
|
|
||||||
* @param id unique identifier of the option to search for
|
|
||||||
* @return <code>IOption</code>
|
|
||||||
*/
|
|
||||||
public IOption getOption(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the <code>IOption</code> in the receiver with the specified
|
|
||||||
* ID. This is an efficient search in the receiver.
|
|
||||||
*
|
|
||||||
* <p>If the receiver does not have an option with that ID, the method
|
|
||||||
* returns <code>null</code>. It is the responsibility of the caller to
|
|
||||||
* verify the return value.
|
|
||||||
*
|
|
||||||
* @param id unique identifier of the option to search for
|
|
||||||
* @return <code>IOption</code>
|
|
||||||
* @since 2.0
|
|
||||||
*/
|
|
||||||
public IOption getOptionById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the <code>IOption</code> in the receiver with the specified
|
|
||||||
* ID, or an option with a superclass with this id.
|
|
||||||
*
|
|
||||||
* <p>If the receiver does not have an option with that ID, the method
|
|
||||||
* returns <code>null</code>. It is the responsibility of the caller to
|
|
||||||
* verify the return value.
|
|
||||||
*
|
|
||||||
* @param id unique identifier of the option to search for
|
|
||||||
* @return <code>IOption</code>
|
|
||||||
* @since 3.0
|
|
||||||
*/
|
|
||||||
public IOption getOptionBySuperClassId(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the complete list of options that are available for this tool.
|
|
||||||
* The list is a merging of the options specified for this tool with the
|
|
||||||
* options of its superclasses. The lowest option instance in the hierarchy
|
|
||||||
* takes precedence.
|
|
||||||
*
|
|
||||||
* @return IOption[]
|
|
||||||
*/
|
|
||||||
public IOption[] getOptions();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a child InputType for this tool.
|
* Creates a child InputType for this tool.
|
||||||
*
|
*
|
||||||
|
@ -698,13 +627,6 @@ public interface ITool extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public IOptionCategory getTopOptionCategory();
|
public IOptionCategory getTopOptionCategory();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the option category children of this tool.
|
|
||||||
*
|
|
||||||
* @return IOptionCategory[]
|
|
||||||
*/
|
|
||||||
public IOptionCategory[] getChildCategories();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return <code>true</code> if the receiver builds files with the
|
* Return <code>true</code> if the receiver builds files with the
|
||||||
* specified extension, else <code>false</code>.
|
* specified extension, else <code>false</code>.
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
|
||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public interface IToolChain extends IBuildObject {
|
public interface IToolChain extends IBuildObject, IHoldsOptions {
|
||||||
public static final String TOOL_CHAIN_ELEMENT_NAME = "toolChain"; //$NON-NLS-1$
|
public static final String TOOL_CHAIN_ELEMENT_NAME = "toolChain"; //$NON-NLS-1$
|
||||||
public static final String OS_LIST = "osList"; //$NON-NLS-1$
|
public static final String OS_LIST = "osList"; //$NON-NLS-1$
|
||||||
public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
|
public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -77,6 +78,7 @@ 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.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
|
@ -88,6 +90,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.osgi.framework.Bundle;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -114,6 +117,14 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
private static final String MANIFEST_ERROR_HEADER = "ManagedBuildManager.error.manifest.header"; //$NON-NLS-1$
|
private static final String MANIFEST_ERROR_HEADER = "ManagedBuildManager.error.manifest.header"; //$NON-NLS-1$
|
||||||
public static final String MANIFEST_ERROR_RESOLVING = "ManagedBuildManager.error.manifest.resolving"; //$NON-NLS-1$
|
public static final String MANIFEST_ERROR_RESOLVING = "ManagedBuildManager.error.manifest.resolving"; //$NON-NLS-1$
|
||||||
public static final String MANIFEST_ERROR_DUPLICATE = "ManagedBuildManager.error.manifest.duplicate"; //$NON-NLS-1$
|
public static final String MANIFEST_ERROR_DUPLICATE = "ManagedBuildManager.error.manifest.duplicate"; //$NON-NLS-1$
|
||||||
|
public static final String MANIFEST_ERROR_ICON = "ManagedBuildManager.error.manifest.icon"; //$NON-NLS-1$
|
||||||
|
private static final String MANIFEST_ERROR_OPTION_CATEGORY = "ManagedBuildManager.error.manifest.option.category"; //$NON-NLS-1$
|
||||||
|
private static final String MANIFEST_ERROR_OPTION_FILTER = "ManagedBuildManager.error.manifest.option.filter"; //$NON-NLS-1$
|
||||||
|
private static final String MANIFEST_ERROR_OPTION_VALUEHANDLER = "ManagedBuildManager.error.manifest.option.valuehandler"; //$NON-NLS-1$
|
||||||
|
// Error ID's for OptionValidError()
|
||||||
|
public static final int ERROR_CATEGORY = 0;
|
||||||
|
public static final int ERROR_FILTER = 1;
|
||||||
|
|
||||||
private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
|
private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||||
|
|
||||||
// This is the version of the manifest and project files
|
// This is the version of the manifest and project files
|
||||||
|
@ -707,19 +718,24 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the string value for an option for a given config.
|
* Set the boolean value for an option for a given config.
|
||||||
*
|
*
|
||||||
* @param config The configuration the option belongs to.
|
* @param config The configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
* @param option The option to set the value for.
|
* @param option The option to set the value for.
|
||||||
* @param value The boolean that the option should contain after the change.
|
* @param value The boolean that the option should contain after the change.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public static IOption setOption(IConfiguration config, ITool tool, IOption option, boolean value) {
|
public static IOption setOption(IConfiguration config, IHoldsOptions holder, IOption option, boolean value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
// Request a value change and set dirty if real change results
|
// Request a value change and set dirty if real change results
|
||||||
retOpt = config.setOption(tool, option, value);
|
retOpt = config.setOption(holder, option, value);
|
||||||
notifyListeners(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -727,11 +743,25 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return retOpt;
|
return retOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, boolean value) {
|
/**
|
||||||
|
* Set the boolean value for an option for a given config.
|
||||||
|
*
|
||||||
|
* @param resConfig The resource configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
|
* @param option The option to set the value for.
|
||||||
|
* @param value The boolean that the option should contain after the change.
|
||||||
|
*
|
||||||
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
|
*/
|
||||||
|
public static IOption setOption(IResourceConfiguration resConfig, IHoldsOptions holder, IOption option, boolean value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
// Request a value change and set dirty if real change results
|
// Request a value change and set dirty if real change results
|
||||||
retOpt = resConfig.setOption(tool, option, value);
|
retOpt = resConfig.setOption(holder, option, value);
|
||||||
notifyListeners(resConfig, option);
|
notifyListeners(resConfig, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -742,15 +772,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* Set the string value for an option for a given config.
|
* Set the string value for an option for a given config.
|
||||||
*
|
*
|
||||||
* @param config The configuration the option belongs to.
|
* @param config The configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
* @param option The option to set the value for.
|
* @param option The option to set the value for.
|
||||||
* @param value The value that the option should contain after the change.
|
* @param value The value that the option should contain after the change.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public static IOption setOption(IConfiguration config, ITool tool, IOption option, String value) {
|
public static IOption setOption(IConfiguration config, IHoldsOptions holder, IOption option, String value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
retOpt = config.setOption(tool, option, value);
|
retOpt = config.setOption(holder, option, value);
|
||||||
notifyListeners(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -762,15 +797,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* Set the string value for an option for a given resource config.
|
* Set the string value for an option for a given resource config.
|
||||||
*
|
*
|
||||||
* @param resConfig The resource configuration the option belongs to.
|
* @param resConfig The resource configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
* @param option The option to set the value for.
|
* @param option The option to set the value for.
|
||||||
* @param value The value that the option should contain after the change.
|
* @param value The value that the option should contain after the change.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, String value) {
|
public static IOption setOption(IResourceConfiguration resConfig, IHoldsOptions holder, IOption option, String value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
retOpt = resConfig.setOption(tool, option, value);
|
retOpt = resConfig.setOption(holder, option, value);
|
||||||
notifyListeners(resConfig, option);
|
notifyListeners(resConfig, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -781,15 +821,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* Set the string array value for an option for a given config.
|
* Set the string array value for an option for a given config.
|
||||||
*
|
*
|
||||||
* @param config The configuration the option belongs to.
|
* @param config The configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
* @param option The option to set the value for.
|
* @param option The option to set the value for.
|
||||||
* @param value The values the option should contain after the change.
|
* @param value The values the option should contain after the change.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public static IOption setOption(IConfiguration config, ITool tool, IOption option, String[] value) {
|
public static IOption setOption(IConfiguration config, IHoldsOptions holder, IOption option, String[] value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
retOpt = config.setOption(tool, option, value);
|
retOpt = config.setOption(holder, option, value);
|
||||||
notifyListeners(config, option);
|
notifyListeners(config, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -801,15 +846,20 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
* Set the string array value for an option for a given resource config.
|
* Set the string array value for an option for a given resource config.
|
||||||
*
|
*
|
||||||
* @param resConfig The resource configuration the option belongs to.
|
* @param resConfig The resource configuration the option belongs to.
|
||||||
|
* @param holder The holder/parent of the option.
|
||||||
* @param option The option to set the value for.
|
* @param option The option to set the value for.
|
||||||
* @param value The values the option should contain after the change.
|
* @param value The values the option should contain after the change.
|
||||||
*
|
*
|
||||||
* @return IOption The modified option. This can be the same option or a newly created option.
|
* @return IOption The modified option. This can be the same option or a newly created option.
|
||||||
|
*
|
||||||
|
* @since 3.0 - The type and name of the <code>ITool tool</code> parameter
|
||||||
|
* has changed to <code>IHoldsOptions holder</code>. Client code
|
||||||
|
* assuming <code>ITool</code> as type, will continue to work unchanged.
|
||||||
*/
|
*/
|
||||||
public static IOption setOption(IResourceConfiguration resConfig, ITool tool, IOption option, String[] value) {
|
public static IOption setOption(IResourceConfiguration resConfig, IHoldsOptions holder, IOption option, String[] value) {
|
||||||
IOption retOpt;
|
IOption retOpt;
|
||||||
try {
|
try {
|
||||||
retOpt = resConfig.setOption(tool, option, value);
|
retOpt = resConfig.setOption(holder, option, value);
|
||||||
notifyListeners(resConfig, option);
|
notifyListeners(resConfig, option);
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1340,6 +1390,11 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
throw new Exception(ManagedMakeMessages.getFormattedString("ManagedBuildManager.error.id.nomatch", project.getName())); //$NON-NLS-1$
|
throw new Exception(ManagedMakeMessages.getFormattedString("ManagedBuildManager.error.id.nomatch", project.getName())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
project.setSessionProperty(buildInfoProperty, buildInfo);
|
project.setSessionProperty(buildInfoProperty, buildInfo);
|
||||||
|
IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
|
||||||
|
// Send an event to each configuration and if they exist, its resource configurations
|
||||||
|
for (int i=0; i < configs.length; ++i) {
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_OPEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1421,8 +1476,8 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the value of 'ManagedBuilRevision' attribute
|
// Get the value of 'ManagedBuildRevision' attribute
|
||||||
loadConfigElements(DefaultManagedConfigElement.convertArray(elements), revision);
|
loadConfigElements(DefaultManagedConfigElement.convertArray(elements, extension), revision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Then call resolve.
|
// Then call resolve.
|
||||||
|
@ -1567,7 +1622,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
// If the "fileVersion" attribute is missing, then default revision is "1.2.0"
|
// If the "fileVersion" attribute is missing, then default revision is "1.2.0"
|
||||||
if (revision == null)
|
if (revision == null)
|
||||||
revision = "1.2.0"; //$NON-NLS-1$
|
revision = "1.2.0"; //$NON-NLS-1$
|
||||||
loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements), revision);
|
loadConfigElementsV2(DefaultManagedConfigElement.convertArray(elements, extension), revision);
|
||||||
}
|
}
|
||||||
// Resolve references
|
// Resolve references
|
||||||
Iterator targetIter = getExtensionTargetMap().values().iterator();
|
Iterator targetIter = getExtensionTargetMap().values().iterator();
|
||||||
|
@ -1937,6 +1992,57 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return buildInfoVersion;
|
return buildInfoVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full URL for a path that is relative to the plug-in
|
||||||
|
* in which .buildDefinitions are defined
|
||||||
|
*
|
||||||
|
* @return the full URL for a path relative to the .buildDefinitions
|
||||||
|
* plugin
|
||||||
|
*/
|
||||||
|
public static URL getURLInBuildDefinitions(DefaultManagedConfigElement element, IPath path) {
|
||||||
|
|
||||||
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
|
||||||
|
if( extensionPoint != null) {
|
||||||
|
IExtension[] extensions = extensionPoint.getExtensions();
|
||||||
|
if (extensions != null) {
|
||||||
|
|
||||||
|
// Iterate over all extensions that contribute to .buildDefinitions
|
||||||
|
for (int i = 0; i < extensions.length; ++i) {
|
||||||
|
IExtension extension = extensions[i];
|
||||||
|
|
||||||
|
// Determine whether the configuration element that is
|
||||||
|
// associated with the path, is valid for the extension that
|
||||||
|
// we are currently processing.
|
||||||
|
//
|
||||||
|
// Note: If not done, icon file names would have to be unique
|
||||||
|
// across several plug-ins.
|
||||||
|
if (element.getExtension().getExtensionPointUniqueIdentifier()
|
||||||
|
== extension.getExtensionPointUniqueIdentifier())
|
||||||
|
{
|
||||||
|
// Get the path-name
|
||||||
|
Bundle bundle = Platform.getBundle( extension.getNamespace() );
|
||||||
|
URL url = Platform.find(bundle, path);
|
||||||
|
if ( url != null )
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return Platform.asLocalURL(url);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Ignore the exception
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Print a warning
|
||||||
|
OutputIconError(path.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -2032,6 +2138,29 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
|
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void OptionValidError(int errorId, String id) {
|
||||||
|
String[] msgs = new String[1];
|
||||||
|
msgs[0] = id;
|
||||||
|
switch (errorId) {
|
||||||
|
case ERROR_CATEGORY:
|
||||||
|
ManagedBuildManager.OutputManifestError(
|
||||||
|
ManagedMakeMessages.getFormattedString(ManagedBuildManager.MANIFEST_ERROR_OPTION_CATEGORY, msgs));
|
||||||
|
break;
|
||||||
|
case ERROR_FILTER:
|
||||||
|
ManagedBuildManager.OutputManifestError(
|
||||||
|
ManagedMakeMessages.getFormattedString(ManagedBuildManager.MANIFEST_ERROR_OPTION_FILTER, msgs));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OptionValueHandlerError(String attribute, String id) {
|
||||||
|
String[] msgs = new String[2];
|
||||||
|
msgs[0] = attribute;
|
||||||
|
msgs[1] = id;
|
||||||
|
ManagedBuildManager.OutputManifestError(
|
||||||
|
ManagedMakeMessages.getFormattedString(ManagedBuildManager.MANIFEST_ERROR_OPTION_VALUEHANDLER, msgs));
|
||||||
|
}
|
||||||
|
|
||||||
public static void OutputResolveError(String attribute, String lookupId, String type, String id) {
|
public static void OutputResolveError(String attribute, String lookupId, String type, String id) {
|
||||||
String[] msgs = new String[4];
|
String[] msgs = new String[4];
|
||||||
msgs[0] = attribute;
|
msgs[0] = attribute;
|
||||||
|
@ -2054,6 +2183,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
System.err.println(ManagedMakeMessages.getResourceString(MANIFEST_ERROR_HEADER) + message + NEWLINE);
|
System.err.println(ManagedMakeMessages.getResourceString(MANIFEST_ERROR_HEADER) + message + NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void OutputIconError(String iconLocation) {
|
||||||
|
String[] msgs = new String[1];
|
||||||
|
msgs[0]= iconLocation;
|
||||||
|
ManagedBuildManager.OutputManifestError(
|
||||||
|
ManagedMakeMessages.getFormattedString(ManagedBuildManager.MANIFEST_ERROR_ICON, msgs));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the instance of the Environment Variable Provider
|
* Returns the instance of the Environment Variable Provider
|
||||||
*
|
*
|
||||||
|
@ -2119,4 +2255,123 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static IBuildMacroProvider getBuildMacroProvider(){
|
public static IBuildMacroProvider getBuildMacroProvider(){
|
||||||
return BuildMacroProvider.getDefault();
|
return BuildMacroProvider.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send event to value handlers of relevant configuration including
|
||||||
|
* all its child resource configurations, if they exist.
|
||||||
|
*
|
||||||
|
* @param IConfiguration configuration for which to send the event
|
||||||
|
* @param event to be sent
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public static void performValueHandlerEvent(IConfiguration config, int event) {
|
||||||
|
performValueHandlerEvent(config, event, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send event to value handlers of relevant configuration.
|
||||||
|
*
|
||||||
|
* @param IConfiguration configuration for which to send the event
|
||||||
|
* @param event to be sent
|
||||||
|
* @param doChildren - if true, also perform the event for all
|
||||||
|
* resource configurations that are children if this configuration.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public static void performValueHandlerEvent(IConfiguration config, int event, boolean doChildren) {
|
||||||
|
|
||||||
|
IToolChain toolChain = config.getToolChain();
|
||||||
|
if (toolChain == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IOption[] options = toolChain.getOptions();
|
||||||
|
// Get global options directly under Toolchain (not associated with a particular tool)
|
||||||
|
// This has to be sent to all the Options associated with this configuration.
|
||||||
|
for (int i = 0; i < options.length; ++i) {
|
||||||
|
// Ignore invalid options
|
||||||
|
if (options[i].isValid()) {
|
||||||
|
// Call the handler
|
||||||
|
if (options[i].getValueHandler().handleValue(
|
||||||
|
config,
|
||||||
|
options[i].getOptionHolder(),
|
||||||
|
options[i],
|
||||||
|
options[i].getValueHandlerExtraArgument(),
|
||||||
|
event)) {
|
||||||
|
// TODO : Event is handled successfully and returned true.
|
||||||
|
// May need to do something here say logging a message.
|
||||||
|
} else {
|
||||||
|
// Event handling Failed.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get options associated with tools under toolChain
|
||||||
|
ITool[] tools = toolChain.getTools();
|
||||||
|
for (int i = 0; i < tools.length; ++i) {
|
||||||
|
IOption[] toolOptions = tools[i].getOptions();
|
||||||
|
for (int j = 0; j < toolOptions.length; ++j) {
|
||||||
|
// Ignore invalid options
|
||||||
|
if (toolOptions[j].isValid()) {
|
||||||
|
// Call the handler
|
||||||
|
if (toolOptions[j].getValueHandler().handleValue(
|
||||||
|
config,
|
||||||
|
toolOptions[j].getOptionHolder(),
|
||||||
|
toolOptions[j],
|
||||||
|
toolOptions[j].getValueHandlerExtraArgument(),
|
||||||
|
event)) {
|
||||||
|
// TODO : Event is handled successfully and returned true.
|
||||||
|
// May need to do something here say logging a message.
|
||||||
|
} else {
|
||||||
|
// Event handling Failed.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call backs for Resource Configurations associated with this config.
|
||||||
|
if (doChildren == true) {
|
||||||
|
IResourceConfiguration[] resConfigs = config.getResourceConfigurations();
|
||||||
|
for (int j=0; j < resConfigs.length; ++j) {
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(resConfigs[j], event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send event to value handlers of relevant configuration.
|
||||||
|
*
|
||||||
|
* @param IResourceConfiguration configuration for which to send the event
|
||||||
|
* @param event to be sent
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public static void performValueHandlerEvent(IResourceConfiguration config, int event) {
|
||||||
|
|
||||||
|
// Note: Resource configurations have no toolchain options
|
||||||
|
|
||||||
|
// Get options associated with the resource configuration
|
||||||
|
ITool[] tools = config.getTools();
|
||||||
|
for (int i = 0; i < tools.length; ++i) {
|
||||||
|
IOption[] toolOptions = tools[i].getOptions();
|
||||||
|
for (int j = 0; j < toolOptions.length; ++j) {
|
||||||
|
// Ignore invalid options
|
||||||
|
if (toolOptions[j].isValid()) {
|
||||||
|
// Call the handler
|
||||||
|
if (toolOptions[j].getValueHandler().handleValue(
|
||||||
|
config,
|
||||||
|
toolOptions[j].getOptionHolder(),
|
||||||
|
toolOptions[j],
|
||||||
|
toolOptions[j].getValueHandlerExtraArgument(),
|
||||||
|
event)) {
|
||||||
|
// TODO : Event is handled successfully and returned true.
|
||||||
|
// May need to do something here say logging a message.
|
||||||
|
} else {
|
||||||
|
// Event handling Failed.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2005 Symbian Ltd and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Symbian Ltd - Initial API and implementation
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class implements the default managed option value handler for MBS.
|
||||||
|
* It is also be intended to be used as a base class for other value handlers.
|
||||||
|
*/
|
||||||
|
public class ManagedOptionValueHandler implements
|
||||||
|
IManagedOptionValueHandler {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* E N A B L E U S E A S B A S E C L A S S A N D
|
||||||
|
* D E F A U L T I M P L E M E N T A T I O N
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static ManagedOptionValueHandler mbsValueHandler;
|
||||||
|
|
||||||
|
protected ManagedOptionValueHandler() {
|
||||||
|
mbsValueHandler = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ManagedOptionValueHandler getManagedOptionValueHandler() {
|
||||||
|
if( mbsValueHandler == null ) {
|
||||||
|
mbsValueHandler = new ManagedOptionValueHandler();
|
||||||
|
}
|
||||||
|
return mbsValueHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* D E F A U L T I M P L E M E N T A T I O N S O F I N T E R F A C E
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#handleValue(IConfiguration,IToolChain,IOption,String,int)
|
||||||
|
*/
|
||||||
|
public boolean handleValue(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option,
|
||||||
|
String extraArgument, int event)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
// The following is for debug purposes and thus normally commented out
|
||||||
|
String configLabel = "???"; //$NON-NLS-1$
|
||||||
|
String holderLabel = "???"; //$NON-NLS-1$
|
||||||
|
String eventLabel = "???"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (configuration instanceof IConfiguration) {
|
||||||
|
configLabel = "IConfiguration"; //$NON-NLS-1$
|
||||||
|
} else if (configuration instanceof IResourceConfiguration) {
|
||||||
|
configLabel = "IResourceConfiguration"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
if (holder instanceof IToolChain) {
|
||||||
|
holderLabel = "IToolChain"; //$NON-NLS-1$
|
||||||
|
} else if (holder instanceof ITool) {
|
||||||
|
holderLabel = "ITool"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case EVENT_OPEN: eventLabel = "EVENT_OPEN"; break; //$NON-NLS-1$
|
||||||
|
case EVENT_APPLY: eventLabel = "EVENT_APPLY"; break; //$NON-NLS-1$
|
||||||
|
case EVENT_SETDEFAULT: eventLabel = "EVENT_SETDEFAULT"; break; //$NON-NLS-1$
|
||||||
|
case EVENT_CLOSE: eventLabel = "EVENT_CLOSE"; break; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the event
|
||||||
|
System.out.println(eventLabel + "(" + //$NON-NLS-1$
|
||||||
|
configLabel + " = " + //$NON-NLS-1$
|
||||||
|
configuration.getId() + ", " + //$NON-NLS-1$
|
||||||
|
holderLabel + " = " + //$NON-NLS-1$
|
||||||
|
holder.getId() + ", " + //$NON-NLS-1$
|
||||||
|
"IOption = " + //$NON-NLS-1$
|
||||||
|
option.getId() + ", " + //$NON-NLS-1$
|
||||||
|
"String = " + //$NON-NLS-1$
|
||||||
|
extraArgument + ")"); //$NON-NLS-1$
|
||||||
|
*/
|
||||||
|
// The event was not handled, thus return false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#isDefaultValue(IConfiguration,IToolChain,IOption,String)
|
||||||
|
*/
|
||||||
|
public boolean isDefaultValue(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option, String extraArgument) {
|
||||||
|
// Implement default behavior
|
||||||
|
if (option.getDefaultValue() == option.getValue()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#isEnumValueAppropriate(IConfiguration,IToolChain,IOption,String,String)
|
||||||
|
*/
|
||||||
|
public boolean isEnumValueAppropriate(IBuildObject configuration,
|
||||||
|
IHoldsOptions holder,
|
||||||
|
IOption option,
|
||||||
|
String extraArgument, String enumValue)
|
||||||
|
{
|
||||||
|
// By default return true for all the enum values.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,9 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
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.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
|
@ -218,9 +220,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
* @param managedProject The <code>ManagedProject</code> the configuration will be added to.
|
* @param managedProject The <code>ManagedProject</code> the configuration will be added to.
|
||||||
* @param cloneConfig The <code>IConfiguration</code> to copy the settings from.
|
* @param cloneConfig The <code>IConfiguration</code> to copy the settings from.
|
||||||
* @param id A unique ID for the new configuration.
|
* @param id A unique ID for the new configuration.
|
||||||
* @param cloneTools If <code>true</code>, the configuration's tools are cloned
|
* @param cloneChildren If <code>true</code>, the configuration's tools are cloned
|
||||||
*/
|
*/
|
||||||
public Configuration(ManagedProject managedProject, Configuration cloneConfig, String id, boolean cloneTools) {
|
public Configuration(ManagedProject managedProject, Configuration cloneConfig, String id, boolean cloneChildren) {
|
||||||
setId(id);
|
setId(id);
|
||||||
setName(cloneConfig.getName());
|
setName(cloneConfig.getName());
|
||||||
this.managedProject = managedProject;
|
this.managedProject = managedProject;
|
||||||
|
@ -282,7 +284,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
subId = tmpId + "." + nnn; //$NON-NLS-1$
|
subId = tmpId + "." + nnn; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cloneTools) {
|
if (cloneChildren) {
|
||||||
toolChain = new ToolChain(this, subId, subName, (ToolChain)cloneConfig.getToolChain());
|
toolChain = new ToolChain(this, subId, subName, (ToolChain)cloneConfig.getToolChain());
|
||||||
} else {
|
} else {
|
||||||
// Add a tool-chain element that specifies as its superClass the
|
// Add a tool-chain element that specifies as its superClass the
|
||||||
|
@ -297,6 +299,12 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
}
|
}
|
||||||
IToolChain newChain = createToolChain(superChain, subId, superChain.getName(), false);
|
IToolChain newChain = createToolChain(superChain, subId, superChain.getName(), false);
|
||||||
|
|
||||||
|
// For each option/option category child of the tool-chain that is
|
||||||
|
// the child of the selected configuration element, create an option/
|
||||||
|
// option category child of the cloned configuration's tool-chain element
|
||||||
|
// that specifies the original tool element as its superClass.
|
||||||
|
newChain.createOptions(superChain);
|
||||||
|
|
||||||
// For each tool element child of the tool-chain that is the child of
|
// For each tool element child of the tool-chain that is the child of
|
||||||
// the selected configuration element, create a tool element child of
|
// the selected configuration element, create a tool element child of
|
||||||
// the cloned configuration's tool-chain element that specifies the
|
// the cloned configuration's tool-chain element that specifies the
|
||||||
|
@ -691,7 +699,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, boolean value) throws BuildException {
|
public IOption setOption(IHoldsOptions holder, IOption option, boolean value) throws BuildException {
|
||||||
// Is there a change?
|
// Is there a change?
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
if (option.getBooleanValue() != value) {
|
if (option.getBooleanValue() != value) {
|
||||||
|
@ -709,7 +717,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -724,7 +732,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String value) throws BuildException {
|
public IOption setOption(IHoldsOptions holder, IOption option, String value) throws BuildException {
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
String oldValue;
|
String oldValue;
|
||||||
oldValue = option.getStringValue();
|
oldValue = option.getStringValue();
|
||||||
|
@ -743,7 +751,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -758,7 +766,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String[] value) throws BuildException {
|
public IOption setOption(IHoldsOptions holder, IOption option, String[] value) throws BuildException {
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
// Is there a change?
|
// Is there a change?
|
||||||
String[] oldValue;
|
String[] oldValue;
|
||||||
|
@ -797,7 +805,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -1344,13 +1352,25 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
public void reset() {
|
public void reset() {
|
||||||
// We just need to remove all Options
|
// We just need to remove all Options
|
||||||
ITool[] tools = getTools();
|
ITool[] tools = getTools();
|
||||||
|
IToolChain toolChain = getToolChain();
|
||||||
|
IOption[] opts;
|
||||||
|
|
||||||
|
// Send out the event to notify the options that they are about to be removed.
|
||||||
|
// Do not do this for the child resource configurations as they are handled when
|
||||||
|
// the configuration itself is destroyed.
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE, false);
|
||||||
|
// Remove the configurations
|
||||||
for (int i = 0; i < tools.length; i++) {
|
for (int i = 0; i < tools.length; i++) {
|
||||||
ITool tool = tools[i];
|
ITool tool = tools[i];
|
||||||
IOption[] opts = tool.getOptions();
|
opts = tool.getOptions();
|
||||||
for (int j = 0; j < opts.length; j++) {
|
for (int j = 0; j < opts.length; j++) {
|
||||||
tool.removeOption(opts[j]);
|
tool.removeOption(opts[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
opts = toolChain.getOptions();
|
||||||
|
for (int j = 0; j < opts.length; j++) {
|
||||||
|
toolChain.removeOption(opts[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1378,6 +1398,8 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
|
|
||||||
// Add this resource to the list.
|
// Add this resource to the list.
|
||||||
addResourceConfiguration(resConfig);
|
addResourceConfiguration(resConfig);
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(resConfig, IManagedOptionValueHandler.EVENT_OPEN);
|
||||||
|
|
||||||
return resConfig;
|
return resConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1419,5 +1441,4 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2003,2004 IBM Rational Software and others.
|
* Copyright (c) 2003,2005 IBM Rational Software and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -268,10 +268,12 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 {
|
||||||
return answer.createOptionReference(option);
|
return answer.createOptionReference(option);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Find out if a tool reference already exists
|
// Find out if a tool reference already exists.
|
||||||
searchRef = (ToolReference) getToolReference(option.getParent());
|
// Note: as in MBS 2.0 the ITool == IHoldsOptions was always
|
||||||
|
// true, just up-cast the pointers.
|
||||||
|
searchRef = (ToolReference) getToolReference((ITool)option.getOptionHolder());
|
||||||
if (searchRef == null) {
|
if (searchRef == null) {
|
||||||
answer = new ToolReference(this, option.getParent());
|
answer = new ToolReference(this, (ITool)option.getOptionHolder());
|
||||||
} else {
|
} else {
|
||||||
// The reference may belong to the target
|
// The reference may belong to the target
|
||||||
if (!searchRef.ownedByConfiguration(this)) {
|
if (!searchRef.ownedByConfiguration(this)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2004 TimeSys Corporation and others.
|
* Copyright (c) 2004, 2005 TimeSys Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the ManagedConfigElement by delegate all calls to an
|
* Implements the ManagedConfigElement by delegate all calls to an
|
||||||
|
@ -21,12 +22,14 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
public class DefaultManagedConfigElement implements IManagedConfigElement {
|
public class DefaultManagedConfigElement implements IManagedConfigElement {
|
||||||
|
|
||||||
private IConfigurationElement element;
|
private IConfigurationElement element;
|
||||||
|
private IExtension extension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
public DefaultManagedConfigElement(IConfigurationElement element) {
|
public DefaultManagedConfigElement(IConfigurationElement element, IExtension extension) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
|
this.extension = extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -47,14 +50,21 @@ public class DefaultManagedConfigElement implements IManagedConfigElement {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren()
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren()
|
||||||
*/
|
*/
|
||||||
public IManagedConfigElement[] getChildren() {
|
public IManagedConfigElement[] getChildren() {
|
||||||
return convertArray(element.getChildren());
|
return convertArray(element.getChildren(), extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public IManagedConfigElement[] getChildren(String elementName) {
|
public IManagedConfigElement[] getChildren(String elementName) {
|
||||||
return convertArray(element.getChildren(elementName));
|
return convertArray(element.getChildren(elementName), extension);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getExtension(java.lang.String)
|
||||||
|
*/
|
||||||
|
public IExtension getExtension() {
|
||||||
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +79,12 @@ public class DefaultManagedConfigElement implements IManagedConfigElement {
|
||||||
* into an array of IManagedConfigElements.
|
* into an array of IManagedConfigElements.
|
||||||
*/
|
*/
|
||||||
public static IManagedConfigElement[] convertArray(
|
public static IManagedConfigElement[] convertArray(
|
||||||
IConfigurationElement[] elements) {
|
IConfigurationElement[] elements,
|
||||||
|
IExtension extension) {
|
||||||
|
|
||||||
IManagedConfigElement[] ret = new IManagedConfigElement[elements.length];
|
IManagedConfigElement[] ret = new IManagedConfigElement[elements.length];
|
||||||
for (int i = 0; i < elements.length; i++) {
|
for (int i = 0; i < elements.length; i++) {
|
||||||
ret[i] = new DefaultManagedConfigElement(elements[i]);
|
ret[i] = new DefaultManagedConfigElement(elements[i], extension);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,507 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2005 Symbian Ltd and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Symbian Ltd - Initial API and implementation
|
||||||
|
**********************************************************************/
|
||||||
|
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.core.Option;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the functionality that is needed to hold options and option
|
||||||
|
* categories. In CDT 3.0, the functionality has been moved from ITool and
|
||||||
|
* Tool to this class.
|
||||||
|
*
|
||||||
|
* This class is intended to be used as base class for all MBS grammar
|
||||||
|
* elements that can hold Options and Option Categories. These are currently
|
||||||
|
* Tool and ToolChain.
|
||||||
|
*
|
||||||
|
* Note that the member <code>superClass</code> must be shared with the
|
||||||
|
* derived class. This requires to wrap this member by access functions
|
||||||
|
* in the derived class or frequent casts, because the type of <code>superClass</code>
|
||||||
|
* in <code>HoldsOptions</code> must be <code>IHoldOptions</code>. Further
|
||||||
|
* note that the member <code>resolved</code> must inherit the value of its
|
||||||
|
* derived class. This achieved through the constructor.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public class HoldsOptions extends BuildObject implements IHoldsOptions {
|
||||||
|
|
||||||
|
private static final IOptionCategory[] EMPTY_CATEGORIES = new IOptionCategory[0];
|
||||||
|
|
||||||
|
// Members that are to be shared with the derived class
|
||||||
|
protected IHoldsOptions superClass;
|
||||||
|
// Members that must have the same values on creation as the derived class
|
||||||
|
private boolean resolved;
|
||||||
|
// Parent and children
|
||||||
|
private Vector categoryIds;
|
||||||
|
private Map categoryMap;
|
||||||
|
private List childOptionCategories;
|
||||||
|
private Vector optionList;
|
||||||
|
private Map optionMap;
|
||||||
|
// Miscellaneous
|
||||||
|
private boolean isDirty = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C O N S T R U C T O R S
|
||||||
|
*/
|
||||||
|
|
||||||
|
private HoldsOptions() {
|
||||||
|
// prevent accidental construction of class without setting up
|
||||||
|
// resolved
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HoldsOptions(boolean resolved) {
|
||||||
|
this.resolved = resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies children of <code>HoldsOptions</code>. Helper function for
|
||||||
|
* derived constructors.
|
||||||
|
*
|
||||||
|
* @param source The children of the source will be cloned and added
|
||||||
|
* to the class itself.
|
||||||
|
*/
|
||||||
|
protected void copyChildren(HoldsOptions source) {
|
||||||
|
|
||||||
|
// Note: This function ignores OptionCategories since they should not be
|
||||||
|
// found on an non-extension tools
|
||||||
|
if (source.optionList != null) {
|
||||||
|
Iterator iter = source.getOptionList().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Option option = (Option) iter.next();
|
||||||
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
|
String subId;
|
||||||
|
String subName;
|
||||||
|
if (option.getSuperClass() != null) {
|
||||||
|
subId = option.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
|
||||||
|
subName = option.getSuperClass().getName();
|
||||||
|
} else {
|
||||||
|
subId = option.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
|
subName = option.getName();
|
||||||
|
}
|
||||||
|
Option newOption = new Option(this, subId, subName, option);
|
||||||
|
addOption(newOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load child element from XML element if it is of the correct type
|
||||||
|
*
|
||||||
|
* @param element which is loaded as child only iff it is of the correct type
|
||||||
|
* @return true when a child has been loaded, false otherwise
|
||||||
|
*/
|
||||||
|
protected boolean loadChild(Node element) {
|
||||||
|
if (element.getNodeName().equals(ITool.OPTION)) {
|
||||||
|
Option option = new Option(this, (Element)element);
|
||||||
|
addOption(option);
|
||||||
|
return true;
|
||||||
|
} else if (element.getNodeName().equals(ITool.OPTION_CAT)) {
|
||||||
|
new OptionCategory(this, (Element)element);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load child element from configuration element if it is of the correct type
|
||||||
|
*
|
||||||
|
* @param element which is loaded as child only iff it is of the correct type
|
||||||
|
* @return true when a child has been loaded, false otherwise
|
||||||
|
*/
|
||||||
|
protected boolean loadChild(IManagedConfigElement element) {
|
||||||
|
if (element.getName().equals(ITool.OPTION)) {
|
||||||
|
Option option = new Option(this, element);
|
||||||
|
addOption(option);
|
||||||
|
return true;
|
||||||
|
} else if (element.getName().equals(ITool.OPTION_CAT)) {
|
||||||
|
new OptionCategory(this, element);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persist the tool to the project file. Intended to be called by derived
|
||||||
|
* class only, thus do not handle exceptions.
|
||||||
|
*
|
||||||
|
* @param doc
|
||||||
|
* @param element
|
||||||
|
* @throws BuildException
|
||||||
|
*/
|
||||||
|
protected void serialize(Document doc, Element element) throws BuildException {
|
||||||
|
|
||||||
|
Iterator iter;
|
||||||
|
|
||||||
|
if (childOptionCategories != null) {
|
||||||
|
iter = childOptionCategories.listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
OptionCategory optCat = (OptionCategory)iter.next();
|
||||||
|
Element optCatElement = doc.createElement(OPTION);
|
||||||
|
element.appendChild(optCatElement);
|
||||||
|
optCat.serialize(doc, optCatElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List optionElements = getOptionList();
|
||||||
|
iter = optionElements.listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Option option = (Option) iter.next();
|
||||||
|
Element optionElement = doc.createElement(OPTION);
|
||||||
|
element.appendChild(optionElement);
|
||||||
|
option.serialize(doc, optionElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* M E T H O D S M O V E D F R O M I T O O L I N 3 . 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#createOption(IOption, String, String, boolean)
|
||||||
|
*/
|
||||||
|
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement) {
|
||||||
|
Option option = new Option(this, superClass, Id, name, isExtensionElement);
|
||||||
|
addOption(option);
|
||||||
|
setDirty(true);
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#createOptions(IHoldsOptions)
|
||||||
|
*/
|
||||||
|
public void createOptions(IHoldsOptions superClass) {
|
||||||
|
Iterator iter = ((HoldsOptions)superClass).getOptionList().listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Option optionChild = (Option) iter.next();
|
||||||
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
|
String subId = optionChild.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
|
createOption(optionChild, subId, optionChild.getName(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#removeOption(IOption)
|
||||||
|
*/
|
||||||
|
public void removeOption(IOption option) {
|
||||||
|
getOptionList().remove(option);
|
||||||
|
getOptionMap().remove(option.getId());
|
||||||
|
setDirty(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOptions()
|
||||||
|
*/
|
||||||
|
public IOption[] getOptions() {
|
||||||
|
IOption[] options = null;
|
||||||
|
// Merge our options with our superclass' options.
|
||||||
|
if (superClass != null) {
|
||||||
|
options = superClass.getOptions();
|
||||||
|
}
|
||||||
|
// Our options take precedence.
|
||||||
|
Vector ourOpts = getOptionList();
|
||||||
|
if (options != null) {
|
||||||
|
for (int i = 0; i < ourOpts.size(); i++) {
|
||||||
|
IOption ourOpt = (IOption)ourOpts.get(i);
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < options.length; j++) {
|
||||||
|
if (options[j].overridesOnlyValue()) {
|
||||||
|
if (ourOpt.getSuperClass() != null // Remove assumption that ALL options must have superclasses
|
||||||
|
&& ourOpt.getSuperClass().getId().equals(options[j].getSuperClass().getId())) {
|
||||||
|
options[j] = ourOpt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ourOpt.getSuperClass() != null // Remove assumption that ALL options must have superclasses
|
||||||
|
&& ourOpt.getSuperClass().getId().equals(options[j].getId())) {
|
||||||
|
options[j] = ourOpt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No Match? Add it.
|
||||||
|
if (j == options.length) {
|
||||||
|
IOption[] newOptions = new IOption[options.length + 1];
|
||||||
|
for (int k = 0; k < options.length; k++) {
|
||||||
|
newOptions[k] = options[k];
|
||||||
|
}
|
||||||
|
newOptions[j] = ourOpt;
|
||||||
|
options = newOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options = (IOption[])ourOpts.toArray(new IOption[ourOpts.size()]);
|
||||||
|
}
|
||||||
|
// Check for any invalid options.
|
||||||
|
int numInvalidOptions = 0;
|
||||||
|
int i;
|
||||||
|
for (i=0; i < options.length; i++) {
|
||||||
|
if (options[i].isValid() == false) {
|
||||||
|
numInvalidOptions++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Take invalid options out of the array, if there are any
|
||||||
|
if (numInvalidOptions > 0) {
|
||||||
|
int j = 0;
|
||||||
|
IOption[] newOptions = new IOption[options.length - numInvalidOptions];
|
||||||
|
for (i=0; i < options.length; i++) {
|
||||||
|
if (options[i].isValid() == true) {
|
||||||
|
newOptions[j] = options[i];
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options = newOptions;
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOption(java.lang.String)
|
||||||
|
*/
|
||||||
|
public IOption getOption(String id) {
|
||||||
|
return getOptionById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOptionById(java.lang.String)
|
||||||
|
*/
|
||||||
|
public IOption getOptionById(String id) {
|
||||||
|
IOption opt = (IOption)getOptionMap().get(id);
|
||||||
|
if (opt == null) {
|
||||||
|
if (superClass != null) {
|
||||||
|
return superClass.getOptionById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return opt.isValid() ? opt : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOptionBySuperClassId(java.lang.String)
|
||||||
|
*/
|
||||||
|
public IOption getOptionBySuperClassId(String optionId) {
|
||||||
|
if (optionId == null) return null;
|
||||||
|
|
||||||
|
// Look for an option with this ID, or an option with a superclass with this id
|
||||||
|
IOption[] options = getOptions();
|
||||||
|
for (int i = 0; i < options.length; i++) {
|
||||||
|
IOption targetOption = options[i];
|
||||||
|
IOption option = targetOption;
|
||||||
|
do {
|
||||||
|
if (optionId.equals(option.getId())) {
|
||||||
|
return targetOption.isValid() ? targetOption : null;
|
||||||
|
}
|
||||||
|
option = option.getSuperClass();
|
||||||
|
} while (option != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getChildCategories()
|
||||||
|
*/
|
||||||
|
public IOptionCategory[] getChildCategories() {
|
||||||
|
IOptionCategory[] superCats = EMPTY_CATEGORIES;
|
||||||
|
IOptionCategory[] ourCats = EMPTY_CATEGORIES;
|
||||||
|
// Merge our option categories with our superclass' option categories.
|
||||||
|
// Note that these are two disjoint sets of categories because
|
||||||
|
// categories do not use derivation AND object Id's are unique. Thus
|
||||||
|
// they are merely sequentially added.
|
||||||
|
if (superClass != null) {
|
||||||
|
superCats = superClass.getChildCategories();
|
||||||
|
}
|
||||||
|
if ( childOptionCategories != null ) {
|
||||||
|
ourCats = (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
|
||||||
|
}
|
||||||
|
// Add the two arrays together;
|
||||||
|
if (superCats.length > 0 || ourCats.length > 0) {
|
||||||
|
IOptionCategory[] allCats = new IOptionCategory[superCats.length + ourCats.length];
|
||||||
|
int j;
|
||||||
|
for (j=0; j < superCats.length; j++)
|
||||||
|
allCats[j] = superCats[j];
|
||||||
|
for (j=0; j < ourCats.length; j++)
|
||||||
|
allCats[j+superCats.length] = ourCats[j];
|
||||||
|
return allCats;
|
||||||
|
}
|
||||||
|
// Nothing found, return EMPTY_CATEGORIES
|
||||||
|
return EMPTY_CATEGORIES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* M E T H O D S M O V E D F R O M T O O L I N 3 . 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Memory-safe way to access the vector of category IDs
|
||||||
|
*/
|
||||||
|
private Vector getCategoryIds() {
|
||||||
|
if (categoryIds == null) {
|
||||||
|
categoryIds = new Vector();
|
||||||
|
}
|
||||||
|
return categoryIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param category
|
||||||
|
*/
|
||||||
|
public void addChildCategory(IOptionCategory category) {
|
||||||
|
if (childOptionCategories == null)
|
||||||
|
childOptionCategories = new ArrayList();
|
||||||
|
childOptionCategories.add(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param option
|
||||||
|
*/
|
||||||
|
public void addOption(Option option) {
|
||||||
|
getOptionList().add(option);
|
||||||
|
getOptionMap().put(option.getId(), option);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Memeory-safe way to access the map of category IDs to categories
|
||||||
|
*/
|
||||||
|
private Map getCategoryMap() {
|
||||||
|
if (categoryMap == null) {
|
||||||
|
categoryMap = new HashMap();
|
||||||
|
}
|
||||||
|
return categoryMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Memory-safe way to access the list of options
|
||||||
|
*/
|
||||||
|
private Vector getOptionList() {
|
||||||
|
if (optionList == null) {
|
||||||
|
optionList = new Vector();
|
||||||
|
}
|
||||||
|
return optionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Memory-safe way to access the list of IDs to options
|
||||||
|
*/
|
||||||
|
private Map getOptionMap() {
|
||||||
|
if (optionMap == null) {
|
||||||
|
optionMap = new HashMap();
|
||||||
|
}
|
||||||
|
return optionMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* org.eclipse.cdt.managedbuilder.core.IHoldsOptions#addOptionCategory()
|
||||||
|
*/
|
||||||
|
public void addOptionCategory(IOptionCategory category) {
|
||||||
|
// To preserve the order of the categories, record the ids in the order they are read
|
||||||
|
getCategoryIds().add(category.getId());
|
||||||
|
// Map the categories by ID for resolution later
|
||||||
|
getCategoryMap().put(category.getId(), category);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* org.eclipse.cdt.managedbuilder.core.IHoldsOptions#getOptionCategory()
|
||||||
|
*/
|
||||||
|
public IOptionCategory getOptionCategory(String id) {
|
||||||
|
IOptionCategory cat = (IOptionCategory)getCategoryMap().get(id);
|
||||||
|
if (cat == null && superClass != null) {
|
||||||
|
// Look up the holders superclasses to find the category
|
||||||
|
return superClass.getOptionCategory(id);
|
||||||
|
}
|
||||||
|
return cat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* O B J E C T S T A T E M A I N T E N A N C E
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Implements isDirty() for children of HoldsOptions. Intended to be
|
||||||
|
* called by derived class.
|
||||||
|
*/
|
||||||
|
protected boolean isDirty() {
|
||||||
|
// If I need saving, just say yes
|
||||||
|
if (isDirty) return true;
|
||||||
|
|
||||||
|
// Otherwise see if any options need saving
|
||||||
|
List optionElements = getOptionList();
|
||||||
|
Iterator iter = optionElements.listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Option option = (Option) iter.next();
|
||||||
|
if (option.isDirty()) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isDirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Implements setDirty() for children of HoldsOptions. Intended to be
|
||||||
|
* called by derived class.
|
||||||
|
*/
|
||||||
|
protected void setDirty(boolean isDirty) {
|
||||||
|
this.isDirty = isDirty;
|
||||||
|
// Propagate "false" to the children
|
||||||
|
if (!isDirty) {
|
||||||
|
List optionElements = getOptionList();
|
||||||
|
Iterator iter = optionElements.listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Option option = (Option) iter.next();
|
||||||
|
option.setDirty(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Resolve the element IDs to interface references. Intended to be
|
||||||
|
* called by derived class.
|
||||||
|
*/
|
||||||
|
protected void resolveReferences() {
|
||||||
|
if (!resolved) {
|
||||||
|
resolved = true;
|
||||||
|
// Call resolveReferences on our children
|
||||||
|
Iterator optionIter = getOptionList().iterator();
|
||||||
|
while (optionIter.hasNext()) {
|
||||||
|
Option current = (Option)optionIter.next();
|
||||||
|
current.resolveReferences();
|
||||||
|
}
|
||||||
|
// Somewhat wasteful, but use the vector to retrieve the categories in proper order
|
||||||
|
Iterator catIter = getCategoryIds().iterator();
|
||||||
|
while (catIter.hasNext()) {
|
||||||
|
String id = (String)catIter.next();
|
||||||
|
IOptionCategory current = (IOptionCategory)getCategoryMap().get(id);
|
||||||
|
if (current instanceof Tool) {
|
||||||
|
((Tool)current).resolveReferences();
|
||||||
|
} else if (current instanceof ToolChain) {
|
||||||
|
((ToolChain)current).resolveReferences();
|
||||||
|
} else if (current instanceof OptionCategory) {
|
||||||
|
((OptionCategory)current).resolveReferences();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -448,7 +448,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
.getApplicabilityCalculator();
|
.getApplicabilityCalculator();
|
||||||
|
|
||||||
if (applicabilityCalculator == null
|
if (applicabilityCalculator == null
|
||||||
|| applicabilityCalculator.isOptionUsedInCommandLine(tool)) {
|
|| applicabilityCalculator.isOptionUsedInCommandLine(config, tool, option)) {
|
||||||
|
|
||||||
// Get all the user-defined paths from the
|
// Get all the user-defined paths from the
|
||||||
// option as absolute paths
|
// option as absolute paths
|
||||||
|
@ -500,7 +500,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
IOptionApplicability applicabilitytCalculator = option.getApplicabilityCalculator();
|
IOptionApplicability applicabilitytCalculator = option.getApplicabilityCalculator();
|
||||||
|
|
||||||
if (applicabilitytCalculator == null
|
if (applicabilitytCalculator == null
|
||||||
|| applicabilitytCalculator.isOptionUsedInCommandLine(tool)) {
|
|| applicabilitytCalculator.isOptionUsedInCommandLine(getDefaultConfiguration(), tool, option)) {
|
||||||
String command = option.getCommand();
|
String command = option.getCommand();
|
||||||
String[] allLibs = option.getLibraries();
|
String[] allLibs = option.getLibraries();
|
||||||
for (int j = 0; j < allLibs.length; j++)
|
for (int j = 0; j < allLibs.length; j++)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -225,6 +226,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
*/
|
*/
|
||||||
public IConfiguration createConfiguration(IConfiguration parent, String id) {
|
public IConfiguration createConfiguration(IConfiguration parent, String id) {
|
||||||
Configuration config = new Configuration(this, (Configuration)parent, id, false);
|
Configuration config = new Configuration(this, (Configuration)parent, id, false);
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
|
||||||
return (IConfiguration)config;
|
return (IConfiguration)config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +235,8 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
*/
|
*/
|
||||||
public IConfiguration createConfigurationClone(IConfiguration parent, String id) {
|
public IConfiguration createConfigurationClone(IConfiguration parent, String id) {
|
||||||
Configuration config = new Configuration(this, (Configuration)parent, id, true);
|
Configuration config = new Configuration(this, (Configuration)parent, id, true);
|
||||||
|
// Inform all options in the configuration and all its resource configurations
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
|
||||||
return (IConfiguration)config;
|
return (IConfiguration)config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,16 @@ import java.util.Set;
|
||||||
|
|
||||||
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.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
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.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
@ -45,7 +49,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
private IOption superClass;
|
private IOption superClass;
|
||||||
private String superClassId;
|
private String superClassId;
|
||||||
// Parent and children
|
// Parent and children
|
||||||
private ITool tool;
|
private IHoldsOptions holder;
|
||||||
// Managed Build model attributes
|
// Managed Build model attributes
|
||||||
private String unusedChildren;
|
private String unusedChildren;
|
||||||
private Integer browseType;
|
private Integer browseType;
|
||||||
|
@ -62,12 +66,19 @@ public class Option extends BuildObject implements IOption {
|
||||||
private Integer valueType;
|
private Integer valueType;
|
||||||
private Boolean isAbstract;
|
private Boolean isAbstract;
|
||||||
private Integer resourceFilter;
|
private Integer resourceFilter;
|
||||||
|
private IConfigurationElement valueHandlerElement = null;
|
||||||
|
private IManagedOptionValueHandler valueHandler = null;
|
||||||
|
private String valueHandlerExtraArgument;
|
||||||
private IConfigurationElement applicabilityCalculatorElement = null;
|
private IConfigurationElement applicabilityCalculatorElement = null;
|
||||||
private IOptionApplicability applicabilityCalculator = null;
|
private IOptionApplicability applicabilityCalculator = null;
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean isExtensionOption = false;
|
private boolean isExtensionOption = false;
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
private boolean resolved = true;
|
private boolean resolved = true;
|
||||||
|
private boolean verified = false;
|
||||||
|
private boolean isValid = true; /** False for options which are invalid. getOption()
|
||||||
|
* routines will ignore invalid options. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C O N S T R U C T O R S
|
* C O N S T R U C T O R S
|
||||||
*/
|
*/
|
||||||
|
@ -76,13 +87,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
* This constructor is called to create an option defined by an extension point in
|
* This constructor is called to create an option defined by an extension point in
|
||||||
* a plugin manifest file, or returned by a dynamic element provider
|
* a plugin manifest file, or returned by a dynamic element provider
|
||||||
*
|
*
|
||||||
* @param parent The ITool parent of this option, or <code>null</code> if
|
* @param parent The IHoldsOptions parent of this option, or <code>null</code> if
|
||||||
* defined at the top level
|
* defined at the top level
|
||||||
* @param element The option definition from the manifest file or a dynamic element
|
* @param element The option definition from the manifest file or a dynamic element
|
||||||
* provider
|
* provider
|
||||||
*/
|
*/
|
||||||
public Option(Tool parent, IManagedConfigElement element) {
|
public Option(IHoldsOptions parent, IManagedConfigElement element) {
|
||||||
this.tool = parent;
|
this.holder = parent;
|
||||||
isExtensionOption = true;
|
isExtensionOption = true;
|
||||||
|
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
|
@ -98,14 +109,14 @@ public class Option extends BuildObject implements IOption {
|
||||||
* This constructor is called to create an Option whose attributes and children will be
|
* This constructor is called to create an Option whose attributes and children will be
|
||||||
* added by separate calls.
|
* added by separate calls.
|
||||||
*
|
*
|
||||||
* @param Tool The parent of the tool, if any
|
* @param IHoldsOptions The parent of the option, if any
|
||||||
* @param Option The superClass, if any
|
* @param Option The superClass, if any
|
||||||
* @param String The id for the new option
|
* @param String The id for the new option
|
||||||
* @param String The name for the new option
|
* @param String The name for the new option
|
||||||
* @param boolean Indicates whether this is an extension element or a managed project element
|
* @param boolean Indicates whether this is an extension element or a managed project element
|
||||||
*/
|
*/
|
||||||
public Option(Tool parent, IOption superClass, String Id, String name, boolean isExtensionElement) {
|
public Option(IHoldsOptions parent, IOption superClass, String Id, String name, boolean isExtensionElement) {
|
||||||
this.tool = parent;
|
this.holder = parent;
|
||||||
this.superClass = superClass;
|
this.superClass = superClass;
|
||||||
if (this.superClass != null) {
|
if (this.superClass != null) {
|
||||||
superClassId = this.superClass.getId();
|
superClassId = this.superClass.getId();
|
||||||
|
@ -125,11 +136,11 @@ public class Option extends BuildObject implements IOption {
|
||||||
* Create an <code>Option</code> based on the specification stored in the
|
* Create an <code>Option</code> based on the specification stored in the
|
||||||
* project file (.cdtbuild).
|
* project file (.cdtbuild).
|
||||||
*
|
*
|
||||||
* @param parent The <code>ITool</code> the option will be added to.
|
* @param parent The <code>IHoldsOptions</code> the option will be added to.
|
||||||
* @param element The XML element that contains the option settings.
|
* @param element The XML element that contains the option settings.
|
||||||
*/
|
*/
|
||||||
public Option(Tool parent, Element element) {
|
public Option(IHoldsOptions parent, Element element) {
|
||||||
this.tool = parent;
|
this.holder = parent;
|
||||||
isExtensionOption = false;
|
isExtensionOption = false;
|
||||||
|
|
||||||
// Initialize from the XML attributes
|
// Initialize from the XML attributes
|
||||||
|
@ -139,11 +150,13 @@ public class Option extends BuildObject implements IOption {
|
||||||
/**
|
/**
|
||||||
* Create an <code>Option</code> based upon an existing option.
|
* Create an <code>Option</code> based upon an existing option.
|
||||||
*
|
*
|
||||||
* @param parent The <code>ITool</code> the option will be added to.
|
* @param parent The <code>IHoldsOptions</code> the option will be added to.
|
||||||
* @param tool The existing option to clone.
|
* @param Id New ID for the option.
|
||||||
|
* @param name New name for the option.
|
||||||
|
* @param option The existing option to clone, except for the above fields.
|
||||||
*/
|
*/
|
||||||
public Option(ITool parent, String Id, String name, Option option){
|
public Option(IHoldsOptions parent, String Id, String name, Option option){
|
||||||
this.tool = parent;
|
this.holder = parent;
|
||||||
superClass = option.superClass;
|
superClass = option.superClass;
|
||||||
if (superClass != null) {
|
if (superClass != null) {
|
||||||
superClassId = option.superClass.getId();
|
superClassId = option.superClass.getId();
|
||||||
|
@ -221,6 +234,14 @@ public class Option extends BuildObject implements IOption {
|
||||||
applicabilityCalculatorElement = option.applicabilityCalculatorElement;
|
applicabilityCalculatorElement = option.applicabilityCalculatorElement;
|
||||||
applicabilityCalculator = option.applicabilityCalculator;
|
applicabilityCalculator = option.applicabilityCalculator;
|
||||||
|
|
||||||
|
if (option.valueHandlerElement != null) {
|
||||||
|
valueHandlerElement = option.valueHandlerElement;
|
||||||
|
valueHandler = option.valueHandler;
|
||||||
|
}
|
||||||
|
if (option.valueHandlerExtraArgument != null) {
|
||||||
|
valueHandlerExtraArgument = new String(option.valueHandlerExtraArgument);
|
||||||
|
}
|
||||||
|
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,8 +319,14 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (applicabilityCalculatorStr != null && element instanceof DefaultManagedConfigElement) {
|
if (applicabilityCalculatorStr != null && element instanceof DefaultManagedConfigElement) {
|
||||||
applicabilityCalculatorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
applicabilityCalculatorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
||||||
}
|
}
|
||||||
|
// valueHandler
|
||||||
|
// Store the configuration element IFF there is a value handler defined
|
||||||
|
String valueHandler = element.getAttribute(VALUE_HANDLER);
|
||||||
|
if (valueHandler != null && element instanceof DefaultManagedConfigElement) {
|
||||||
|
valueHandlerElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
||||||
|
}
|
||||||
|
// valueHandlerExtraArgument
|
||||||
|
valueHandlerExtraArgument = element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -472,7 +499,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
if (element.hasAttribute(CATEGORY)) {
|
if (element.hasAttribute(CATEGORY)) {
|
||||||
categoryId = element.getAttribute(CATEGORY);
|
categoryId = element.getAttribute(CATEGORY);
|
||||||
if (categoryId != null) {
|
if (categoryId != null) {
|
||||||
category = ((Tool)tool).getOptionCategory(categoryId);
|
category = holder.getOptionCategory(categoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +514,14 @@ public class Option extends BuildObject implements IOption {
|
||||||
resourceFilter = new Integer(FILTER_PROJECT);
|
resourceFilter = new Integer(FILTER_PROJECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: valueHandlerElement and VALUE_HANDLER are not restored,
|
||||||
|
// as they are not saved. See note in serialize().
|
||||||
|
|
||||||
|
// valueHandlerExtraArgument
|
||||||
|
if (element.hasAttribute(VALUE_HANDLER_EXTRA_ARGUMENT)) {
|
||||||
|
valueHandlerExtraArgument = element.getAttribute(VALUE_HANDLER_EXTRA_ARGUMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ValueTypeStrToInt(String valueTypeStr) {
|
private int ValueTypeStrToInt(String valueTypeStr) {
|
||||||
|
@ -693,6 +728,16 @@ public class Option extends BuildObject implements IOption {
|
||||||
// TODO: issue warning?
|
// TODO: issue warning?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: a value handler cannot be specified in a project file because
|
||||||
|
// an IConfigurationElement is needed to load it!
|
||||||
|
if (valueHandlerElement != null) {
|
||||||
|
// TODO: Issue warning? Stuck with behavior of this elsewhere in
|
||||||
|
// CDT, e.g. the implementation of Tool
|
||||||
|
}
|
||||||
|
if (valueHandlerExtraArgument != null) {
|
||||||
|
element.setAttribute(VALUE_HANDLER_EXTRA_ARGUMENT, valueHandlerExtraArgument);
|
||||||
|
}
|
||||||
|
|
||||||
// I am clean now
|
// I am clean now
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -702,10 +747,18 @@ public class Option extends BuildObject implements IOption {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getParent()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getParent()
|
||||||
*/
|
*/
|
||||||
public ITool getParent() {
|
public IBuildObject getParent() {
|
||||||
return tool;
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getOptionHolder()
|
||||||
|
*/
|
||||||
|
public IHoldsOptions getOptionHolder() {
|
||||||
|
// Do not take superclasses into account
|
||||||
|
return holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -720,14 +773,14 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getName()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (name == null && superClass != null) ? superClass.getName() : name;
|
return (name == null && superClass != null) ? superClass.getName() : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getApplicableValues()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getApplicableValues()
|
||||||
*/
|
*/
|
||||||
public String[] getApplicableValues() {
|
public String[] getApplicableValues() {
|
||||||
// Does this option instance have the list of values?
|
// Does this option instance have the list of values?
|
||||||
|
@ -823,7 +876,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getBuiltIns()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getBuiltIns()
|
||||||
*/
|
*/
|
||||||
public String[] getBuiltIns() {
|
public String[] getBuiltIns() {
|
||||||
// Return the list of built-ins as an array
|
// Return the list of built-ins as an array
|
||||||
|
@ -838,21 +891,25 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCategory()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getCategory()
|
||||||
*/
|
*/
|
||||||
public IOptionCategory getCategory() {
|
public IOptionCategory getCategory() {
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
if (superClass != null) {
|
if (superClass != null) {
|
||||||
return superClass.getCategory();
|
return superClass.getCategory();
|
||||||
} else {
|
} else {
|
||||||
return getParent().getTopOptionCategory();
|
if (getOptionHolder() instanceof ITool) {
|
||||||
|
return ((ITool)getOptionHolder()).getTopOptionCategory();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCommand()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getCommand()
|
||||||
*/
|
*/
|
||||||
public String getCommand() {
|
public String getCommand() {
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
|
@ -866,7 +923,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getCommandFalse()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getCommandFalse()
|
||||||
*/
|
*/
|
||||||
public String getCommandFalse() {
|
public String getCommandFalse() {
|
||||||
if (commandFalse == null) {
|
if (commandFalse == null) {
|
||||||
|
@ -880,7 +937,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getDefinedSymbols()
|
||||||
*/
|
*/
|
||||||
public String[] getDefinedSymbols() throws BuildException {
|
public String[] getDefinedSymbols() throws BuildException {
|
||||||
if (getValueType() != PREPROCESSOR_SYMBOLS) {
|
if (getValueType() != PREPROCESSOR_SYMBOLS) {
|
||||||
|
@ -896,7 +953,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getEnumCommand(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getEnumCommand(String id) throws BuildException {
|
public String getEnumCommand(String id) throws BuildException {
|
||||||
// Sanity
|
// Sanity
|
||||||
|
@ -934,7 +991,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumName(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getEnumName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public String getEnumName(String id) throws BuildException {
|
public String getEnumName(String id) throws BuildException {
|
||||||
// Sanity
|
// Sanity
|
||||||
|
@ -1018,7 +1075,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getIncludePaths()
|
||||||
*/
|
*/
|
||||||
public String[] getIncludePaths() throws BuildException {
|
public String[] getIncludePaths() throws BuildException {
|
||||||
if (getValueType() != INCLUDE_PATH) {
|
if (getValueType() != INCLUDE_PATH) {
|
||||||
|
@ -1034,7 +1091,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getLibraries()
|
||||||
*/
|
*/
|
||||||
public String[] getLibraries() throws BuildException {
|
public String[] getLibraries() throws BuildException {
|
||||||
if (getValueType() != LIBRARIES) {
|
if (getValueType() != LIBRARIES) {
|
||||||
|
@ -1050,7 +1107,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getDefaultEnumValue()
|
||||||
*/
|
*/
|
||||||
public String getSelectedEnum() throws BuildException {
|
public String getSelectedEnum() throws BuildException {
|
||||||
if (getValueType() != ENUMERATED) {
|
if (getValueType() != ENUMERATED) {
|
||||||
|
@ -1060,7 +1117,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getStringListValue()
|
||||||
*/
|
*/
|
||||||
public String[] getStringListValue() throws BuildException {
|
public String[] getStringListValue() throws BuildException {
|
||||||
if (getValueType() != STRING_LIST) {
|
if (getValueType() != STRING_LIST) {
|
||||||
|
@ -1076,7 +1133,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getStringValue()
|
||||||
*/
|
*/
|
||||||
public String getStringValue() throws BuildException {
|
public String getStringValue() throws BuildException {
|
||||||
if (getValueType() != STRING && getValueType() != ENUMERATED) {
|
if (getValueType() != STRING && getValueType() != ENUMERATED) {
|
||||||
|
@ -1103,7 +1160,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getValueType()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getValueType()
|
||||||
*/
|
*/
|
||||||
public int getValueType() throws BuildException {
|
public int getValueType() throws BuildException {
|
||||||
if (valueType == null) {
|
if (valueType == null) {
|
||||||
|
@ -1196,7 +1253,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValue(Object)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object)
|
||||||
*/
|
*/
|
||||||
public void setDefaultValue(Object v) {
|
public void setDefaultValue(Object v) {
|
||||||
defaultValue = v;
|
defaultValue = v;
|
||||||
|
@ -1204,7 +1261,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setCategory(org.eclipse.cdt.core.build.managed.IOptionCategory)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setCategory(org.eclipse.cdt.managedbuilder.core.IOptionCategory)
|
||||||
*/
|
*/
|
||||||
public void setCategory(IOptionCategory category) {
|
public void setCategory(IOptionCategory category) {
|
||||||
if (this.category != category) {
|
if (this.category != category) {
|
||||||
|
@ -1219,7 +1276,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setCommand(String)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setCommand(String)
|
||||||
*/
|
*/
|
||||||
public void setCommand(String cmd) {
|
public void setCommand(String cmd) {
|
||||||
if (cmd == null && command == null) return;
|
if (cmd == null && command == null) return;
|
||||||
|
@ -1230,7 +1287,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setCommandFalse(String)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setCommandFalse(String)
|
||||||
*/
|
*/
|
||||||
public void setCommandFalse(String cmd) {
|
public void setCommandFalse(String cmd) {
|
||||||
if (cmd == null && commandFalse == null) return;
|
if (cmd == null && commandFalse == null) return;
|
||||||
|
@ -1261,7 +1318,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValue(boolean)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(boolean)
|
||||||
*/
|
*/
|
||||||
public void setValue(boolean value) throws BuildException {
|
public void setValue(boolean value) throws BuildException {
|
||||||
if (!isExtensionElement() && getValueType() == BOOLEAN)
|
if (!isExtensionElement() && getValueType() == BOOLEAN)
|
||||||
|
@ -1274,7 +1331,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValue(String)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(String)
|
||||||
*/
|
*/
|
||||||
public void setValue(String value) throws BuildException {
|
public void setValue(String value) throws BuildException {
|
||||||
// Note that we can still set the human-readable value here
|
// Note that we can still set the human-readable value here
|
||||||
|
@ -1288,7 +1345,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValue(String [])
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(String [])
|
||||||
*/
|
*/
|
||||||
public void setValue(String [] value) throws BuildException {
|
public void setValue(String [] value) throws BuildException {
|
||||||
if (!isExtensionElement() &&
|
if (!isExtensionElement() &&
|
||||||
|
@ -1307,7 +1364,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValue(Object)
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValue(Object)
|
||||||
*/
|
*/
|
||||||
public void setValue(Object v) {
|
public void setValue(Object v) {
|
||||||
value = v;
|
value = v;
|
||||||
|
@ -1315,7 +1372,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#setValueType()
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValueType()
|
||||||
*/
|
*/
|
||||||
public void setValueType(int type) {
|
public void setValueType(int type) {
|
||||||
// TODO: Verify that this is a valid type
|
// TODO: Verify that this is a valid type
|
||||||
|
@ -1325,6 +1382,63 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getValueHandlerElement()
|
||||||
|
*/
|
||||||
|
public IConfigurationElement getValueHandlerElement() {
|
||||||
|
if (valueHandlerElement == null) {
|
||||||
|
if (superClass != null) {
|
||||||
|
return ((Option)superClass).getValueHandlerElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valueHandlerElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#setValueHandlerElement(IConfigurationElement)
|
||||||
|
*/
|
||||||
|
public void setValueHandlerElement(IConfigurationElement element) {
|
||||||
|
valueHandlerElement = element;
|
||||||
|
setDirty(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getValueHandler()
|
||||||
|
*/
|
||||||
|
public IManagedOptionValueHandler getValueHandler() {
|
||||||
|
if (valueHandler != null) {
|
||||||
|
return valueHandler;
|
||||||
|
}
|
||||||
|
IConfigurationElement element = getValueHandlerElement();
|
||||||
|
if (element != null) {
|
||||||
|
try {
|
||||||
|
if (element.getAttribute(VALUE_HANDLER) != null) {
|
||||||
|
valueHandler = (IManagedOptionValueHandler) element.createExecutableExtension(VALUE_HANDLER);
|
||||||
|
return valueHandler;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
ManagedBuildManager.OptionValueHandlerError(element.getAttribute(VALUE_HANDLER), getId());
|
||||||
|
// Assign the default handler to avoid further error messages
|
||||||
|
valueHandler = ManagedOptionValueHandler.getManagedOptionValueHandler();
|
||||||
|
return valueHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If no handler is provided, then use the default handler
|
||||||
|
return ManagedOptionValueHandler.getManagedOptionValueHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#getValueHandlerExtraArgument())
|
||||||
|
*/
|
||||||
|
public String getValueHandlerExtraArgument() {
|
||||||
|
if (valueHandlerExtraArgument == null) {
|
||||||
|
if (superClass != null) {
|
||||||
|
return superClass.getValueHandlerExtraArgument();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valueHandlerExtraArgument;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* O B J E C T S T A T E M A I N T E N A N C E
|
* O B J E C T S T A T E M A I N T E N A N C E
|
||||||
*/
|
*/
|
||||||
|
@ -1391,7 +1505,7 @@ public class Option extends BuildObject implements IOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (categoryId != null) {
|
if (categoryId != null) {
|
||||||
category = ((Tool)tool).getOptionCategory(categoryId);
|
category = holder.getOptionCategory(categoryId);
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
// Report error
|
// Report error
|
||||||
ManagedBuildManager.OutputResolveError(
|
ManagedBuildManager.OutputResolveError(
|
||||||
|
@ -1494,6 +1608,78 @@ public class Option extends BuildObject implements IOption {
|
||||||
return managedBuildRevision;
|
return managedBuildRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* For now implement this method just as a utility to make code
|
||||||
|
* within the Option class cleaner.
|
||||||
|
* TODO: In future we may want to move this to IOption
|
||||||
|
*/
|
||||||
|
protected boolean isAbstract() {
|
||||||
|
if (isAbstract != null) {
|
||||||
|
return isAbstract.booleanValue();
|
||||||
|
} else {
|
||||||
|
return false; // Note: no inheritance from superClass
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies whether the option is valid and handles
|
||||||
|
* any errors for the option. The following errors
|
||||||
|
* can occur:
|
||||||
|
* (a) Options that are children of a ToolChain must
|
||||||
|
* ALWAYS have a category
|
||||||
|
* (b) Options that are children of a ToolChain must
|
||||||
|
* NEVER have a resourceFilter of "file".
|
||||||
|
* If an error occurs, the option is set to being invalid.
|
||||||
|
*
|
||||||
|
* @pre All references have been resolved.
|
||||||
|
*/
|
||||||
|
private void verify() {
|
||||||
|
if (verified) return;
|
||||||
|
verified = true;
|
||||||
|
// Ignore elements that are superclasses
|
||||||
|
if ( getOptionHolder() instanceof IToolChain && isAbstract() == false ) {
|
||||||
|
// Check for error (a)
|
||||||
|
if (getCategory() == null) {
|
||||||
|
ManagedBuildManager.OptionValidError(ManagedBuildManager.ERROR_CATEGORY, getId());
|
||||||
|
// Object becomes invalid
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
// Check for error (b). Not specifying an attribute is OK.
|
||||||
|
// Do not use getResourceFilter as it does not allow
|
||||||
|
// differentiating between "all" and no attribute specified.
|
||||||
|
if ( resourceFilter != null )
|
||||||
|
{
|
||||||
|
switch (getResourceFilter()) {
|
||||||
|
case Option.FILTER_FILE:
|
||||||
|
// TODO: Cannot differentiate between "all" and attribute not
|
||||||
|
// specified. Thus do not produce an error. We can argue that "all"
|
||||||
|
// means all valid resource configurations.
|
||||||
|
ManagedBuildManager.OptionValidError(ManagedBuildManager.ERROR_FILTER, getId());
|
||||||
|
// Object becomes invalid
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#isValid()
|
||||||
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
// We use a lazy scheme to check whether the option is valid.
|
||||||
|
// Note that by default an option is valid. verify() is only called if
|
||||||
|
// the option has been resolved. This gets us around having to deal with
|
||||||
|
// ordering problems during a resolve, or introducing another global
|
||||||
|
// stage to verify the configuration after a resolve.
|
||||||
|
// The trade-off is that errors in the MBS grammar may not be
|
||||||
|
// detected on load, but only when a particular grammar element
|
||||||
|
// is used, say in the GUI.
|
||||||
|
if (verified == false && resolved == true) {
|
||||||
|
verify();
|
||||||
|
}
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the version.
|
* @return Returns the version.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2004 IBM Corporation and others.
|
* Copyright (c) 2003, 2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* are made available under the terms of the Common Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,18 +10,23 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
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.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
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.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
// import org.eclipse.core.runtime.PluginVersionIdentifier; // uncomment this line after 'parent' is available
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
@ -33,11 +38,12 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
|
private static final IOptionCategory[] emtpyCategories = new IOptionCategory[0];
|
||||||
|
|
||||||
// Parent and children
|
// Parent and children
|
||||||
private Tool tool;
|
private IHoldsOptions holder;
|
||||||
private List children; // Note: These are logical Option Category children, not "model" children
|
private List children; // Note: These are logical Option Category children, not "model" children
|
||||||
// Managed Build model attributes
|
// Managed Build model attributes
|
||||||
private IOptionCategory owner; // The logical Option Category parent
|
private IOptionCategory owner; // The logical Option Category parent
|
||||||
private String ownerId;
|
private String ownerId;
|
||||||
|
private URL iconPathURL;
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean isExtensionOptionCategory = false;
|
private boolean isExtensionOptionCategory = false;
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
|
@ -55,13 +61,13 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
* This constructor is called to create an option category defined by an extension point in
|
* This constructor is called to create an option category defined by an extension point in
|
||||||
* a plugin manifest file, or returned by a dynamic element provider
|
* a plugin manifest file, or returned by a dynamic element provider
|
||||||
*
|
*
|
||||||
* @param parent The IToolChain parent of this builder, or <code>null</code> if
|
* @param parent The IHoldsOptions parent of this catgeory, or <code>null</code> if
|
||||||
* defined at the top level
|
* defined at the top level
|
||||||
* @param element The builder definition from the manifest file or a dynamic element
|
* @param element The category definition from the manifest file or a dynamic element
|
||||||
* provider
|
* provider
|
||||||
*/
|
*/
|
||||||
public OptionCategory(Tool parent, IManagedConfigElement element) {
|
public OptionCategory(IHoldsOptions parent, IManagedConfigElement element) {
|
||||||
this.tool = parent;
|
this.holder = parent;
|
||||||
isExtensionOptionCategory = true;
|
isExtensionOptionCategory = true;
|
||||||
|
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
|
@ -72,26 +78,26 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
// Hook me up to the Managed Build Manager
|
// Hook me up to the Managed Build Manager
|
||||||
ManagedBuildManager.addExtensionOptionCategory(this);
|
ManagedBuildManager.addExtensionOptionCategory(this);
|
||||||
|
|
||||||
// Add the category to the tool
|
// Add the category to the parent
|
||||||
tool.addOptionCategory(this);
|
parent.addOptionCategory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an <codeOptionCategory</code> based on the specification stored in the
|
* Create an <codeOptionCategory</code> based on the specification stored in the
|
||||||
* project file (.cdtbuild).
|
* project file (.cdtbuild).
|
||||||
*
|
*
|
||||||
* @param parent The <code>Tool</code> the OptionCategory will be added to.
|
* @param parent The <code>IHoldsOptions</code> object the OptionCategory will be added to.
|
||||||
* @param element The XML element that contains the OptionCategory settings.
|
* @param element The XML element that contains the OptionCategory settings.
|
||||||
*/
|
*/
|
||||||
public OptionCategory(Tool parent, Element element) {
|
public OptionCategory(IHoldsOptions parent, Element element) {
|
||||||
tool = parent;
|
this.holder = parent;
|
||||||
isExtensionOptionCategory = false;
|
isExtensionOptionCategory = false;
|
||||||
|
|
||||||
// Initialize from the XML attributes
|
// Initialize from the XML attributes
|
||||||
loadFromProject(element);
|
loadFromProject(element);
|
||||||
|
|
||||||
// Add the category to the tool
|
// Add the category to the parent
|
||||||
tool.addOptionCategory(this);
|
parent.addOptionCategory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -109,6 +115,13 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
|
|
||||||
// owner
|
// owner
|
||||||
ownerId = element.getAttribute(IOptionCategory.OWNER);
|
ownerId = element.getAttribute(IOptionCategory.OWNER);
|
||||||
|
|
||||||
|
// icon
|
||||||
|
if ( element.getAttribute(IOptionCategory.ICON) != null && element instanceof DefaultManagedConfigElement)
|
||||||
|
{
|
||||||
|
String icon = element.getAttribute(IOptionCategory.ICON);
|
||||||
|
iconPathURL = ManagedBuildManager.getURLInBuildDefinitions( (DefaultManagedConfigElement)element, new Path(icon) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -132,18 +145,42 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
ownerId = element.getAttribute(IOptionCategory.OWNER);
|
ownerId = element.getAttribute(IOptionCategory.OWNER);
|
||||||
}
|
}
|
||||||
if (ownerId != null) {
|
if (ownerId != null) {
|
||||||
owner = tool.getOptionCategory(ownerId);
|
owner = holder.getOptionCategory(ownerId);
|
||||||
} else {
|
} else {
|
||||||
owner = tool;
|
owner = getNullOptionCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
// icon - was saved as URL in string form
|
||||||
|
if (element.hasAttribute(IOptionCategory.ICON)) {
|
||||||
|
String iconPath = element.getAttribute(IOptionCategory.ICON);
|
||||||
|
try {
|
||||||
|
iconPathURL = new URL(iconPath);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
// Print a warning
|
||||||
|
ManagedBuildManager.OutputIconError(iconPath);
|
||||||
|
iconPathURL = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook me in
|
// Hook me in
|
||||||
if (owner instanceof Tool)
|
if (owner == null)
|
||||||
|
((HoldsOptions)holder).addChildCategory(this);
|
||||||
|
else if (owner instanceof Tool)
|
||||||
((Tool)owner).addChildCategory(this);
|
((Tool)owner).addChildCategory(this);
|
||||||
else
|
else
|
||||||
((OptionCategory)owner).addChildCategory(this);
|
((OptionCategory)owner).addChildCategory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IOptionCategory getNullOptionCategory() {
|
||||||
|
// Handle difference between Tool and others by using
|
||||||
|
// the fact that Tool implements IOptionCategory. If so,
|
||||||
|
// the holder is in fact a parent category to this category.
|
||||||
|
if (holder instanceof IOptionCategory) {
|
||||||
|
return (IOptionCategory)holder;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the OptionCategory to the project file.
|
* Persist the OptionCategory to the project file.
|
||||||
*
|
*
|
||||||
|
@ -160,6 +197,11 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
if (owner != null)
|
if (owner != null)
|
||||||
element.setAttribute(IOptionCategory.OWNER, owner.getId());
|
element.setAttribute(IOptionCategory.OWNER, owner.getId());
|
||||||
|
|
||||||
|
if (iconPathURL != null) {
|
||||||
|
// Save as URL in string form
|
||||||
|
element.setAttribute(IOptionCategory.ICON, iconPathURL.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// I am clean now
|
// I am clean now
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -188,46 +230,76 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
|
||||||
*/
|
*/
|
||||||
public Object[][] getOptions(IConfiguration configuration) {
|
public Object[][] getOptions(IConfiguration configuration) {
|
||||||
ITool[] tools = null;
|
IHoldsOptions[] optionHolders = null;
|
||||||
if (configuration != null) {
|
if (configuration != null) {
|
||||||
tools = configuration.getTools();
|
IHoldsOptions optionHolder = getOptionHolder();
|
||||||
|
if (optionHolder instanceof ITool) {
|
||||||
|
optionHolders = configuration.getTools();
|
||||||
|
} else if (optionHolder instanceof IToolChain) {
|
||||||
|
// Get the toolchain of this configuration, which is
|
||||||
|
// the holder equivalent for this option
|
||||||
|
optionHolders = new IHoldsOptions[1];
|
||||||
|
optionHolders[0] = configuration.getToolChain();
|
||||||
|
}
|
||||||
|
// TODO: if further option holders were to be added in future,
|
||||||
|
// this function needs to be extended
|
||||||
}
|
}
|
||||||
return getOptions(tools, FILTER_PROJECT);
|
return getOptions(optionHolders, FILTER_PROJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[][] getOptions(IResourceConfiguration resConfig) {
|
public Object[][] getOptions(IResourceConfiguration resConfig) {
|
||||||
ITool[] tools = null;
|
IHoldsOptions[] optionHolders = null;
|
||||||
if (resConfig != null) {
|
if (resConfig != null) {
|
||||||
tools = resConfig.getTools();
|
IHoldsOptions optionHolder = getOptionHolder();
|
||||||
|
if (optionHolder instanceof ITool) {
|
||||||
|
optionHolders = resConfig.getTools();
|
||||||
|
} else if (optionHolder instanceof IToolChain) {
|
||||||
|
// Resource configurations do not support categories that are children
|
||||||
|
// of toolchains. The reason for this is that options in such categories
|
||||||
|
// are intended to be global. Thus return nothing.
|
||||||
|
// TODO: Remove this restriction in future?
|
||||||
|
optionHolders = new IHoldsOptions[1];
|
||||||
|
optionHolders[0] = null;
|
||||||
|
}
|
||||||
|
// TODO: if further option holders were to be added in future,
|
||||||
|
// this function needs to be extended
|
||||||
}
|
}
|
||||||
return getOptions(tools, FILTER_FILE);
|
return getOptions(optionHolders, FILTER_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[][] getOptions(ITool[] tools, int filterValue) {
|
private IHoldsOptions getOptionHoldersSuperClass(IHoldsOptions optionHolder) {
|
||||||
ITool catTool = getTool();
|
if (optionHolder instanceof ITool)
|
||||||
ITool tool = null;
|
return ((ITool)optionHolder).getSuperClass();
|
||||||
|
else if (optionHolder instanceof IToolChain)
|
||||||
|
return ((IToolChain)optionHolder).getSuperClass();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (tools != null) {
|
private Object[][] getOptions(IHoldsOptions[] optionHolders, int filterValue) {
|
||||||
|
IHoldsOptions catHolder = getOptionHolder();
|
||||||
|
IHoldsOptions optionHolder = null;
|
||||||
|
|
||||||
|
if (optionHolders != null) {
|
||||||
// Find the child of the configuration/resource configuration that represents the same tool.
|
// Find the child of the configuration/resource configuration that represents the same tool.
|
||||||
// It could the tool itself, or a "sub-class" of the tool.
|
// It could the tool itself, or a "sub-class" of the tool.
|
||||||
for (int i = 0; i < tools.length; ++i) {
|
for (int i = 0; i < optionHolders.length; ++i) {
|
||||||
ITool current = tools[i];
|
IHoldsOptions current = optionHolders[i];
|
||||||
do {
|
do {
|
||||||
if (catTool == current) {
|
if (catHolder == current) {
|
||||||
tool = tools[i];
|
optionHolder = optionHolders[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while ((current = current.getSuperClass()) != null);
|
} while ((current = getOptionHoldersSuperClass(current)) != null);
|
||||||
if (tool != null) break;
|
if (optionHolder != null) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tool == null) {
|
if (optionHolder == null) {
|
||||||
tool = catTool;
|
optionHolder = catHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all of the tool's options and see which ones are part of
|
// Get all of the tool's options and see which ones are part of
|
||||||
// this category.
|
// this category.
|
||||||
IOption[] allOptions = tool.getOptions();
|
IOption[] allOptions = optionHolder.getOptions();
|
||||||
Object[][] myOptions = new Object[allOptions.length][2];
|
Object[][] myOptions = new Object[allOptions.length][2];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < allOptions.length; ++i) {
|
for (int i = 0; i < allOptions.length; ++i) {
|
||||||
|
@ -237,7 +309,7 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
// Check whether this option can be displayed for a specific resource type.
|
// Check whether this option can be displayed for a specific resource type.
|
||||||
if( (option.getResourceFilter() == FILTER_ALL) || (option.getResourceFilter() == filterValue) ) {
|
if( (option.getResourceFilter() == FILTER_ALL) || (option.getResourceFilter() == filterValue) ) {
|
||||||
myOptions[index] = new Object[2];
|
myOptions[index] = new Object[2];
|
||||||
myOptions[index][0] = tool;
|
myOptions[index][0] = optionHolder;
|
||||||
myOptions[index][1] = option;
|
myOptions[index][1] = option;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -257,12 +329,34 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptionHolder()
|
||||||
|
*/
|
||||||
|
public IHoldsOptions getOptionHolder() {
|
||||||
|
// This will stop at the parent's top category
|
||||||
|
if (owner != null)
|
||||||
|
return owner.getOptionHolder();
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
|
||||||
*/
|
*/
|
||||||
public ITool getTool() {
|
public ITool getTool() {
|
||||||
// This will stop at the Tool's top category
|
// This will stop at the tool's top category
|
||||||
return owner.getTool();
|
IHoldsOptions parent = owner.getOptionHolder();
|
||||||
|
if (parent instanceof ITool)
|
||||||
|
{
|
||||||
|
return (ITool)parent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getIconPath()
|
||||||
|
*/
|
||||||
|
public URL getIconPath() {
|
||||||
|
return iconPathURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -293,39 +387,53 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolveReferences() {
|
public void resolveReferences() {
|
||||||
|
boolean error = false;
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
if (ownerId != null) {
|
if (ownerId != null) {
|
||||||
owner = tool.getOptionCategory(ownerId);
|
owner = holder.getOptionCategory(ownerId);
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
// Report error
|
if (holder instanceof IOptionCategory) {
|
||||||
ManagedBuildManager.OutputResolveError(
|
// Report error, only if the parent is a tool and thus also
|
||||||
"owner", //$NON-NLS-1$
|
// an option category.
|
||||||
ownerId,
|
ManagedBuildManager.OutputResolveError(
|
||||||
"optionCategory", //$NON-NLS-1$
|
"owner", //$NON-NLS-1$
|
||||||
getId());
|
ownerId,
|
||||||
|
"optionCategory", //$NON-NLS-1$
|
||||||
|
getId());
|
||||||
|
error = true;
|
||||||
|
} else if ( false == holder.getId().equals(ownerId) ) {
|
||||||
|
// Report error, if the holder ID does not match the owner's ID.
|
||||||
|
ManagedBuildManager.OutputResolveError(
|
||||||
|
"owner", //$NON-NLS-1$
|
||||||
|
ownerId,
|
||||||
|
"optionCategory", //$NON-NLS-1$
|
||||||
|
getId());
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
owner = tool;
|
owner = getNullOptionCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook me in
|
// Hook me in
|
||||||
if (owner instanceof Tool)
|
if (owner == null && error == false)
|
||||||
|
((HoldsOptions)holder).addChildCategory(this);
|
||||||
|
else if (owner instanceof Tool)
|
||||||
((Tool)owner).addChildCategory(this);
|
((Tool)owner).addChildCategory(this);
|
||||||
else
|
else
|
||||||
((OptionCategory)owner).addChildCategory(this);
|
((OptionCategory)owner).addChildCategory(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment this code after the 'parent' is available
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the managedBuildRevision.
|
* @return Returns the managedBuildRevision.
|
||||||
*
|
*/
|
||||||
public String getManagedBuildRevision() {
|
public String getManagedBuildRevision() {
|
||||||
if ( managedBuildRevision == null) {
|
if ( managedBuildRevision == null) {
|
||||||
if ( getParent() != null) {
|
if ( getOptionHolder() != null) {
|
||||||
return getParent().getManagedBuildRevision();
|
return getOptionHolder().getManagedBuildRevision();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return managedBuildRevision;
|
return managedBuildRevision;
|
||||||
|
@ -333,11 +441,11 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the version.
|
* @return Returns the version.
|
||||||
*
|
*/
|
||||||
public PluginVersionIdentifier getVersion() {
|
public PluginVersionIdentifier getVersion() {
|
||||||
if ( version == null) {
|
if ( version == null) {
|
||||||
if ( getParent() != null) {
|
if ( getOptionHolder() != null) {
|
||||||
return getParent().getVersion();
|
return getOptionHolder().getVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
|
@ -346,6 +454,5 @@ public class OptionCategory extends BuildObject implements IOptionCategory {
|
||||||
public void setVersion(PluginVersionIdentifier version) {
|
public void setVersion(PluginVersionIdentifier version) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,15 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
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.ITool;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -503,7 +506,14 @@ public class OptionReference implements IOption {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOption#getParent()
|
* @see org.eclipse.cdt.core.build.managed.IOption#getParent()
|
||||||
*/
|
*/
|
||||||
public ITool getParent() {
|
public IBuildObject getParent() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getOptionHolder()
|
||||||
|
*/
|
||||||
|
public IHoldsOptions getOptionHolder() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,4 +754,37 @@ public class OptionReference implements IOption {
|
||||||
return option.getManagedBuildRevision();
|
return option.getManagedBuildRevision();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getValueHandlerElement()
|
||||||
|
*/
|
||||||
|
public IConfigurationElement getValueHandlerElement() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#setValueHandlerElement(IConfigurationElement)
|
||||||
|
*/
|
||||||
|
public void setValueHandlerElement(IConfigurationElement element) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getValueHandler()
|
||||||
|
*/
|
||||||
|
public IManagedOptionValueHandler getValueHandler() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOption#getValueHandlerExtraArgument())
|
||||||
|
*/
|
||||||
|
public String getValueHandlerExtraArgument() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IOption#isValid()
|
||||||
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
return option.isValid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,10 @@ ManagedBuildManager.error.manifest.version.error=The version number defined in t
|
||||||
ManagedBuildManager.error.manifest.header=Managed Build system manifest file error:
|
ManagedBuildManager.error.manifest.header=Managed Build system manifest file error:
|
||||||
ManagedBuildManager.error.manifest.resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
|
ManagedBuildManager.error.manifest.resolving=Unable to resolve the {0} identifier {1} in the {2} {3}.
|
||||||
ManagedBuildManager.error.manifest.duplicate=Duplicate identifier {1} for element type {0}.
|
ManagedBuildManager.error.manifest.duplicate=Duplicate identifier {1} for element type {0}.
|
||||||
|
ManagedBuildManager.error.manifest.icon=Could not load icon "{0}".
|
||||||
|
ManagedBuildManager.error.manifest.option.category=Option {0} uses a null category that is invalid in its context. The option was ignored.
|
||||||
|
ManagedBuildManager.error.manifest.option.filter=Option {0} uses an unsupported resourceFilter attribute value. The option was ignored.
|
||||||
|
ManagedBuildManager.error.manifest.option.valuehandler=Could not load value handler {0} in option {1}.
|
||||||
ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
|
ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
|
||||||
ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error.\n\n{0}\n\nManaged Make functionality will not be available for this project.
|
ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error.\n\n{0}\n\nManaged Make functionality will not be available for this project.
|
||||||
ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
|
ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
|
import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
@ -191,6 +192,7 @@ public class ProjectType extends BuildObject implements IProjectType {
|
||||||
*/
|
*/
|
||||||
public IConfiguration createConfiguration(IConfiguration parent, String id, String name) {
|
public IConfiguration createConfiguration(IConfiguration parent, String id, String name) {
|
||||||
Configuration config = new Configuration(this, parent, id, name);
|
Configuration config = new Configuration(this, parent, id, name);
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
|
||||||
return (IConfiguration)config;
|
return (IConfiguration)config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,13 @@ 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.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
|
@ -477,6 +480,9 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
public void reset() {
|
public void reset() {
|
||||||
// We just need to remove all Options
|
// We just need to remove all Options
|
||||||
ITool[] tools = getTools();
|
ITool[] tools = getTools();
|
||||||
|
// Send out the event to notify the options that they are about to be removed
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(this, IManagedOptionValueHandler.EVENT_CLOSE);
|
||||||
|
// Remove the configurations
|
||||||
for (int i = 0; i < tools.length; i++) {
|
for (int i = 0; i < tools.length; i++) {
|
||||||
ITool tool = tools[i];
|
ITool tool = tools[i];
|
||||||
IOption[] opts = tool.getOptions();
|
IOption[] opts = tool.getOptions();
|
||||||
|
@ -495,13 +501,23 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
tool.setToolCommand(command);
|
tool.setToolCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOption setOption(ITool tool, IOption option, boolean value) throws BuildException {
|
private IBuildObject getHoldersParent(IOption option) {
|
||||||
|
IHoldsOptions holder = option.getOptionHolder();
|
||||||
|
if (holder instanceof ITool) {
|
||||||
|
return ((ITool)holder).getParent();
|
||||||
|
} else if (holder instanceof IToolChain) {
|
||||||
|
return ((IToolChain)holder).getParent();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOption setOption(IHoldsOptions holder, IOption option, boolean value) throws BuildException {
|
||||||
// Is there a change?
|
// Is there a change?
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
if (option.getBooleanValue() != value) {
|
if (option.getBooleanValue() != value) {
|
||||||
// If this resource config does not already override this option, then we need to
|
// If this resource config does not already override this option, then we need to
|
||||||
// create a new option
|
// create a new option
|
||||||
if (option.getParent().getParent() != this) {
|
if (getHoldersParent(option) != this) {
|
||||||
IOption newSuperClass = option;
|
IOption newSuperClass = option;
|
||||||
if (!newSuperClass.isExtensionElement()) {
|
if (!newSuperClass.isExtensionElement()) {
|
||||||
newSuperClass = newSuperClass.getSuperClass();
|
newSuperClass = newSuperClass.getSuperClass();
|
||||||
|
@ -520,7 +536,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -534,14 +550,14 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
return retOpt;
|
return retOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOption setOption(ITool tool, IOption option, String value) throws BuildException {
|
public IOption setOption(IHoldsOptions holder, IOption option, String value) throws BuildException {
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
String oldValue;
|
String oldValue;
|
||||||
oldValue = option.getStringValue();
|
oldValue = option.getStringValue();
|
||||||
if (oldValue != null && !oldValue.equals(value)) {
|
if (oldValue != null && !oldValue.equals(value)) {
|
||||||
// If this resource config does not already override this option, then we need to
|
// If this resource config does not already override this option, then we need to
|
||||||
// create a new option
|
// create a new option
|
||||||
if (option.getParent().getParent() != this) {
|
if (getHoldersParent(option) != this) {
|
||||||
IOption newSuperClass = option;
|
IOption newSuperClass = option;
|
||||||
if (!newSuperClass.isExtensionElement()) {
|
if (!newSuperClass.isExtensionElement()) {
|
||||||
newSuperClass = newSuperClass.getSuperClass();
|
newSuperClass = newSuperClass.getSuperClass();
|
||||||
|
@ -560,7 +576,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -577,7 +593,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
|
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
|
||||||
*/
|
*/
|
||||||
public IOption setOption(ITool tool, IOption option, String[] value) throws BuildException {
|
public IOption setOption(IHoldsOptions holder, IOption option, String[] value) throws BuildException {
|
||||||
IOption retOpt = option;
|
IOption retOpt = option;
|
||||||
// Is there a change?
|
// Is there a change?
|
||||||
String[] oldValue;
|
String[] oldValue;
|
||||||
|
@ -604,7 +620,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
if(!Arrays.equals(value, oldValue)) {
|
if(!Arrays.equals(value, oldValue)) {
|
||||||
// If this resource config does not already override this option, then we need to
|
// If this resource config does not already override this option, then we need to
|
||||||
// create a new option
|
// create a new option
|
||||||
if (option.getParent().getParent() != this) {
|
if (getHoldersParent(option) != this) {
|
||||||
IOption newSuperClass = option;
|
IOption newSuperClass = option;
|
||||||
if (!newSuperClass.isExtensionElement()) {
|
if (!newSuperClass.isExtensionElement()) {
|
||||||
newSuperClass = newSuperClass.getSuperClass();
|
newSuperClass = newSuperClass.getSuperClass();
|
||||||
|
@ -623,7 +639,7 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
String subId;
|
String subId;
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
|
||||||
retOpt = tool.createOption(newSuperClass, subId, null, false);
|
retOpt = holder.createOption(newSuperClass, subId, null, false);
|
||||||
retOpt.setValueType(option.getValueType());
|
retOpt.setValueType(option.getValueType());
|
||||||
retOpt.setValue(value);
|
retOpt.setValue(value);
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
|
@ -641,7 +657,6 @@ public class ResourceConfiguration extends BuildObject implements IResourceConfi
|
||||||
return getParent().getOwner();
|
return getParent().getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the version.
|
* @return Returns the version.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -22,6 +24,7 @@ import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
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.IEnvVarBuildPath;
|
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||||
|
@ -55,7 +58,7 @@ import org.w3c.dom.NodeList;
|
||||||
* Note that this class implements IOptionCategory to represent the top
|
* Note that this class implements IOptionCategory to represent the top
|
||||||
* category.
|
* category.
|
||||||
*/
|
*/
|
||||||
public class Tool extends BuildObject implements ITool, IOptionCategory {
|
public class Tool extends HoldsOptions implements ITool, IOptionCategory {
|
||||||
|
|
||||||
public static final String DEFAULT_PATTERN = "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"; //$NON-NLS-1$
|
public static final String DEFAULT_PATTERN = "${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"; //$NON-NLS-1$
|
||||||
public static final String DEFAULT_CBS_PATTERN = "${COMMAND}"; //$NON-NLS-1$
|
public static final String DEFAULT_CBS_PATTERN = "${COMMAND}"; //$NON-NLS-1$
|
||||||
|
@ -68,16 +71,15 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private static final String DEFAULT_ANNOUNCEMENT_PREFIX = "Tool.default.announcement"; //$NON-NLS-1$
|
private static final String DEFAULT_ANNOUNCEMENT_PREFIX = "Tool.default.announcement"; //$NON-NLS-1$
|
||||||
private static final String WHITESPACE = " "; //$NON-NLS-1$
|
private static final String WHITESPACE = " "; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final boolean resolvedDefault = true;
|
||||||
|
|
||||||
// Superclass
|
// Superclass
|
||||||
private ITool superClass;
|
// Note that superClass itself is defined in the base and that the methods
|
||||||
|
// getSuperClass() and setSuperClass(), defined in Tool must be used to
|
||||||
|
// access it. This avoids widespread casts from IHoldsOptions to ITool.
|
||||||
private String superClassId;
|
private String superClassId;
|
||||||
// Parent and children
|
// Parent and children
|
||||||
private IBuildObject parent;
|
private IBuildObject parent;
|
||||||
private Vector categoryIds;
|
|
||||||
private Map categoryMap;
|
|
||||||
private List childOptionCategories;
|
|
||||||
private Vector optionList;
|
|
||||||
private Map optionMap;
|
|
||||||
private Vector inputTypeList;
|
private Vector inputTypeList;
|
||||||
private Map inputTypeMap;
|
private Map inputTypeMap;
|
||||||
private Vector outputTypeList;
|
private Vector outputTypeList;
|
||||||
|
@ -104,10 +106,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private IManagedCommandLineGenerator commandLineGenerator = null;
|
private IManagedCommandLineGenerator commandLineGenerator = null;
|
||||||
private IConfigurationElement dependencyGeneratorElement = null;
|
private IConfigurationElement dependencyGeneratorElement = null;
|
||||||
private IManagedDependencyGenerator dependencyGenerator = null;
|
private IManagedDependencyGenerator dependencyGenerator = null;
|
||||||
|
private URL iconPathURL;
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean isExtensionTool = false;
|
private boolean isExtensionTool = false;
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
private boolean resolved = true;
|
private boolean resolved = resolvedDefault;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C O N S T R U C T O R S
|
* C O N S T R U C T O R S
|
||||||
|
@ -121,11 +124,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||||
*/
|
*/
|
||||||
public Tool(IManagedConfigElement element, String managedBuildRevision) {
|
public Tool(IManagedConfigElement element, String managedBuildRevision) {
|
||||||
isExtensionTool = true;
|
|
||||||
|
|
||||||
// setup for resolving
|
// setup for resolving
|
||||||
|
super(false);
|
||||||
resolved = false;
|
resolved = false;
|
||||||
|
|
||||||
|
isExtensionTool = true;
|
||||||
|
|
||||||
// Set the managedBuildRevision
|
// Set the managedBuildRevision
|
||||||
setManagedBuildRevision(managedBuildRevision);
|
setManagedBuildRevision(managedBuildRevision);
|
||||||
|
|
||||||
|
@ -141,11 +145,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
IManagedConfigElement[] toolElements = element.getChildren();
|
IManagedConfigElement[] toolElements = element.getChildren();
|
||||||
for (int l = 0; l < toolElements.length; ++l) {
|
for (int l = 0; l < toolElements.length; ++l) {
|
||||||
IManagedConfigElement toolElement = toolElements[l];
|
IManagedConfigElement toolElement = toolElements[l];
|
||||||
if (toolElement.getName().equals(ITool.OPTION)) {
|
if (loadChild(toolElement)) {
|
||||||
Option option = new Option(this, toolElement);
|
// do nothing
|
||||||
addOption(option);
|
|
||||||
} else if (toolElement.getName().equals(ITool.OPTION_CAT)) {
|
|
||||||
new OptionCategory(this, toolElement);
|
|
||||||
} else if (toolElement.getName().equals(ITool.INPUT_TYPE)) {
|
} else if (toolElement.getName().equals(ITool.INPUT_TYPE)) {
|
||||||
InputType inputType = new InputType(this, toolElement);
|
InputType inputType = new InputType(this, toolElement);
|
||||||
addInputType(inputType);
|
addInputType(inputType);
|
||||||
|
@ -183,11 +184,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @param boolean Indicates whether this is an extension element or a managed project element
|
* @param boolean Indicates whether this is an extension element or a managed project element
|
||||||
*/
|
*/
|
||||||
public Tool(ToolChain parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
|
public Tool(ToolChain parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.superClass = superClass;
|
setSuperClass(superClass);
|
||||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||||
if (this.superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
superClassId = this.superClass.getId();
|
superClassId = getSuperClass().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
setId(Id);
|
setId(Id);
|
||||||
|
@ -215,11 +217,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Tool(ResourceConfiguration parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
|
public Tool(ResourceConfiguration parent, ITool superClass, String Id, String name, boolean isExtensionElement) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.superClass = superClass;
|
setSuperClass( superClass );
|
||||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||||
if (this.superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
superClassId = this.superClass.getId();
|
superClassId = getSuperClass().getId();
|
||||||
}
|
}
|
||||||
setId(Id);
|
setId(Id);
|
||||||
setName(name);
|
setName(name);
|
||||||
|
@ -244,6 +247,7 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||||
*/
|
*/
|
||||||
public Tool(IBuildObject parent, Element element, String managedBuildRevision) {
|
public Tool(IBuildObject parent, Element element, String managedBuildRevision) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
isExtensionTool = false;
|
isExtensionTool = false;
|
||||||
|
|
||||||
|
@ -260,11 +264,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
NodeList toolElements = element.getChildNodes();
|
NodeList toolElements = element.getChildNodes();
|
||||||
for (int i = 0; i < toolElements.getLength(); ++i) {
|
for (int i = 0; i < toolElements.getLength(); ++i) {
|
||||||
Node toolElement = toolElements.item(i);
|
Node toolElement = toolElements.item(i);
|
||||||
if (toolElement.getNodeName().equals(ITool.OPTION)) {
|
if (loadChild(toolElement)) {
|
||||||
Option option = new Option(this, (Element)toolElement);
|
// do nothing
|
||||||
addOption(option);
|
|
||||||
} else if (toolElement.getNodeName().equals(ITool.OPTION_CAT)) {
|
|
||||||
new OptionCategory(this, (Element)toolElement);
|
|
||||||
} else if (toolElement.getNodeName().equals(ITool.INPUT_TYPE)) {
|
} else if (toolElement.getNodeName().equals(ITool.INPUT_TYPE)) {
|
||||||
InputType inputType = new InputType(this, (Element)toolElement);
|
InputType inputType = new InputType(this, (Element)toolElement);
|
||||||
addInputType(inputType);
|
addInputType(inputType);
|
||||||
|
@ -283,14 +284,15 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @param tool The existing tool to clone.
|
* @param tool The existing tool to clone.
|
||||||
*/
|
*/
|
||||||
public Tool(IBuildObject parent, ITool toolSuperClass, String Id, String name, Tool tool){
|
public Tool(IBuildObject parent, ITool toolSuperClass, String Id, String name, Tool tool){
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
if (toolSuperClass != null) {
|
if (toolSuperClass != null) {
|
||||||
superClass = toolSuperClass;
|
setSuperClass( toolSuperClass );
|
||||||
} else {
|
} else {
|
||||||
superClass = tool.superClass;
|
setSuperClass( tool.getSuperClass() );
|
||||||
}
|
}
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
superClassId = superClass.getId();
|
superClassId = getSuperClass().getId();
|
||||||
}
|
}
|
||||||
setId(Id);
|
setId(Id);
|
||||||
setName(name);
|
setName(name);
|
||||||
|
@ -356,27 +358,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
if(tool.envVarBuildPathList != null)
|
if(tool.envVarBuildPathList != null)
|
||||||
envVarBuildPathList = new ArrayList(tool.envVarBuildPathList);
|
envVarBuildPathList = new ArrayList(tool.envVarBuildPathList);
|
||||||
|
|
||||||
|
// Clone the children in superclass
|
||||||
|
super.copyChildren(tool);
|
||||||
// Clone the children
|
// Clone the children
|
||||||
// Note: This constructor ignores OptionCategories since they should not be
|
|
||||||
// found on an non-extension tool - TODO: This may need to change!
|
|
||||||
if (tool.optionList != null) {
|
|
||||||
Iterator iter = tool.getOptionList().listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Option option = (Option) iter.next();
|
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
|
||||||
String subId;
|
|
||||||
String subName;
|
|
||||||
if (option.getSuperClass() != null) {
|
|
||||||
subId = option.getSuperClass().getId() + "." + nnn; //$NON-NLS-1$
|
|
||||||
subName = option.getSuperClass().getName();
|
|
||||||
} else {
|
|
||||||
subId = option.getId() + "." + nnn; //$NON-NLS-1$
|
|
||||||
subName = option.getName();
|
|
||||||
}
|
|
||||||
Option newOption = new Option(this, subId, subName, option);
|
|
||||||
addOption(newOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tool.inputTypeList != null) {
|
if (tool.inputTypeList != null) {
|
||||||
Iterator iter = tool.getInputTypeList().listIterator();
|
Iterator iter = tool.getInputTypeList().listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
|
@ -414,6 +398,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// icon
|
||||||
|
if ( tool.iconPathURL != null ) {
|
||||||
|
iconPathURL = tool.iconPathURL;
|
||||||
|
}
|
||||||
|
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +522,13 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
if (depGenerator != null && element instanceof DefaultManagedConfigElement) {
|
if (depGenerator != null && element instanceof DefaultManagedConfigElement) {
|
||||||
dependencyGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
dependencyGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// icon
|
||||||
|
if ( element.getAttribute(IOptionCategory.ICON) != null && element instanceof DefaultManagedConfigElement)
|
||||||
|
{
|
||||||
|
String icon = element.getAttribute(IOptionCategory.ICON);
|
||||||
|
iconPathURL = ManagedBuildManager.getURLInBuildDefinitions( (DefaultManagedConfigElement)element, new Path(icon) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -559,11 +555,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
if (superClassId != null && superClassId.length() > 0) {
|
if (superClassId != null && superClassId.length() > 0) {
|
||||||
if( getParent() instanceof IResourceConfiguration ) {
|
if( getParent() instanceof IResourceConfiguration ) {
|
||||||
IResourceConfiguration resConfig = (IResourceConfiguration) getParent();
|
IResourceConfiguration resConfig = (IResourceConfiguration) getParent();
|
||||||
superClass = resConfig.getParent().getTool(superClassId);
|
setSuperClass( resConfig.getParent().getTool(superClassId) );
|
||||||
} else {
|
} else {
|
||||||
superClass = ManagedBuildManager.getExtensionTool(superClassId);
|
setSuperClass( ManagedBuildManager.getExtensionTool(superClassId) );
|
||||||
}
|
}
|
||||||
if (superClass == null) {
|
if (getSuperClass() == null) {
|
||||||
// TODO: Report error
|
// TODO: Report error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -679,6 +675,18 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
if (element.hasAttribute(ITool.ANNOUNCEMENT)) {
|
if (element.hasAttribute(ITool.ANNOUNCEMENT)) {
|
||||||
announcement = element.getAttribute(ITool.ANNOUNCEMENT);
|
announcement = element.getAttribute(ITool.ANNOUNCEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// icon - was saved as URL in string form
|
||||||
|
if (element.hasAttribute(IOptionCategory.ICON)) {
|
||||||
|
String iconPath = element.getAttribute(IOptionCategory.ICON);
|
||||||
|
try {
|
||||||
|
iconPathURL = new URL(iconPath);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
// Print a warning
|
||||||
|
ManagedBuildManager.OutputIconError(iconPath);
|
||||||
|
iconPathURL = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,8 +697,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public void serialize(Document doc, Element element) {
|
public void serialize(Document doc, Element element) {
|
||||||
try {
|
try {
|
||||||
if (superClass != null)
|
if (getSuperClass() != null)
|
||||||
element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
|
element.setAttribute(IProjectType.SUPERCLASS, getSuperClass().getId());
|
||||||
|
|
||||||
// id
|
// id
|
||||||
element.setAttribute(IBuildObject.ID, id);
|
element.setAttribute(IBuildObject.ID, id);
|
||||||
|
@ -804,24 +812,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
element.setAttribute(ITool.ANNOUNCEMENT, announcement);
|
element.setAttribute(ITool.ANNOUNCEMENT, announcement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serialize elements from my super class
|
||||||
|
super.serialize(doc, element);
|
||||||
|
|
||||||
// Serialize my children
|
// Serialize my children
|
||||||
if (childOptionCategories != null) {
|
Iterator iter;
|
||||||
Iterator iter = childOptionCategories.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
OptionCategory optCat = (OptionCategory)iter.next();
|
|
||||||
Element optCatElement = doc.createElement(OPTION);
|
|
||||||
element.appendChild(optCatElement);
|
|
||||||
optCat.serialize(doc, optCatElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List optionElements = getOptionList();
|
|
||||||
Iterator iter = optionElements.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Option option = (Option) iter.next();
|
|
||||||
Element optionElement = doc.createElement(OPTION);
|
|
||||||
element.appendChild(optionElement);
|
|
||||||
option.serialize(doc, optionElement);
|
|
||||||
}
|
|
||||||
List typeElements = getInputTypeList();
|
List typeElements = getInputTypeList();
|
||||||
iter = typeElements.listIterator();
|
iter = typeElements.listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
|
@ -851,6 +846,11 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
// TODO: issue warning?
|
// TODO: issue warning?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iconPathURL != null) {
|
||||||
|
// Save as URL in string form
|
||||||
|
element.setAttribute(IOptionCategory.ICON, iconPathURL.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// I am clean now
|
// I am clean now
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -876,69 +876,6 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
this.parent = newParent;
|
this.parent = newParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#createOption(IOption, String, String, boolean)
|
|
||||||
*/
|
|
||||||
public IOption createOption(IOption superClass, String Id, String name, boolean isExtensionElement) {
|
|
||||||
Option option = new Option(this, superClass, Id, name, isExtensionElement);
|
|
||||||
addOption(option);
|
|
||||||
setDirty(true);
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#removeOption(IOption)
|
|
||||||
*/
|
|
||||||
public void removeOption(IOption option) {
|
|
||||||
getOptionList().remove(option);
|
|
||||||
getOptionMap().remove(option.getId());
|
|
||||||
setDirty(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#getOptions()
|
|
||||||
*/
|
|
||||||
public IOption[] getOptions() {
|
|
||||||
IOption[] options = null;
|
|
||||||
// Merge our options with our superclass' options.
|
|
||||||
if (superClass != null) {
|
|
||||||
options = superClass.getOptions();
|
|
||||||
}
|
|
||||||
// Our options take precedence.
|
|
||||||
Vector ourOpts = getOptionList();
|
|
||||||
if (options != null) {
|
|
||||||
for (int i = 0; i < ourOpts.size(); i++) {
|
|
||||||
IOption ourOpt = (IOption)ourOpts.get(i);
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < options.length; j++) {
|
|
||||||
if (options[j].overridesOnlyValue()) {
|
|
||||||
if (ourOpt.getSuperClass().getId().equals(options[j].getSuperClass().getId())) {
|
|
||||||
options[j] = ourOpt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (ourOpt.getSuperClass().getId().equals(options[j].getId())) {
|
|
||||||
options[j] = ourOpt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No Match? Add it.
|
|
||||||
if (j == options.length) {
|
|
||||||
IOption[] newOptions = new IOption[options.length + 1];
|
|
||||||
for (int k = 0; k < options.length; k++) {
|
|
||||||
newOptions[k] = options[k];
|
|
||||||
}
|
|
||||||
newOptions[j] = ourOpt;
|
|
||||||
options = newOptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
options = (IOption[])ourOpts.toArray(new IOption[ourOpts.size()]);
|
|
||||||
}
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#getTopOptionCategory()
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#getTopOptionCategory()
|
||||||
*/
|
*/
|
||||||
|
@ -946,63 +883,6 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#getOption(java.lang.String)
|
|
||||||
*/
|
|
||||||
public IOption getOption(String id) {
|
|
||||||
return getOptionById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOptionById(java.lang.String)
|
|
||||||
*/
|
|
||||||
public IOption getOptionById(String id) {
|
|
||||||
IOption opt = (IOption)getOptionMap().get(id);
|
|
||||||
if (opt == null) {
|
|
||||||
if (superClass != null) {
|
|
||||||
return superClass.getOptionById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return opt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getOptionBySuperClassId(java.lang.String)
|
|
||||||
*/
|
|
||||||
public IOption getOptionBySuperClassId(String optionId) {
|
|
||||||
if (optionId == null) return null;
|
|
||||||
|
|
||||||
// Look for an option with this ID, or an option with a superclass with this id
|
|
||||||
IOption[] options = getOptions();
|
|
||||||
for (int i = 0; i < options.length; i++) {
|
|
||||||
IOption targetOption = options[i];
|
|
||||||
IOption option = targetOption;
|
|
||||||
do {
|
|
||||||
if (optionId.equals(option.getId())) {
|
|
||||||
return targetOption;
|
|
||||||
}
|
|
||||||
option = option.getSuperClass();
|
|
||||||
} while (option != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getChildCategories()
|
|
||||||
*/
|
|
||||||
public IOptionCategory[] getChildCategories() {
|
|
||||||
if (childOptionCategories != null)
|
|
||||||
return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
|
|
||||||
else {
|
|
||||||
if (superClass != null) {
|
|
||||||
return superClass.getChildCategories();
|
|
||||||
} else {
|
|
||||||
return EMPTY_CATEGORIES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#createInputType(IInputType, String, String, boolean)
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#createInputType(IInputType, String, String, boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -1028,8 +908,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public IInputType[] getInputTypes() {
|
public IInputType[] getInputTypes() {
|
||||||
IInputType[] types = null;
|
IInputType[] types = null;
|
||||||
// Merge our input types with our superclass' input types.
|
// Merge our input types with our superclass' input types.
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
types = superClass.getInputTypes();
|
types = getSuperClass().getInputTypes();
|
||||||
}
|
}
|
||||||
// Our options take precedence.
|
// Our options take precedence.
|
||||||
Vector ourTypes = getInputTypeList();
|
Vector ourTypes = getInputTypeList();
|
||||||
|
@ -1069,8 +949,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public IInputType getInputTypeById(String id) {
|
public IInputType getInputTypeById(String id) {
|
||||||
IInputType type = (IInputType)getInputTypeMap().get(id);
|
IInputType type = (IInputType)getInputTypeMap().get(id);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getInputTypeById(id);
|
return getSuperClass().getInputTypeById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
@ -1101,8 +981,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public IOutputType[] getOutputTypes() {
|
public IOutputType[] getOutputTypes() {
|
||||||
IOutputType[] types = null;
|
IOutputType[] types = null;
|
||||||
// Merge our output types with our superclass' output types.
|
// Merge our output types with our superclass' output types.
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
types = superClass.getOutputTypes();
|
types = getSuperClass().getOutputTypes();
|
||||||
}
|
}
|
||||||
// Our options take precedence.
|
// Our options take precedence.
|
||||||
Vector ourTypes = getOutputTypeList();
|
Vector ourTypes = getOutputTypeList();
|
||||||
|
@ -1157,8 +1037,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public IOutputType getOutputTypeById(String id) {
|
public IOutputType getOutputTypeById(String id) {
|
||||||
IOutputType type = (IOutputType)getOutputTypeMap().get(id);
|
IOutputType type = (IOutputType)getOutputTypeMap().get(id);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getOutputTypeById(id);
|
return getSuperClass().getOutputTypeById(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
@ -1171,6 +1051,16 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getIconPath()
|
||||||
|
*/
|
||||||
|
public URL getIconPath() {
|
||||||
|
if (iconPathURL == null && getSuperClass() != null) {
|
||||||
|
return getSuperClass().getTopOptionCategory().getIconPath();
|
||||||
|
}
|
||||||
|
return iconPathURL;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
|
||||||
*/
|
*/
|
||||||
|
@ -1248,81 +1138,10 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* Memory-safe way to access the vector of category IDs
|
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptionHolder()
|
||||||
*/
|
*/
|
||||||
private Vector getCategoryIds() {
|
public IHoldsOptions getOptionHolder() {
|
||||||
if (categoryIds == null) {
|
return this;
|
||||||
categoryIds = new Vector();
|
|
||||||
}
|
|
||||||
return categoryIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param category
|
|
||||||
*/
|
|
||||||
public void addChildCategory(IOptionCategory category) {
|
|
||||||
if (childOptionCategories == null)
|
|
||||||
childOptionCategories = new ArrayList();
|
|
||||||
childOptionCategories.add(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param option
|
|
||||||
*/
|
|
||||||
public void addOption(Option option) {
|
|
||||||
getOptionList().add(option);
|
|
||||||
getOptionMap().put(option.getId(), option);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param category
|
|
||||||
*/
|
|
||||||
protected void addOptionCategory(IOptionCategory category) {
|
|
||||||
// To preserve the order of the categories, record the ids in the order they are read
|
|
||||||
getCategoryIds().add(category.getId());
|
|
||||||
// Map the categories by ID for resolution later
|
|
||||||
getCategoryMap().put(category.getId(), category);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Answers the <code>IOptionCategory</code> that has the unique identifier
|
|
||||||
* specified in the argument.
|
|
||||||
*
|
|
||||||
* @param id The unique identifier of the option category
|
|
||||||
* @return <code>IOptionCategory</code> with the id specified in the argument
|
|
||||||
*/
|
|
||||||
public IOptionCategory getOptionCategory(String id) {
|
|
||||||
return (IOptionCategory)getCategoryMap().get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* Memeory-safe way to access the map of category IDs to categories
|
|
||||||
*/
|
|
||||||
private Map getCategoryMap() {
|
|
||||||
if (categoryMap == null) {
|
|
||||||
categoryMap = new HashMap();
|
|
||||||
}
|
|
||||||
return categoryMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* Memory-safe way to access the list of options
|
|
||||||
*/
|
|
||||||
private Vector getOptionList() {
|
|
||||||
if (optionList == null) {
|
|
||||||
optionList = new Vector();
|
|
||||||
}
|
|
||||||
return optionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* Memory-safe way to access the list of IDs to options
|
|
||||||
*/
|
|
||||||
private Map getOptionMap() {
|
|
||||||
if (optionMap == null) {
|
|
||||||
optionMap = new HashMap();
|
|
||||||
}
|
|
||||||
return optionMap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1389,14 +1208,22 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#getSuperClass()
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#getSuperClass()
|
||||||
*/
|
*/
|
||||||
public ITool getSuperClass() {
|
public ITool getSuperClass() {
|
||||||
return superClass;
|
return (ITool)superClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Access function to set the superclass element that is defined in
|
||||||
|
* the base class.
|
||||||
|
*/
|
||||||
|
private void setSuperClass(ITool superClass) {
|
||||||
|
this.superClass = superClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.ITool#getName()
|
* @see org.eclipse.cdt.core.build.managed.ITool#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (name == null && superClass != null) ? superClass.getName() : name;
|
return (name == null && getSuperClass() != null) ? getSuperClass().getName() : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1435,8 +1262,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
String ids = errorParserIds;
|
String ids = errorParserIds;
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
ids = superClass.getErrorParserIds();
|
ids = getSuperClass().getErrorParserIds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ids;
|
return ids;
|
||||||
|
@ -1483,8 +1310,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private List getInputExtensionsAttribute() {
|
private List getInputExtensionsAttribute() {
|
||||||
if( (inputExtensions == null) || ( inputExtensions.size() == 0) ) {
|
if( (inputExtensions == null) || ( inputExtensions.size() == 0) ) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return ((Tool)superClass).getInputExtensionsAttribute();
|
return ((Tool)getSuperClass()).getInputExtensionsAttribute();
|
||||||
} else {
|
} else {
|
||||||
inputExtensions = new ArrayList();
|
inputExtensions = new ArrayList();
|
||||||
}
|
}
|
||||||
|
@ -1699,8 +1526,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
private List getHeaderExtensionsAttribute() {
|
private List getHeaderExtensionsAttribute() {
|
||||||
if (interfaceExtensions == null || interfaceExtensions.size() == 0) {
|
if (interfaceExtensions == null || interfaceExtensions.size() == 0) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return ((Tool)superClass).getHeaderExtensionsAttribute();
|
return ((Tool)getSuperClass()).getHeaderExtensionsAttribute();
|
||||||
} else {
|
} else {
|
||||||
if (interfaceExtensions == null) {
|
if (interfaceExtensions == null) {
|
||||||
interfaceExtensions = new ArrayList();
|
interfaceExtensions = new ArrayList();
|
||||||
|
@ -1723,8 +1550,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public String getOutputFlag() {
|
public String getOutputFlag() {
|
||||||
if (outputFlag == null) {
|
if (outputFlag == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getOutputFlag();
|
return getSuperClass().getOutputFlag();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -1755,8 +1582,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
// If there are no OutputTypes, use the deprecated Tool attribute
|
// If there are no OutputTypes, use the deprecated Tool attribute
|
||||||
if (outputPrefix == null) {
|
if (outputPrefix == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getOutputPrefix();
|
return getSuperClass().getOutputPrefix();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -1770,8 +1597,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public String getToolCommand() {
|
public String getToolCommand() {
|
||||||
if (command == null) {
|
if (command == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getToolCommand();
|
return getSuperClass().getToolCommand();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -1784,8 +1611,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public String getCommandLinePattern() {
|
public String getCommandLinePattern() {
|
||||||
if (commandLinePattern == null) {
|
if (commandLinePattern == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getCommandLinePattern();
|
return getSuperClass().getCommandLinePattern();
|
||||||
} else {
|
} else {
|
||||||
if (getCustomBuildStep()) {
|
if (getCustomBuildStep()) {
|
||||||
return new String(DEFAULT_CBS_PATTERN); // Default pattern
|
return new String(DEFAULT_CBS_PATTERN); // Default pattern
|
||||||
|
@ -1802,8 +1629,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public boolean getAdvancedInputCategory() {
|
public boolean getAdvancedInputCategory() {
|
||||||
if (advancedInputCategory == null) {
|
if (advancedInputCategory == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getAdvancedInputCategory();
|
return getSuperClass().getAdvancedInputCategory();
|
||||||
} else {
|
} else {
|
||||||
return false; // default is false
|
return false; // default is false
|
||||||
}
|
}
|
||||||
|
@ -1816,8 +1643,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public boolean getCustomBuildStep() {
|
public boolean getCustomBuildStep() {
|
||||||
if (customBuildStep == null) {
|
if (customBuildStep == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getCustomBuildStep();
|
return getSuperClass().getCustomBuildStep();
|
||||||
} else {
|
} else {
|
||||||
return false; // default is false
|
return false; // default is false
|
||||||
}
|
}
|
||||||
|
@ -1830,8 +1657,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public String getAnnouncement() {
|
public String getAnnouncement() {
|
||||||
if (announcement == null) {
|
if (announcement == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getAnnouncement();
|
return getSuperClass().getAnnouncement();
|
||||||
} else {
|
} else {
|
||||||
// Generate the default announcement string for the Tool
|
// Generate the default announcement string for the Tool
|
||||||
String defaultAnnouncement = ManagedMakeMessages.getResourceString(DEFAULT_ANNOUNCEMENT_PREFIX) +
|
String defaultAnnouncement = ManagedMakeMessages.getResourceString(DEFAULT_ANNOUNCEMENT_PREFIX) +
|
||||||
|
@ -1847,8 +1674,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public IConfigurationElement getCommandLineGeneratorElement() {
|
public IConfigurationElement getCommandLineGeneratorElement() {
|
||||||
if (commandLineGeneratorElement == null) {
|
if (commandLineGeneratorElement == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return ((Tool)superClass).getCommandLineGeneratorElement();
|
return ((Tool)getSuperClass()).getCommandLineGeneratorElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return commandLineGeneratorElement;
|
return commandLineGeneratorElement;
|
||||||
|
@ -1917,8 +1744,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
|
|
||||||
private IConfigurationElement getToolDependencyGeneratorElement() {
|
private IConfigurationElement getToolDependencyGeneratorElement() {
|
||||||
if (dependencyGeneratorElement == null) {
|
if (dependencyGeneratorElement == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return ((Tool)superClass).getToolDependencyGeneratorElement();
|
return ((Tool)getSuperClass()).getToolDependencyGeneratorElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dependencyGeneratorElement;
|
return dependencyGeneratorElement;
|
||||||
|
@ -1978,8 +1805,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public int getNatureFilter() {
|
public int getNatureFilter() {
|
||||||
if (natureFilter == null) {
|
if (natureFilter == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getNatureFilter();
|
return getSuperClass().getNatureFilter();
|
||||||
} else {
|
} else {
|
||||||
return FILTER_BOTH;
|
return FILTER_BOTH;
|
||||||
}
|
}
|
||||||
|
@ -2028,8 +1855,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public String[] getOutputsAttribute() {
|
public String[] getOutputsAttribute() {
|
||||||
// TODO: Why is this treated differently than inputExtensions?
|
// TODO: Why is this treated differently than inputExtensions?
|
||||||
if (outputExtensions == null) {
|
if (outputExtensions == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getOutputsAttribute();
|
return getSuperClass().getOutputsAttribute();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2232,7 +2059,14 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
|
|
||||||
// check to see if the option has an applicability calculator
|
// check to see if the option has an applicability calculator
|
||||||
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(this)) {
|
IBuildObject config = null;
|
||||||
|
IBuildObject parent = getParent();
|
||||||
|
if ( parent instanceof IResourceConfiguration ) {
|
||||||
|
config = parent;
|
||||||
|
} else if ( parent instanceof IToolChain ){
|
||||||
|
config = ((IToolChain)parent).getParent();
|
||||||
|
}
|
||||||
|
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(config, this, option)) {
|
||||||
try{
|
try{
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
case IOption.BOOLEAN :
|
case IOption.BOOLEAN :
|
||||||
|
@ -2424,11 +2258,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
if (isDirty) return true;
|
if (isDirty) return true;
|
||||||
|
|
||||||
// Otherwise see if any options need saving
|
// Otherwise see if any options need saving
|
||||||
List optionElements = getOptionList();
|
if (super.isDirty()) {
|
||||||
Iterator iter = optionElements.listIterator();
|
return true;
|
||||||
while (iter.hasNext()) {
|
|
||||||
Option option = (Option) iter.next();
|
|
||||||
if (option.isDirty()) return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isDirty;
|
return isDirty;
|
||||||
|
@ -2439,16 +2270,12 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
*/
|
*/
|
||||||
public void setDirty(boolean isDirty) {
|
public void setDirty(boolean isDirty) {
|
||||||
this.isDirty = isDirty;
|
this.isDirty = isDirty;
|
||||||
|
// Propagate "false" to options
|
||||||
|
super.setDirty(isDirty);
|
||||||
// Propagate "false" to the children
|
// Propagate "false" to the children
|
||||||
if (!isDirty) {
|
if (!isDirty) {
|
||||||
List optionElements = getOptionList();
|
|
||||||
Iterator iter = optionElements.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Option option = (Option) iter.next();
|
|
||||||
option.setDirty(false);
|
|
||||||
}
|
|
||||||
List typeElements = getInputTypeList();
|
List typeElements = getInputTypeList();
|
||||||
iter = typeElements.listIterator();
|
Iterator iter = typeElements.listIterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
InputType type = (InputType) iter.next();
|
InputType type = (InputType) iter.next();
|
||||||
type.setDirty(false);
|
type.setDirty(false);
|
||||||
|
@ -2470,8 +2297,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
// Resolve superClass
|
// Resolve superClass
|
||||||
if (superClassId != null && superClassId.length() > 0) {
|
if (superClassId != null && superClassId.length() > 0) {
|
||||||
superClass = ManagedBuildManager.getExtensionTool(superClassId);
|
setSuperClass( ManagedBuildManager.getExtensionTool(superClassId) );
|
||||||
if (superClass == null) {
|
if (getSuperClass() == null) {
|
||||||
// Report error
|
// Report error
|
||||||
ManagedBuildManager.OutputResolveError(
|
ManagedBuildManager.OutputResolveError(
|
||||||
"superClass", //$NON-NLS-1$
|
"superClass", //$NON-NLS-1$
|
||||||
|
@ -2480,12 +2307,9 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
getId());
|
getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Resolve HoldsOptions
|
||||||
|
super.resolveReferences();
|
||||||
// Call resolveReferences on our children
|
// Call resolveReferences on our children
|
||||||
Iterator optionIter = getOptionList().iterator();
|
|
||||||
while (optionIter.hasNext()) {
|
|
||||||
Option current = (Option)optionIter.next();
|
|
||||||
current.resolveReferences();
|
|
||||||
}
|
|
||||||
Iterator typeIter = getInputTypeList().iterator();
|
Iterator typeIter = getInputTypeList().iterator();
|
||||||
while (typeIter.hasNext()) {
|
while (typeIter.hasNext()) {
|
||||||
InputType current = (InputType)typeIter.next();
|
InputType current = (InputType)typeIter.next();
|
||||||
|
@ -2496,17 +2320,6 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
OutputType current = (OutputType)typeIter.next();
|
OutputType current = (OutputType)typeIter.next();
|
||||||
current.resolveReferences();
|
current.resolveReferences();
|
||||||
}
|
}
|
||||||
// Somewhat wasteful, but use the vector to retrieve the categories in proper order
|
|
||||||
Iterator catIter = getCategoryIds().iterator();
|
|
||||||
while (catIter.hasNext()) {
|
|
||||||
String id = (String)catIter.next();
|
|
||||||
IOptionCategory current = (IOptionCategory)getCategoryMap().get(id);
|
|
||||||
if (current instanceof Tool) {
|
|
||||||
((Tool)current).resolveReferences();
|
|
||||||
} else if (current instanceof OptionCategory) {
|
|
||||||
((OptionCategory)current).resolveReferences();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2526,8 +2339,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public String getConvertToId() {
|
public String getConvertToId() {
|
||||||
if (convertToId == null) {
|
if (convertToId == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getConvertToId();
|
return getSuperClass().getConvertToId();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -2553,8 +2366,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
public String getVersionsSupported() {
|
public String getVersionsSupported() {
|
||||||
if (versionsSupported == null) {
|
if (versionsSupported == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getVersionsSupported();
|
return getSuperClass().getVersionsSupported();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -2582,8 +2395,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
|
||||||
return (IEnvVarBuildPath[])envVarBuildPathList.toArray(
|
return (IEnvVarBuildPath[])envVarBuildPathList.toArray(
|
||||||
new IEnvVarBuildPath[envVarBuildPathList.size()]);
|
new IEnvVarBuildPath[envVarBuildPathList.size()]);
|
||||||
}
|
}
|
||||||
else if(superClass != null)
|
else if(getSuperClass() != null)
|
||||||
return superClass.getEnvVarBuildPaths();
|
return getSuperClass().getEnvVarBuildPaths();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,16 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
public class ToolChain extends BuildObject implements IToolChain {
|
public class ToolChain extends HoldsOptions implements IToolChain {
|
||||||
|
|
||||||
private static final String EMPTY_STRING = new String();
|
private static final String EMPTY_STRING = new String();
|
||||||
|
|
||||||
|
private static final boolean resolvedDefault = true;
|
||||||
|
|
||||||
// Superclass
|
// Superclass
|
||||||
private IToolChain superClass;
|
// Note that superClass itself is defined in the base and that the methods
|
||||||
|
// getSuperClass() and setSuperClass(), defined in ToolChain must be used
|
||||||
|
// to access it. This avoids widespread casts from IHoldsOptions to IToolChain.
|
||||||
private String superClassId;
|
private String superClassId;
|
||||||
// Parent and children
|
// Parent and children
|
||||||
private IConfiguration parent;
|
private IConfiguration parent;
|
||||||
|
@ -72,8 +76,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean isExtensionToolChain = false;
|
private boolean isExtensionToolChain = false;
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
private boolean resolved = true;
|
private boolean resolved = resolvedDefault;
|
||||||
//holds the user-defined macros
|
//holds the user-defined macros
|
||||||
private StorableMacros userDefinedMacros;
|
private StorableMacros userDefinedMacros;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -91,12 +95,13 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||||
*/
|
*/
|
||||||
public ToolChain(IConfiguration parent, IManagedConfigElement element, String managedBuildRevision) {
|
public ToolChain(IConfiguration parent, IManagedConfigElement element, String managedBuildRevision) {
|
||||||
|
// setup for resolving
|
||||||
|
super(false);
|
||||||
|
resolved = false;
|
||||||
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
isExtensionToolChain = true;
|
isExtensionToolChain = true;
|
||||||
|
|
||||||
// setup for resolving
|
|
||||||
resolved = false;
|
|
||||||
|
|
||||||
// Set the managedBuildRevision
|
// Set the managedBuildRevision
|
||||||
setManagedBuildRevision(managedBuildRevision);
|
setManagedBuildRevision(managedBuildRevision);
|
||||||
|
|
||||||
|
@ -125,11 +130,16 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
builder = new Builder(this, builders[0], managedBuildRevision);
|
builder = new Builder(this, builders[0], managedBuildRevision);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the tool children
|
// Load children
|
||||||
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
|
IManagedConfigElement[] toolChainElements = element.getChildren();
|
||||||
for (int n = 0; n < tools.length; ++n) {
|
for (int l = 0; l < toolChainElements.length; ++l) {
|
||||||
Tool toolChild = new Tool(this, tools[n], managedBuildRevision);
|
IManagedConfigElement toolChainElement = toolChainElements[l];
|
||||||
addTool(toolChild);
|
if (loadChild(toolChainElement)) {
|
||||||
|
// do nothing
|
||||||
|
} else if (toolChainElement.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
||||||
|
Tool toolChild = new Tool(this, toolChainElement, managedBuildRevision);
|
||||||
|
addTool(toolChild);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +154,13 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @param boolean Indicates whether this is an extension element or a managed project element
|
* @param boolean Indicates whether this is an extension element or a managed project element
|
||||||
*/
|
*/
|
||||||
public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) {
|
public ToolChain(Configuration parent, IToolChain superClass, String Id, String name, boolean isExtensionElement) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.superClass = superClass;
|
setSuperClass(superClass);
|
||||||
setManagedBuildRevision(parent.getManagedBuildRevision());
|
setManagedBuildRevision(parent.getManagedBuildRevision());
|
||||||
|
|
||||||
if (this.superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
superClassId = this.superClass.getId();
|
superClassId = getSuperClass().getId();
|
||||||
}
|
}
|
||||||
setId(Id);
|
setId(Id);
|
||||||
setName(name);
|
setName(name);
|
||||||
|
@ -173,6 +184,7 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @param managedBuildRevision the fileVersion of Managed Build System
|
* @param managedBuildRevision the fileVersion of Managed Build System
|
||||||
*/
|
*/
|
||||||
public ToolChain(IConfiguration parent, Element element, String managedBuildRevision) {
|
public ToolChain(IConfiguration parent, Element element, String managedBuildRevision) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
isExtensionToolChain = false;
|
isExtensionToolChain = false;
|
||||||
|
|
||||||
|
@ -186,7 +198,9 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
NodeList configElements = element.getChildNodes();
|
NodeList configElements = element.getChildNodes();
|
||||||
for (int i = 0; i < configElements.getLength(); ++i) {
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
Node configElement = configElements.item(i);
|
Node configElement = configElements.item(i);
|
||||||
if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
if (loadChild(configElement)) {
|
||||||
|
// do nothing
|
||||||
|
} else if (configElement.getNodeName().equals(ITool.TOOL_ELEMENT_NAME)) {
|
||||||
Tool tool = new Tool(this, (Element)configElement, managedBuildRevision);
|
Tool tool = new Tool(this, (Element)configElement, managedBuildRevision);
|
||||||
addTool(tool);
|
addTool(tool);
|
||||||
}else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
|
}else if (configElement.getNodeName().equals(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME)) {
|
||||||
|
@ -214,9 +228,10 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @param toolChain The existing tool-chain to clone.
|
* @param toolChain The existing tool-chain to clone.
|
||||||
*/
|
*/
|
||||||
public ToolChain(IConfiguration parent, String Id, String name, ToolChain toolChain) {
|
public ToolChain(IConfiguration parent, String Id, String name, ToolChain toolChain) {
|
||||||
|
super(resolvedDefault);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
superClass = toolChain.superClass;
|
setSuperClass(toolChain.getSuperClass());
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
if (toolChain.superClassId != null) {
|
if (toolChain.superClassId != null) {
|
||||||
superClassId = new String(toolChain.superClassId);
|
superClassId = new String(toolChain.superClassId);
|
||||||
}
|
}
|
||||||
|
@ -271,6 +286,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
buildMacroSupplierElement = toolChain.buildMacroSupplierElement;
|
buildMacroSupplierElement = toolChain.buildMacroSupplierElement;
|
||||||
buildMacroSupplier = toolChain.buildMacroSupplier;
|
buildMacroSupplier = toolChain.buildMacroSupplier;
|
||||||
|
|
||||||
|
// Clone the children in superclass
|
||||||
|
super.copyChildren(toolChain);
|
||||||
// Clone the children
|
// Clone the children
|
||||||
if (toolChain.builder != null) {
|
if (toolChain.builder != null) {
|
||||||
int nnn = ManagedBuildManager.getRandomNumber();
|
int nnn = ManagedBuildManager.getRandomNumber();
|
||||||
|
@ -455,8 +472,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
// superClass
|
// superClass
|
||||||
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
superClassId = element.getAttribute(IProjectType.SUPERCLASS);
|
||||||
if (superClassId != null && superClassId.length() > 0) {
|
if (superClassId != null && superClassId.length() > 0) {
|
||||||
superClass = ManagedBuildManager.getExtensionToolChain(superClassId);
|
setSuperClass( ManagedBuildManager.getExtensionToolChain(superClassId) );
|
||||||
if (superClass == null) {
|
if (getSuperClass() == null) {
|
||||||
// TODO: Report error
|
// TODO: Report error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,124 +553,130 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
public void serialize(Document doc, Element element) {
|
public void serialize(Document doc, Element element) {
|
||||||
if (superClass != null)
|
try {
|
||||||
element.setAttribute(IProjectType.SUPERCLASS, superClass.getId());
|
if (getSuperClass() != null)
|
||||||
|
element.setAttribute(IProjectType.SUPERCLASS, getSuperClass().getId());
|
||||||
|
|
||||||
element.setAttribute(IBuildObject.ID, id);
|
element.setAttribute(IBuildObject.ID, id);
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
element.setAttribute(IBuildObject.NAME, name);
|
element.setAttribute(IBuildObject.NAME, name);
|
||||||
}
|
|
||||||
|
|
||||||
if (unusedChildren != null) {
|
|
||||||
element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAbstract != null) {
|
|
||||||
element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorParserIds != null) {
|
|
||||||
element.setAttribute(ERROR_PARSERS, errorParserIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (secondaryOutputIds != null) {
|
|
||||||
element.setAttribute(SECONDARY_OUTPUTS, secondaryOutputIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetToolIds != null) {
|
|
||||||
element.setAttribute(TARGET_TOOL, targetToolIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scannerConfigDiscoveryProfileId != null) {
|
|
||||||
element.setAttribute(SCANNER_CONFIG_PROFILE_ID, scannerConfigDiscoveryProfileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// versionsSupported
|
|
||||||
if (versionsSupported != null) {
|
|
||||||
element.setAttribute(VERSIONS_SUPPORTED, versionsSupported);
|
|
||||||
}
|
|
||||||
|
|
||||||
// convertToId
|
|
||||||
if (convertToId != null) {
|
|
||||||
element.setAttribute(CONVERT_TO_ID, convertToId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (osList != null) {
|
|
||||||
Iterator osIter = osList.listIterator();
|
|
||||||
String listValue = EMPTY_STRING;
|
|
||||||
while (osIter.hasNext()) {
|
|
||||||
String current = (String) osIter.next();
|
|
||||||
listValue += current;
|
|
||||||
if ((osIter.hasNext())) {
|
|
||||||
listValue += ","; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
element.setAttribute(OS_LIST, listValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (archList != null) {
|
if (unusedChildren != null) {
|
||||||
Iterator archIter = archList.listIterator();
|
element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren);
|
||||||
String listValue = EMPTY_STRING;
|
|
||||||
while (archIter.hasNext()) {
|
|
||||||
String current = (String) archIter.next();
|
|
||||||
listValue += current;
|
|
||||||
if ((archIter.hasNext())) {
|
|
||||||
listValue += ","; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
element.setAttribute(ARCH_LIST, listValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serialize my children
|
if (isAbstract != null) {
|
||||||
if (targetPlatform != null) {
|
element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
|
||||||
Element targetPlatformElement = doc.createElement(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME);
|
}
|
||||||
element.appendChild(targetPlatformElement);
|
|
||||||
targetPlatform.serialize(doc, targetPlatformElement);
|
|
||||||
}
|
|
||||||
if (builder != null) {
|
|
||||||
Element builderElement = doc.createElement(IBuilder.BUILDER_ELEMENT_NAME);
|
|
||||||
element.appendChild(builderElement);
|
|
||||||
builder.serialize(doc, builderElement);
|
|
||||||
}
|
|
||||||
List toolElements = getToolList();
|
|
||||||
Iterator iter = toolElements.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Tool tool = (Tool) iter.next();
|
|
||||||
Element toolElement = doc.createElement(ITool.TOOL_ELEMENT_NAME);
|
|
||||||
element.appendChild(toolElement);
|
|
||||||
tool.serialize(doc, toolElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: isToolChainSupported cannot be specified in a project file because
|
if (errorParserIds != null) {
|
||||||
// an IConfigurationElement is needed to load it!
|
element.setAttribute(ERROR_PARSERS, errorParserIds);
|
||||||
if (managedIsToolChainSupportedElement != null) {
|
}
|
||||||
// TODO: issue warning?
|
|
||||||
|
if (secondaryOutputIds != null) {
|
||||||
|
element.setAttribute(SECONDARY_OUTPUTS, secondaryOutputIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetToolIds != null) {
|
||||||
|
element.setAttribute(TARGET_TOOL, targetToolIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scannerConfigDiscoveryProfileId != null) {
|
||||||
|
element.setAttribute(SCANNER_CONFIG_PROFILE_ID, scannerConfigDiscoveryProfileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// versionsSupported
|
||||||
|
if (versionsSupported != null) {
|
||||||
|
element.setAttribute(VERSIONS_SUPPORTED, versionsSupported);
|
||||||
|
}
|
||||||
|
|
||||||
|
// convertToId
|
||||||
|
if (convertToId != null) {
|
||||||
|
element.setAttribute(CONVERT_TO_ID, convertToId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osList != null) {
|
||||||
|
Iterator osIter = osList.listIterator();
|
||||||
|
String listValue = EMPTY_STRING;
|
||||||
|
while (osIter.hasNext()) {
|
||||||
|
String current = (String) osIter.next();
|
||||||
|
listValue += current;
|
||||||
|
if ((osIter.hasNext())) {
|
||||||
|
listValue += ","; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.setAttribute(OS_LIST, listValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (archList != null) {
|
||||||
|
Iterator archIter = archList.listIterator();
|
||||||
|
String listValue = EMPTY_STRING;
|
||||||
|
while (archIter.hasNext()) {
|
||||||
|
String current = (String) archIter.next();
|
||||||
|
listValue += current;
|
||||||
|
if ((archIter.hasNext())) {
|
||||||
|
listValue += ","; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.setAttribute(ARCH_LIST, listValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serialize elements from my super class
|
||||||
|
super.serialize(doc, element);
|
||||||
|
|
||||||
|
// Serialize my children
|
||||||
|
if (targetPlatform != null) {
|
||||||
|
Element targetPlatformElement = doc.createElement(ITargetPlatform.TARGET_PLATFORM_ELEMENT_NAME);
|
||||||
|
element.appendChild(targetPlatformElement);
|
||||||
|
targetPlatform.serialize(doc, targetPlatformElement);
|
||||||
|
}
|
||||||
|
if (builder != null) {
|
||||||
|
Element builderElement = doc.createElement(IBuilder.BUILDER_ELEMENT_NAME);
|
||||||
|
element.appendChild(builderElement);
|
||||||
|
builder.serialize(doc, builderElement);
|
||||||
|
}
|
||||||
|
List toolElements = getToolList();
|
||||||
|
Iterator iter = toolElements.listIterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Tool tool = (Tool) iter.next();
|
||||||
|
Element toolElement = doc.createElement(ITool.TOOL_ELEMENT_NAME);
|
||||||
|
element.appendChild(toolElement);
|
||||||
|
tool.serialize(doc, toolElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: isToolChainSupported cannot be specified in a project file because
|
||||||
|
// an IConfigurationElement is needed to load it!
|
||||||
|
if (managedIsToolChainSupportedElement != null) {
|
||||||
|
// TODO: issue warning?
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: environmentVariableSupplier cannot be specified in a project file because
|
||||||
|
// an IConfigurationElement is needed to load it!
|
||||||
|
if(environmentVariableSupplierElement != null) {
|
||||||
|
// TODO: issue warning?
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: buildMacroSupplier cannot be specified in a project file because
|
||||||
|
// an IConfigurationElement is needed to load it!
|
||||||
|
if(buildMacroSupplierElement != null) {
|
||||||
|
// TODO: issue warning?
|
||||||
|
}
|
||||||
|
|
||||||
|
//serialize user-defined macros
|
||||||
|
if(userDefinedMacros != null){
|
||||||
|
Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
|
||||||
|
element.appendChild(macrosElement);
|
||||||
|
userDefinedMacros.serialize(doc,macrosElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// I am clean now
|
||||||
|
isDirty = false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: issue an error message
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Note: environmentVariableSupplier cannot be specified in a project file because
|
|
||||||
// an IConfigurationElement is needed to load it!
|
|
||||||
if(environmentVariableSupplierElement != null) {
|
|
||||||
// TODO: issue warning?
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Note: buildMacroSupplier cannot be specified in a project file because
|
|
||||||
// an IConfigurationElement is needed to load it!
|
|
||||||
if(buildMacroSupplierElement != null) {
|
|
||||||
// TODO: issue warning?
|
|
||||||
}
|
|
||||||
|
|
||||||
//serialize user-defined macros
|
|
||||||
if(userDefinedMacros != null){
|
|
||||||
Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
|
|
||||||
element.appendChild(macrosElement);
|
|
||||||
userDefinedMacros.serialize(doc,macrosElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
// I am clean now
|
|
||||||
isDirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* P A R E N T A N D C H I L D H A N D L I N G
|
* P A R E N T A N D C H I L D H A N D L I N G
|
||||||
|
@ -680,8 +703,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
*/
|
*/
|
||||||
public ITargetPlatform getTargetPlatform() {
|
public ITargetPlatform getTargetPlatform() {
|
||||||
if (targetPlatform == null) {
|
if (targetPlatform == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getTargetPlatform();
|
return getSuperClass().getTargetPlatform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ITargetPlatform)targetPlatform;
|
return (ITargetPlatform)targetPlatform;
|
||||||
|
@ -710,8 +733,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
*/
|
*/
|
||||||
public IBuilder getBuilder() {
|
public IBuilder getBuilder() {
|
||||||
if (builder == null) {
|
if (builder == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getBuilder();
|
return getSuperClass().getBuilder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IBuilder)builder;
|
return (IBuilder)builder;
|
||||||
|
@ -742,8 +765,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public ITool[] getTools() {
|
public ITool[] getTools() {
|
||||||
ITool[] tools = null;
|
ITool[] tools = null;
|
||||||
// Merge our tools with our superclass' tools
|
// Merge our tools with our superclass' tools
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
tools = superClass.getTools();
|
tools = getSuperClass().getTools();
|
||||||
}
|
}
|
||||||
// Our tools take precedence
|
// Our tools take precedence
|
||||||
if (tools != null) {
|
if (tools != null) {
|
||||||
|
@ -752,12 +775,13 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
Tool tool = (Tool)iter.next();
|
Tool tool = (Tool)iter.next();
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < tools.length; j++) {
|
for (j = 0; j < tools.length; j++) {
|
||||||
if (tool.getSuperClass().getId().equals(tools[j].getId())) {
|
if (tool.getSuperClass() != null // Remove assumption that ALL tools must have superclasses
|
||||||
|
&& tool.getSuperClass().getId().equals(tools[j].getId())) {
|
||||||
tools[j] = tool;
|
tools[j] = tool;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// No Match? Add it.
|
// No Match? Insert it (may be re-ordered)
|
||||||
if (j == tools.length) {
|
if (j == tools.length) {
|
||||||
ITool[] newTools = new ITool[tools.length + 1];
|
ITool[] newTools = new ITool[tools.length + 1];
|
||||||
for (int k = 0; k < tools.length; k++) {
|
for (int k = 0; k < tools.length; k++) {
|
||||||
|
@ -829,14 +853,22 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getSuperClass()
|
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getSuperClass()
|
||||||
*/
|
*/
|
||||||
public IToolChain getSuperClass() {
|
public IToolChain getSuperClass() {
|
||||||
return superClass;
|
return (IToolChain)superClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Access function to set the superclass element that is defined in
|
||||||
|
* the base class.
|
||||||
|
*/
|
||||||
|
private void setSuperClass(IToolChain superClass) {
|
||||||
|
this.superClass = superClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IToolChain#getName()
|
* @see org.eclipse.cdt.core.build.managed.IToolChain#getName()
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (name == null && superClass != null) ? superClass.getName() : name;
|
return (name == null && getSuperClass() != null) ? getSuperClass().getName() : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -867,8 +899,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
String ids = errorParserIds;
|
String ids = errorParserIds;
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
ids = superClass.getErrorParserIds();
|
ids = getSuperClass().getErrorParserIds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
|
@ -898,8 +930,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
IOutputType[] types = null;
|
IOutputType[] types = null;
|
||||||
String ids = secondaryOutputIds;
|
String ids = secondaryOutputIds;
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getSecondaryOutputs();
|
return getSuperClass().getSecondaryOutputs();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new IOutputType[0];
|
return new IOutputType[0];
|
||||||
|
@ -929,8 +961,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public String getTargetToolIds() {
|
public String getTargetToolIds() {
|
||||||
if (targetToolIds == null) {
|
if (targetToolIds == null) {
|
||||||
// Ask superClass for its list
|
// Ask superClass for its list
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getTargetToolIds();
|
return getSuperClass().getTargetToolIds();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -970,8 +1002,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
String ids = errorParserIds;
|
String ids = errorParserIds;
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
ids = superClass.getErrorParserIds(config);
|
ids = getSuperClass().getErrorParserIds(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
|
@ -1027,8 +1059,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public String[] getArchList() {
|
public String[] getArchList() {
|
||||||
if (archList == null) {
|
if (archList == null) {
|
||||||
// Ask superClass for its list
|
// Ask superClass for its list
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getArchList();
|
return getSuperClass().getArchList();
|
||||||
} else {
|
} else {
|
||||||
// I have no superClass and no defined list
|
// I have no superClass and no defined list
|
||||||
return new String[] {"all"}; //$NON-NLS-1$
|
return new String[] {"all"}; //$NON-NLS-1$
|
||||||
|
@ -1043,8 +1075,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public String[] getOSList() {
|
public String[] getOSList() {
|
||||||
if (osList == null) {
|
if (osList == null) {
|
||||||
// Ask superClass for its list
|
// Ask superClass for its list
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getOSList();
|
return getSuperClass().getOSList();
|
||||||
} else {
|
} else {
|
||||||
// I have no superClass and no defined filter list
|
// I have no superClass and no defined filter list
|
||||||
return new String[] {"all"}; //$NON-NLS-1$
|
return new String[] {"all"}; //$NON-NLS-1$
|
||||||
|
@ -1130,8 +1162,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
*/
|
*/
|
||||||
public String getScannerConfigDiscoveryProfileId() {
|
public String getScannerConfigDiscoveryProfileId() {
|
||||||
if (scannerConfigDiscoveryProfileId == null) {
|
if (scannerConfigDiscoveryProfileId == null) {
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getScannerConfigDiscoveryProfileId();
|
return getSuperClass().getScannerConfigDiscoveryProfileId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return scannerConfigDiscoveryProfileId;
|
return scannerConfigDiscoveryProfileId;
|
||||||
|
@ -1181,6 +1213,11 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
if (toolChild.isDirty()) return true;
|
if (toolChild.isDirty()) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise see if any options need saving
|
||||||
|
if (super.isDirty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return isDirty;
|
return isDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,6 +1226,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
*/
|
*/
|
||||||
public void setDirty(boolean isDirty) {
|
public void setDirty(boolean isDirty) {
|
||||||
this.isDirty = isDirty;
|
this.isDirty = isDirty;
|
||||||
|
// Propagate "false" to options
|
||||||
|
super.setDirty(isDirty);
|
||||||
// Propagate "false" to the children
|
// Propagate "false" to the children
|
||||||
if (!isDirty) {
|
if (!isDirty) {
|
||||||
Iterator iter = getToolList().listIterator();
|
Iterator iter = getToolList().listIterator();
|
||||||
|
@ -1207,8 +1246,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
// Resolve superClass
|
// Resolve superClass
|
||||||
if (superClassId != null && superClassId.length() > 0) {
|
if (superClassId != null && superClassId.length() > 0) {
|
||||||
superClass = ManagedBuildManager.getExtensionToolChain(superClassId);
|
setSuperClass(ManagedBuildManager.getExtensionToolChain(superClassId));
|
||||||
if (superClass == null) {
|
if (getSuperClass() == null) {
|
||||||
// Report error
|
// Report error
|
||||||
ManagedBuildManager.OutputResolveError(
|
ManagedBuildManager.OutputResolveError(
|
||||||
"superClass", //$NON-NLS-1$
|
"superClass", //$NON-NLS-1$
|
||||||
|
@ -1217,6 +1256,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
getId());
|
getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Resolve HoldsOptions
|
||||||
|
super.resolveReferences();
|
||||||
// Call resolveReferences on our children
|
// Call resolveReferences on our children
|
||||||
if (targetPlatform != null) {
|
if (targetPlatform != null) {
|
||||||
targetPlatform.resolveReferences();
|
targetPlatform.resolveReferences();
|
||||||
|
@ -1262,8 +1303,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public String getConvertToId() {
|
public String getConvertToId() {
|
||||||
if (convertToId == null) {
|
if (convertToId == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getConvertToId();
|
return getSuperClass().getConvertToId();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -1289,8 +1330,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
public String getVersionsSupported() {
|
public String getVersionsSupported() {
|
||||||
if (versionsSupported == null) {
|
if (versionsSupported == null) {
|
||||||
// If I have a superClass, ask it
|
// If I have a superClass, ask it
|
||||||
if (superClass != null) {
|
if (getSuperClass() != null) {
|
||||||
return superClass.getVersionsSupported();
|
return getSuperClass().getVersionsSupported();
|
||||||
} else {
|
} else {
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
@ -1346,8 +1387,8 @@ public class ToolChain extends BuildObject implements IToolChain {
|
||||||
*/
|
*/
|
||||||
public IConfigurationElement getEnvironmentVariableSupplierElement(){
|
public IConfigurationElement getEnvironmentVariableSupplierElement(){
|
||||||
if (environmentVariableSupplierElement == null) {
|
if (environmentVariableSupplierElement == null) {
|
||||||
if (superClass != null && superClass instanceof ToolChain) {
|
if (getSuperClass() != null && getSuperClass() instanceof ToolChain) {
|
||||||
return ((ToolChain)superClass).getEnvironmentVariableSupplierElement();
|
return ((ToolChain)getSuperClass()).getEnvironmentVariableSupplierElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return environmentVariableSupplierElement;
|
return environmentVariableSupplierElement;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
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.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
|
import org.eclipse.cdt.managedbuilder.core.IConfigurationV2;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
|
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
|
@ -25,7 +26,9 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
|
||||||
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.IOutputType;
|
import org.eclipse.cdt.managedbuilder.core.IOutputType;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
import org.eclipse.cdt.managedbuilder.core.IToolReference;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||||
|
@ -446,71 +449,81 @@ public class ToolReference implements IToolReference {
|
||||||
// check to see if the option has an applicability calculator
|
// check to see if the option has an applicability calculator
|
||||||
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
||||||
|
|
||||||
if (applicabilityCalculator == null
|
boolean optionIsApplicable = true;
|
||||||
|| applicabilityCalculator.isOptionUsedInCommandLine(getTool())) {
|
if (applicabilityCalculator != null) {
|
||||||
switch (option.getValueType()) {
|
ITool tool = getTool();
|
||||||
case IOption.BOOLEAN :
|
IBuildObject config;
|
||||||
String boolCmd;
|
if( tool.getParent() instanceof IResourceConfiguration ) {
|
||||||
if (option.getBooleanValue()) {
|
config = tool.getParent();
|
||||||
boolCmd = option.getCommand();
|
} else {
|
||||||
} else {
|
config = ((IToolChain)tool.getParent()).getParent();
|
||||||
// Note: getCommandFalse is new with CDT 2.0
|
}
|
||||||
boolCmd = option.getCommandFalse();
|
optionIsApplicable =
|
||||||
}
|
applicabilityCalculator.isOptionUsedInCommandLine(config, tool, option);
|
||||||
if (boolCmd != null && boolCmd.length() > 0) {
|
|
||||||
buf.append(boolCmd + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOption.ENUMERATED :
|
|
||||||
String enumVal = option.getEnumCommand(option.getSelectedEnum());
|
|
||||||
if (enumVal.length() > 0) {
|
|
||||||
buf.append(enumVal + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOption.STRING :
|
|
||||||
String strCmd = option.getCommand();
|
|
||||||
String val = option.getStringValue();
|
|
||||||
if (val.length() > 0) {
|
|
||||||
if (strCmd != null) buf.append(strCmd);
|
|
||||||
buf.append(val + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOption.STRING_LIST :
|
|
||||||
String cmd = option.getCommand();
|
|
||||||
String[] list = option.getStringListValue();
|
|
||||||
for (int j = 0; j < list.length; j++) {
|
|
||||||
String temp = list[j];
|
|
||||||
if (cmd != null) buf.append(cmd);
|
|
||||||
buf.append(temp + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOption.INCLUDE_PATH :
|
|
||||||
String incCmd = option.getCommand();
|
|
||||||
String[] paths = option.getIncludePaths();
|
|
||||||
for (int j = 0; j < paths.length; j++) {
|
|
||||||
String temp = paths[j];
|
|
||||||
buf.append(incCmd + temp + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IOption.PREPROCESSOR_SYMBOLS :
|
|
||||||
String defCmd = option.getCommand();
|
|
||||||
String[] symbols = option.getDefinedSymbols();
|
|
||||||
for (int j = 0; j < symbols.length; j++) {
|
|
||||||
String temp = symbols[j];
|
|
||||||
buf.append(defCmd + temp + WHITE_SPACE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (optionIsApplicable) {
|
||||||
|
switch (option.getValueType()) {
|
||||||
|
case IOption.BOOLEAN :
|
||||||
|
String boolCmd;
|
||||||
|
if (option.getBooleanValue()) {
|
||||||
|
boolCmd = option.getCommand();
|
||||||
|
} else {
|
||||||
|
// Note: getCommandFalse is new with CDT 2.0
|
||||||
|
boolCmd = option.getCommandFalse();
|
||||||
|
}
|
||||||
|
if (boolCmd != null && boolCmd.length() > 0) {
|
||||||
|
buf.append(boolCmd + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
case IOption.ENUMERATED :
|
||||||
|
String enumVal = option.getEnumCommand(option.getSelectedEnum());
|
||||||
|
if (enumVal.length() > 0) {
|
||||||
|
buf.append(enumVal + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.STRING :
|
||||||
|
String strCmd = option.getCommand();
|
||||||
|
String val = option.getStringValue();
|
||||||
|
if (val.length() > 0) {
|
||||||
|
if (strCmd != null) buf.append(strCmd);
|
||||||
|
buf.append(val + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.STRING_LIST :
|
||||||
|
String cmd = option.getCommand();
|
||||||
|
String[] list = option.getStringListValue();
|
||||||
|
for (int j = 0; j < list.length; j++) {
|
||||||
|
String temp = list[j];
|
||||||
|
if (cmd != null) buf.append(cmd);
|
||||||
|
buf.append(temp + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.INCLUDE_PATH :
|
||||||
|
String incCmd = option.getCommand();
|
||||||
|
String[] paths = option.getIncludePaths();
|
||||||
|
for (int j = 0; j < paths.length; j++) {
|
||||||
|
String temp = paths[j];
|
||||||
|
buf.append(incCmd + temp + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IOption.PREPROCESSOR_SYMBOLS :
|
||||||
|
String defCmd = option.getCommand();
|
||||||
|
String[] symbols = option.getDefinedSymbols();
|
||||||
|
for (int j = 0; j < symbols.length; j++) {
|
||||||
|
String temp = symbols[j];
|
||||||
|
buf.append(defCmd + temp + WHITE_SPACE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf.toString().trim();
|
return buf.toString().trim();
|
||||||
|
@ -918,6 +931,12 @@ public class ToolReference implements IToolReference {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#createOptions()
|
||||||
|
*/
|
||||||
|
public void createOptions(IHoldsOptions options) {
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.ITool#removeOption()
|
* @see org.eclipse.cdt.managedbuilder.core.ITool#removeOption()
|
||||||
*/
|
*/
|
||||||
|
@ -1089,6 +1108,14 @@ public class ToolReference implements IToolReference {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IOptionCategory getOptionCategory(String id) {
|
||||||
|
// return null as class is deprecated
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOptionCategory(IOptionCategory category) {
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following methods are added to allow the converter from ToolReference -> Tool
|
* The following methods are added to allow the converter from ToolReference -> Tool
|
||||||
* to retrieve the actual value of attributes. These routines do not go to the
|
* to retrieve the actual value of attributes. These routines do not go to the
|
||||||
|
|
|
@ -798,7 +798,13 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
return null;
|
return null;
|
||||||
IOption parentOption = null;
|
IOption parentOption = null;
|
||||||
|
|
||||||
ITool tool = option.getParent();
|
// TODO: In CDT 3.0. Option.getParent can return a Tool or ToolChain
|
||||||
|
// We need to decide what to do with the ToolChain case
|
||||||
|
IBuildObject parent = option.getParent();
|
||||||
|
ITool tool = null;
|
||||||
|
if (parent instanceof ITool) {
|
||||||
|
tool = (ITool)parent;
|
||||||
|
}
|
||||||
IBuildObject bo = optionContext.getParent();
|
IBuildObject bo = optionContext.getParent();
|
||||||
if(tool != null && bo instanceof IResourceConfiguration){
|
if(tool != null && bo instanceof IResourceConfiguration){
|
||||||
|
|
||||||
|
@ -861,8 +867,14 @@ public class MbsMacroSupplier implements IBuildMacroSupplier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parentOption != null){
|
if(parentOption != null){
|
||||||
|
// TODO: In CDT 3.0. Option.getParent can return a Tool or ToolChain
|
||||||
|
// We need to decide what to do with the ToolChain case
|
||||||
IBuildObject parentObject = null;
|
IBuildObject parentObject = null;
|
||||||
ITool t = parentOption.getParent();
|
ITool t = null;
|
||||||
|
IBuildObject parentParent = parentOption.getParent();
|
||||||
|
if (parentParent instanceof ITool) {
|
||||||
|
t = (ITool)parentParent;
|
||||||
|
}
|
||||||
if(t != null)
|
if(t != null)
|
||||||
parentObject = t.getParent();
|
parentObject = t.getParent();
|
||||||
return new OptionContextData(parentOption,parentObject);
|
return new OptionContextData(parentOption,parentObject);
|
||||||
|
|
|
@ -19,9 +19,11 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
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.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionSettingsPage;
|
import org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionSettingsPage;
|
||||||
|
@ -436,37 +438,25 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
||||||
// There is a selected option or category.
|
// There is a selected option or category.
|
||||||
// See if it matches any category in the current config (by name)
|
// See if it matches any category in the current config (by name)
|
||||||
ITool[] tools = null;
|
ITool[] tools = null;
|
||||||
|
IToolChain toolChain = null;
|
||||||
|
|
||||||
if ( element instanceof IProject ) {
|
if ( element instanceof IProject ) {
|
||||||
tools = config.getFilteredTools();
|
tools = config.getFilteredTools();
|
||||||
|
toolChain = config.getToolChain();
|
||||||
} else if ( element instanceof IFile){
|
} else if ( element instanceof IFile){
|
||||||
tools = resConfig.getTools();
|
tools = resConfig.getTools();
|
||||||
}
|
}
|
||||||
String matchName = EMPTY_STRING;
|
|
||||||
IBuildObject catOrTool = selectedCategory;
|
IBuildObject catOrTool = selectedCategory;
|
||||||
do {
|
// Make the match name
|
||||||
matchName = catOrTool.getName() + matchName;
|
String matchName = makeMatchName(catOrTool);
|
||||||
if (catOrTool instanceof ITool) break;
|
// Search for selected category/tool in toolChain
|
||||||
else if (catOrTool instanceof IOptionCategory) {
|
if ( toolChain != null ) {
|
||||||
catOrTool = ((IOptionCategory)catOrTool).getOwner();
|
primary = findOptionCategoryByMatchName(matchName, toolChain.getChildCategories());
|
||||||
} else break;
|
}
|
||||||
} while (catOrTool != null);
|
// Search for selected category/tool in tools
|
||||||
for (int i=0; i<tools.length && primary == null; i++) {
|
if ( primary == null ) {
|
||||||
ITool tool = tools[i];
|
for (int i=0; i<tools.length && primary == null; i++) {
|
||||||
IOptionCategory[] cats = tool.getChildCategories();
|
primary = findOptionCategoryByMatchName(matchName, tools[i].getChildCategories());
|
||||||
for (int j=0; j<cats.length; j++) {
|
|
||||||
String catName = EMPTY_STRING;
|
|
||||||
catOrTool = cats[j];
|
|
||||||
do {
|
|
||||||
catName = catOrTool.getName() + catName;
|
|
||||||
if (catOrTool instanceof ITool) break;
|
|
||||||
else if (catOrTool instanceof IOptionCategory) {
|
|
||||||
catOrTool = ((IOptionCategory)catOrTool).getOwner();
|
|
||||||
} else break;
|
|
||||||
} while (catOrTool != null);
|
|
||||||
if (catName.equals(matchName)) {
|
|
||||||
primary = cats[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,6 +494,23 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call an MBS CallBack function to inform that default settings have been applied.
|
||||||
|
* This has to be sent to all the Options associated with this configuration.
|
||||||
|
*/
|
||||||
|
private void performSetDefaultsEventCallBack() {
|
||||||
|
|
||||||
|
if ( element instanceof IProject) {
|
||||||
|
// Do not send the event to the child resource configurations, as performDefaults
|
||||||
|
// is only scoped to what is visible in the UI.
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(parent.getSelectedConfiguration(),
|
||||||
|
IManagedOptionValueHandler.EVENT_SETDEFAULT, false);
|
||||||
|
} else if ( element instanceof IFile) {
|
||||||
|
ManagedBuildManager.performValueHandlerEvent(resParent.getCurrentResourceConfig(),
|
||||||
|
IManagedOptionValueHandler.EVENT_SETDEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||||
|
@ -544,6 +551,9 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
||||||
ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
|
ManagedBuildManager.setDefaultConfiguration(parent.getProject(), parent.getSelectedConfiguration());
|
||||||
ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
|
ManagedBuildManager.saveBuildInfo(parent.getProject(), false);
|
||||||
|
|
||||||
|
// Call an MBS CallBack function to inform that default settings have been applied.
|
||||||
|
performSetDefaultsEventCallBack();
|
||||||
|
|
||||||
// Reset the category or tool selection and run selection event handler
|
// Reset the category or tool selection and run selection event handler
|
||||||
selectedCategory = null;
|
selectedCategory = null;
|
||||||
selectedTool = null;
|
selectedTool = null;
|
||||||
|
@ -579,6 +589,9 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
||||||
ManagedBuildManager.setDefaultConfiguration(resParent.getProject(), resParent.getSelectedConfiguration());
|
ManagedBuildManager.setDefaultConfiguration(resParent.getProject(), resParent.getSelectedConfiguration());
|
||||||
ManagedBuildManager.saveBuildInfo(resParent.getProject(), false);
|
ManagedBuildManager.saveBuildInfo(resParent.getProject(), false);
|
||||||
|
|
||||||
|
// Call an MBS CallBack function to inform that default settings have been applied.
|
||||||
|
performSetDefaultsEventCallBack();
|
||||||
|
|
||||||
// Reset the category or tool selection and run selection event handler
|
// Reset the category or tool selection and run selection event handler
|
||||||
selectedCategory = null;
|
selectedCategory = null;
|
||||||
selectedTool = null;
|
selectedTool = null;
|
||||||
|
@ -726,8 +739,62 @@ public class ToolsSettingsBlock extends AbstractCOptionPage {
|
||||||
MacrosSetBlock block = optionBlock.getMacrosBlock();
|
MacrosSetBlock block = optionBlock.getMacrosBlock();
|
||||||
if(block != null)
|
if(block != null)
|
||||||
return block.getBuildMacroProvider();
|
return block.getBuildMacroProvider();
|
||||||
}
|
}
|
||||||
return (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
|
return (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a name that uniquely identifies a category. The match name is
|
||||||
|
* a concatenation of the tool and categories, e.g. Tool->Cat1->Cat2
|
||||||
|
* maps onto the string "Tool|Cat1|Cat2|"
|
||||||
|
*
|
||||||
|
* @param category or tool for which to build the match name
|
||||||
|
* @return match name
|
||||||
|
*/
|
||||||
|
private String makeMatchName(IBuildObject catOrTool) {
|
||||||
|
String catName = EMPTY_STRING;
|
||||||
|
|
||||||
|
// Build the match name.
|
||||||
|
do {
|
||||||
|
catName = catOrTool.getName() + "|" + catName;
|
||||||
|
if (catOrTool instanceof ITool) break;
|
||||||
|
else if (catOrTool instanceof IOptionCategory) {
|
||||||
|
catOrTool = ((IOptionCategory)catOrTool).getOwner();
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
} while (catOrTool != null);
|
||||||
|
|
||||||
|
return catName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an option category from an array of categories by comparing against
|
||||||
|
* a match name. The match name is a concatenation of the tool and categories,
|
||||||
|
* e.g. Tool->Cat1->Cat2 maps onto the string "Tool|Cat1|Cat2|"
|
||||||
|
*
|
||||||
|
* @param matchName an identifier to search
|
||||||
|
* @param categories as returned by getChildCategories(), i.e. non-flattened
|
||||||
|
* @return category or tool, if found and null otherwise
|
||||||
|
*/
|
||||||
|
private Object findOptionCategoryByMatchName(String matchName, IOptionCategory[] cats) {
|
||||||
|
Object primary = null;
|
||||||
|
|
||||||
|
for (int j=0; j<cats.length; j++) {
|
||||||
|
IBuildObject catOrTool = cats[j];
|
||||||
|
// Build the match name
|
||||||
|
String catName = makeMatchName(catOrTool);
|
||||||
|
// Check whether the name matches
|
||||||
|
if (catName.equals(matchName)) {
|
||||||
|
primary = cats[j];
|
||||||
|
break;
|
||||||
|
} else if (matchName.startsWith(catName)) {
|
||||||
|
// If there is a common root then check for any further children
|
||||||
|
primary = findOptionCategoryByMatchName(matchName, cats[j].getChildCategories());
|
||||||
|
if (primary != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return primary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,17 @@ import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
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.IHoldsOptions;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
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.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditor;
|
import org.eclipse.jface.preference.FieldEditor;
|
||||||
|
@ -58,6 +61,17 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
public Point computeSize() {
|
public Point computeSize() {
|
||||||
return super.computeSize();
|
return super.computeSize();
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Private access function which returns the correct configuration
|
||||||
|
* argument for valueHandler call-backs.
|
||||||
|
*/
|
||||||
|
private IBuildObject getConfigurationHandle() {
|
||||||
|
if ( isItResourceConfigPage ) {
|
||||||
|
return resConfig;
|
||||||
|
} else {
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||||
|
@ -76,15 +90,22 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
|
|
||||||
for (int index = 0; index < options.length; ++index) {
|
for (int index = 0; index < options.length; ++index) {
|
||||||
// Get the option
|
// Get the option
|
||||||
ITool tool = (ITool)options[index][0];
|
IHoldsOptions holder = (IHoldsOptions)options[index][0];
|
||||||
if (tool == null) break; // The array may not be full
|
if (holder == null) break; // The array may not be full
|
||||||
IOption opt = (IOption)options[index][1];
|
IOption opt = (IOption)options[index][1];
|
||||||
|
|
||||||
|
|
||||||
// check to see if the option has an applicability calculator
|
// check to see if the option has an applicability calculator
|
||||||
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator();
|
||||||
|
|
||||||
// is the option visible?
|
// is the option visible?
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(tool)) {
|
IBuildObject config;
|
||||||
|
if ( isItResourceConfigPage ) {
|
||||||
|
config = resConfig;
|
||||||
|
} else {
|
||||||
|
config = configuration;
|
||||||
|
}
|
||||||
|
if (applicabilityCalculator == null || applicabilityCalculator.isOptionVisible(config, holder, opt)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Figure out which type the option is and add a proper field
|
// Figure out which type the option is and add a proper field
|
||||||
|
@ -103,8 +124,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
DirectoryFieldEditor dirFieldEditor = new DirectoryFieldEditor(
|
DirectoryFieldEditor dirFieldEditor = new DirectoryFieldEditor(
|
||||||
opt.getId(), opt.getName(), fieldEditorParent2);
|
opt.getId(), opt.getName(), fieldEditorParent2);
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, dirFieldEditor, fieldEditorParent2);
|
opt, applicabilityCalculator, dirFieldEditor, fieldEditorParent2);
|
||||||
|
|
||||||
addField(dirFieldEditor);
|
addField(dirFieldEditor);
|
||||||
fieldsMap.put(opt.getId(), dirFieldEditor);
|
fieldsMap.put(opt.getId(), dirFieldEditor);
|
||||||
|
@ -117,8 +138,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
FileFieldEditor fileFieldEditor = new FileFieldEditor(
|
FileFieldEditor fileFieldEditor = new FileFieldEditor(
|
||||||
opt.getId(), opt.getName(), fieldEditorParent3);
|
opt.getId(), opt.getName(), fieldEditorParent3);
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, fileFieldEditor, fieldEditorParent3);
|
opt, applicabilityCalculator, fileFieldEditor, fieldEditorParent3);
|
||||||
|
|
||||||
addField(fileFieldEditor);
|
addField(fileFieldEditor);
|
||||||
fieldsMap.put(opt.getId(), fileFieldEditor);
|
fieldsMap.put(opt.getId(), fileFieldEditor);
|
||||||
|
@ -130,8 +151,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
StringFieldEditor stringField = new StringFieldEditor(
|
StringFieldEditor stringField = new StringFieldEditor(
|
||||||
opt.getId(), opt.getName(), fieldEditorParent4);
|
opt.getId(), opt.getName(), fieldEditorParent4);
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, stringField, fieldEditorParent4);
|
opt, applicabilityCalculator, stringField, fieldEditorParent4);
|
||||||
|
|
||||||
addField(stringField);
|
addField(stringField);
|
||||||
fieldsMap.put(opt.getId(), stringField);
|
fieldsMap.put(opt.getId(), stringField);
|
||||||
|
@ -149,8 +170,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
BooleanFieldEditor booleanField = new BooleanFieldEditor(
|
BooleanFieldEditor booleanField = new BooleanFieldEditor(
|
||||||
opt.getId(), opt.getName(), fieldEditorParent5);
|
opt.getId(), opt.getName(), fieldEditorParent5);
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, booleanField, fieldEditorParent5);
|
opt, applicabilityCalculator, booleanField, fieldEditorParent5);
|
||||||
|
|
||||||
addField(booleanField);
|
addField(booleanField);
|
||||||
fieldsMap.put(opt.getId(), booleanField);
|
fieldsMap.put(opt.getId(), booleanField);
|
||||||
|
@ -167,13 +188,27 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
// wrong
|
// wrong
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Get all applicable values for this enumerated Option, But display
|
||||||
|
// only the enumerated values that are valid (static set of enumerated values defined
|
||||||
|
// in the plugin.xml file) in the UI Combobox. This refrains the user from selecting an
|
||||||
|
// invalid value and avoids issuing an error message.
|
||||||
|
String[] enumNames = opt.getApplicableValues();
|
||||||
|
Vector enumValidList = new Vector();
|
||||||
|
for (int i = 0; i < enumNames.length; ++i) {
|
||||||
|
if (opt.getValueHandler().isEnumValueAppropriate(getConfigurationHandle(),
|
||||||
|
opt.getOptionHolder(), opt, opt.getValueHandlerExtraArgument(), enumNames[i])) {
|
||||||
|
enumValidList.add(enumNames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] enumValidNames = new String[enumValidList.size()];
|
||||||
|
enumValidList.copyInto(enumValidNames);
|
||||||
|
|
||||||
Composite fieldEditorParent6 = getFieldEditorParent();
|
Composite fieldEditorParent6 = getFieldEditorParent();
|
||||||
BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(
|
BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(
|
||||||
opt.getId(), opt.getName(), opt.getApplicableValues(), sel, fieldEditorParent6);
|
opt.getId(), opt.getName(), enumValidNames, sel, fieldEditorParent6);
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, comboField, fieldEditorParent6);
|
opt, applicabilityCalculator, comboField, fieldEditorParent6);
|
||||||
|
|
||||||
addField(comboField);
|
addField(comboField);
|
||||||
fieldsMap.put(opt.getId(), comboField);
|
fieldsMap.put(opt.getId(), comboField);
|
||||||
|
@ -189,8 +224,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
FileListControlFieldEditor listField = new FileListControlFieldEditor(
|
FileListControlFieldEditor listField = new FileListControlFieldEditor(
|
||||||
opt.getId(), opt.getName(), fieldEditorParent7, opt.getBrowseType());
|
opt.getId(), opt.getName(), fieldEditorParent7, opt.getBrowseType());
|
||||||
|
|
||||||
setFieldEditorEnablement(tool,
|
setFieldEditorEnablement(holder,
|
||||||
applicabilityCalculator, listField, fieldEditorParent7);
|
opt, applicabilityCalculator, listField, fieldEditorParent7);
|
||||||
|
|
||||||
addField(listField);
|
addField(listField);
|
||||||
fieldsMap.put(opt.getId(), listField);
|
fieldsMap.put(opt.getId(), listField);
|
||||||
|
@ -235,19 +270,20 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < options.length; i++) {
|
for (int i = 0; i < options.length; i++) {
|
||||||
ITool tool = (ITool)options[i][0];
|
IHoldsOptions holder = (IHoldsOptions)options[i][0];
|
||||||
if (tool == null) break; // The array may not be full
|
if (holder == null) break; // The array may not be full
|
||||||
IOption option = (IOption)options[i][1];
|
IOption option = (IOption)options[i][1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Transfer value from preference store to options
|
// Transfer value from preference store to options
|
||||||
IOption setOption;
|
IOption setOption = null;
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
case IOption.BOOLEAN :
|
case IOption.BOOLEAN :
|
||||||
boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
|
boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
|
||||||
if(isItResourceConfigPage) {
|
if(isItResourceConfigPage) {
|
||||||
setOption = ManagedBuildManager.setOption(resConfig, tool, option, boolVal);
|
setOption = ManagedBuildManager.setOption(resConfig, holder, option, boolVal);
|
||||||
} else {
|
} else {
|
||||||
setOption = ManagedBuildManager.setOption(configuration, tool, option, boolVal);
|
setOption = ManagedBuildManager.setOption(configuration, holder, option, boolVal);
|
||||||
}
|
}
|
||||||
// Reset the preference store since the Id may have changed
|
// Reset the preference store since the Id may have changed
|
||||||
if (setOption != option) {
|
if (setOption != option) {
|
||||||
|
@ -260,10 +296,10 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
String enumVal = getToolSettingsPreferenceStore().getString(option.getId());
|
String enumVal = getToolSettingsPreferenceStore().getString(option.getId());
|
||||||
String enumId = option.getEnumeratedId(enumVal);
|
String enumId = option.getEnumeratedId(enumVal);
|
||||||
if(isItResourceConfigPage) {
|
if(isItResourceConfigPage) {
|
||||||
setOption = ManagedBuildManager.setOption(resConfig, tool, option,
|
setOption = ManagedBuildManager.setOption(resConfig, holder, option,
|
||||||
(enumId != null && enumId.length() > 0) ? enumId : enumVal);
|
(enumId != null && enumId.length() > 0) ? enumId : enumVal);
|
||||||
} else {
|
} else {
|
||||||
setOption = ManagedBuildManager.setOption(configuration, tool, option,
|
setOption = ManagedBuildManager.setOption(configuration, holder, option,
|
||||||
(enumId != null && enumId.length() > 0) ? enumId : enumVal);
|
(enumId != null && enumId.length() > 0) ? enumId : enumVal);
|
||||||
}
|
}
|
||||||
// Reset the preference store since the Id may have changed
|
// Reset the preference store since the Id may have changed
|
||||||
|
@ -276,9 +312,9 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
case IOption.STRING :
|
case IOption.STRING :
|
||||||
String strVal = getToolSettingsPreferenceStore().getString(option.getId());
|
String strVal = getToolSettingsPreferenceStore().getString(option.getId());
|
||||||
if(isItResourceConfigPage){
|
if(isItResourceConfigPage){
|
||||||
setOption = ManagedBuildManager.setOption(resConfig, tool, option, strVal);
|
setOption = ManagedBuildManager.setOption(resConfig, holder, option, strVal);
|
||||||
} else {
|
} else {
|
||||||
setOption = ManagedBuildManager.setOption(configuration, tool, option, strVal);
|
setOption = ManagedBuildManager.setOption(configuration, holder, option, strVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the preference store since the Id may have changed
|
// Reset the preference store since the Id may have changed
|
||||||
|
@ -296,9 +332,9 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
String listStr = getToolSettingsPreferenceStore().getString(option.getId());
|
String listStr = getToolSettingsPreferenceStore().getString(option.getId());
|
||||||
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
|
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
|
||||||
if( isItResourceConfigPage){
|
if( isItResourceConfigPage){
|
||||||
setOption = ManagedBuildManager.setOption(resConfig, tool, option, listVal);
|
setOption = ManagedBuildManager.setOption(resConfig, holder, option, listVal);
|
||||||
}else {
|
}else {
|
||||||
setOption = ManagedBuildManager.setOption(configuration, tool, option, listVal);
|
setOption = ManagedBuildManager.setOption(configuration, holder, option, listVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the preference store since the Id may have changed
|
// Reset the preference store since the Id may have changed
|
||||||
|
@ -311,7 +347,25 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call an MBS CallBack function to inform that Settings related to Apply/OK button
|
||||||
|
// press have been applied.
|
||||||
|
if (setOption == null)
|
||||||
|
setOption = option;
|
||||||
|
|
||||||
|
if (setOption.getValueHandler().handleValue(
|
||||||
|
getConfigurationHandle(),
|
||||||
|
setOption.getOptionHolder(),
|
||||||
|
setOption,
|
||||||
|
setOption.getValueHandlerExtraArgument(),
|
||||||
|
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||||
|
// TODO : Event is handled successfully and returned true.
|
||||||
|
// May need to do something here say log a message.
|
||||||
|
} else {
|
||||||
|
// Event handling Failed.
|
||||||
|
}
|
||||||
} catch (BuildException e) {}
|
} catch (BuildException e) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -338,17 +392,23 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
super.performOk();
|
super.performOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFieldEditorEnablement(ITool tool, IOptionApplicability optionApplicability,
|
private void setFieldEditorEnablement(IHoldsOptions holder, IOption option,
|
||||||
FieldEditor fieldEditor, Composite parent) {
|
IOptionApplicability optionApplicability, FieldEditor fieldEditor, Composite parent) {
|
||||||
if (optionApplicability == null)
|
if (optionApplicability == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if the option is not enabled then disable it
|
// if the option is not enabled then disable it
|
||||||
if (!optionApplicability.isOptionEnabled(tool)) {
|
IBuildObject config;
|
||||||
fieldEditor.setEnabled(false, parent);
|
if ( isItResourceConfigPage ) {
|
||||||
|
config = resConfig;
|
||||||
} else {
|
} else {
|
||||||
fieldEditor.setEnabled(true, parent);
|
config = configuration;
|
||||||
}
|
}
|
||||||
|
//if (!optionApplicability.isOptionEnabled(config, holder, )) {
|
||||||
|
// fieldEditor.setEnabled(false, parent);
|
||||||
|
//} else {
|
||||||
|
// fieldEditor.setEnabled(true, parent);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -369,8 +429,8 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
|
|
||||||
for (int index = 0; index < options.length; ++index) {
|
for (int index = 0; index < options.length; ++index) {
|
||||||
// Get the option
|
// Get the option
|
||||||
ITool tool = (ITool) options[index][0];
|
IHoldsOptions holder = (IHoldsOptions) options[index][0];
|
||||||
if (tool == null)
|
if (holder == null)
|
||||||
break; // The array may not be full
|
break; // The array may not be full
|
||||||
IOption opt = (IOption) options[index][1];
|
IOption opt = (IOption) options[index][1];
|
||||||
|
|
||||||
|
@ -382,7 +442,7 @@ public class BuildOptionSettingsPage extends BuildSettingsPage {
|
||||||
if (applicabilityCalculator != null) {
|
if (applicabilityCalculator != null) {
|
||||||
FieldEditor fieldEditor = (FieldEditor) fieldsMap.get(opt.getId());
|
FieldEditor fieldEditor = (FieldEditor) fieldsMap.get(opt.getId());
|
||||||
Composite parent = (Composite) fieldEditorsToParentMap.get(fieldEditor);
|
Composite parent = (Composite) fieldEditorsToParentMap.get(fieldEditor);
|
||||||
setFieldEditorEnablement(tool, applicabilityCalculator, fieldEditor, parent);
|
setFieldEditorEnablement(holder, opt, applicabilityCalculator, fieldEditor, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Vector;
|
||||||
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.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||||
|
@ -136,6 +137,17 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
public Point computeSize() {
|
public Point computeSize() {
|
||||||
return super.computeSize();
|
return super.computeSize();
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Private access function which returns the correct configuration
|
||||||
|
* argument for valueHandler call-backs.
|
||||||
|
*/
|
||||||
|
private IBuildObject getConfigurationHandle() {
|
||||||
|
if ( isItResourceConfigPage ) {
|
||||||
|
return resConfig;
|
||||||
|
} else {
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -257,6 +269,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
String listStr = ""; //$NON-NLS-1$
|
String listStr = ""; //$NON-NLS-1$
|
||||||
String[] listVal = null;
|
String[] listVal = null;
|
||||||
IBuildObject parent = configuration != null ? (IBuildObject)configuration.getToolChain() : (IBuildObject)resConfig;
|
IBuildObject parent = configuration != null ? (IBuildObject)configuration.getToolChain() : (IBuildObject)resConfig;
|
||||||
|
IBuildObject config = configuration != null ? (IBuildObject)configuration : (IBuildObject)resConfig;
|
||||||
IMacroSubstitutor macroSubstitutor = new UIMacroSubstitutor(0,null,EMPTY_STRING,WHITESPACE,fProvider);
|
IMacroSubstitutor macroSubstitutor = new UIMacroSubstitutor(0,null,EMPTY_STRING,WHITESPACE,fProvider);
|
||||||
for (int k = 0; k < options.length; k++) {
|
for (int k = 0; k < options.length; k++) {
|
||||||
IOption option = options[k];
|
IOption option = options[k];
|
||||||
|
@ -264,7 +277,7 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
|
|
||||||
// check to see if the option has an applicability calculator
|
// check to see if the option has an applicability calculator
|
||||||
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
|
||||||
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(tool)) {
|
if (applicabilityCalculator == null || applicabilityCalculator.isOptionUsedInCommandLine(config, tool, option)) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
|
@ -581,9 +594,10 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
ITool tool = (ITool)options[i][0];
|
ITool tool = (ITool)options[i][0];
|
||||||
if (tool == null) break; // The array may not be full
|
if (tool == null) break; // The array may not be full
|
||||||
IOption option = (IOption)options[i][1];
|
IOption option = (IOption)options[i][1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Transfer value from preference store to options
|
// Transfer value from preference store to options
|
||||||
IOption setOption;
|
IOption setOption = null;
|
||||||
switch (option.getValueType()) {
|
switch (option.getValueType()) {
|
||||||
case IOption.BOOLEAN :
|
case IOption.BOOLEAN :
|
||||||
boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
|
boolean boolVal = getToolSettingsPreferenceStore().getBoolean(option.getId());
|
||||||
|
@ -627,6 +641,23 @@ public class BuildToolSettingsPage extends BuildSettingsPage {
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call an MBS CallBack function to inform that Settings related to Apply/OK button
|
||||||
|
// press have been applied.
|
||||||
|
if (setOption == null)
|
||||||
|
setOption = option;
|
||||||
|
|
||||||
|
if (setOption.getValueHandler().handleValue(
|
||||||
|
getConfigurationHandle(),
|
||||||
|
setOption.getOptionHolder(),
|
||||||
|
setOption,
|
||||||
|
setOption.getValueHandlerExtraArgument(),
|
||||||
|
IManagedOptionValueHandler.EVENT_APPLY)) {
|
||||||
|
// TODO : Event is handled successfully and returned true.
|
||||||
|
// May need to do something here say log a message.
|
||||||
|
} else {
|
||||||
|
// Event handling Failed.
|
||||||
|
}
|
||||||
} catch (BuildException e) {}
|
} catch (BuildException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2002,2004 IBM Corporation and others.
|
* Copyright (c) 2002,2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v0.5
|
* are made available under the terms of the Common Public License v0.5
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,10 +15,12 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
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.IHoldsOptions;
|
||||||
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.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.ListenerList;
|
import org.eclipse.jface.util.ListenerList;
|
||||||
|
@ -237,8 +239,8 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
||||||
if ( options == null)
|
if ( options == null)
|
||||||
return;
|
return;
|
||||||
for (int j = 0; j < options.length; ++j) {
|
for (int j = 0; j < options.length; ++j) {
|
||||||
ITool tool = (ITool)options[j][0];
|
IHoldsOptions optionHolder = (IHoldsOptions)options[j][0];
|
||||||
if (tool == null) break; // The array may not be full
|
if (optionHolder == null) break; // The array may not be full
|
||||||
IOption opt = (IOption)options[j][1];
|
IOption opt = (IOption)options[j][1];
|
||||||
String name = opt.getId();
|
String name = opt.getId();
|
||||||
Object value;
|
Object value;
|
||||||
|
@ -367,16 +369,27 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
||||||
private void populateSettingsMap() {
|
private void populateSettingsMap() {
|
||||||
// Each configuration has a list of tools
|
// Each configuration has a list of tools
|
||||||
ITool [] tools;
|
ITool [] tools;
|
||||||
|
IOptionCategory [] toolChainsCategories;
|
||||||
|
int index;
|
||||||
|
|
||||||
// If resConfigOwner is not null, get the resource specific tools.
|
// If resConfigOwner is not null, get the resource specific tools.
|
||||||
|
|
||||||
if ( resConfigOwner != null) {
|
if ( resConfigOwner != null) {
|
||||||
tools = resConfigOwner.getTools();
|
tools = resConfigOwner.getTools();
|
||||||
|
// Resource configurations do not support categories that
|
||||||
|
// are children of toolchains. The reason for this is that
|
||||||
|
// options in such categories are intended to be global.
|
||||||
|
// TODO: Remove this restriction in future?
|
||||||
|
toolChainsCategories = new IOptionCategory[0];
|
||||||
} else {
|
} else {
|
||||||
|
// Get the tools
|
||||||
tools = owner.getFilteredTools();
|
tools = owner.getFilteredTools();
|
||||||
|
// Get the the option categories of the toolChain
|
||||||
|
IToolChain toolChain = owner.getToolChain();
|
||||||
|
toolChainsCategories = toolChain.getChildCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < tools.length; ++index) {
|
// Add the tools options to the map
|
||||||
|
for (index = 0; index < tools.length; ++index) {
|
||||||
// Add the tool to the map
|
// Add the tool to the map
|
||||||
ITool tool = tools[index];
|
ITool tool = tools[index];
|
||||||
getSettingsMap().put(tool.getId(), tool.getToolCommand());
|
getSettingsMap().put(tool.getId(), tool.getToolCommand());
|
||||||
|
@ -385,6 +398,12 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
|
||||||
IOptionCategory cat = tool.getTopOptionCategory();
|
IOptionCategory cat = tool.getTopOptionCategory();
|
||||||
getOptionsForCategory(cat);
|
getOptionsForCategory(cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the tool chain options to the map
|
||||||
|
for (index = 0; index < toolChainsCategories.length; ++index) {
|
||||||
|
// Add the options defined for the category
|
||||||
|
getOptionsForCategory(toolChainsCategories[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2002,2003 IBM Corporation and others.
|
* Copyright (c) 2002,2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v0.5
|
* are made available under the terms of the Common Public License v0.5
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
|
@ -35,6 +36,33 @@ public class ToolListContentProvider implements ITreeContentProvider{
|
||||||
public ToolListContentProvider(int elementType) {
|
public ToolListContentProvider(int elementType) {
|
||||||
this.elementType = elementType;
|
this.elementType = elementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the top level contents to be displayed in the tool list.
|
||||||
|
* If defined, first display the toolChain's option categories (unfiltered).
|
||||||
|
* Then display the the tools which are relevant for the project's nature.
|
||||||
|
*/
|
||||||
|
private Object[] getToplevelContent(IConfiguration config) {
|
||||||
|
Object toolChainsCategories[];
|
||||||
|
Object filteredTools[];
|
||||||
|
Object all[];
|
||||||
|
// Get the the option categories of the toolChain
|
||||||
|
IToolChain toolChain = config.getToolChain();
|
||||||
|
toolChainsCategories = toolChain.getChildCategories();
|
||||||
|
// Get the tools to be displayed
|
||||||
|
filteredTools = config.getFilteredTools();
|
||||||
|
// Add up both arrays and return
|
||||||
|
int i;
|
||||||
|
int len = toolChainsCategories.length+filteredTools.length;
|
||||||
|
all = new Object[len];
|
||||||
|
for (i=0; i < toolChainsCategories.length; i++)
|
||||||
|
all[i] = toolChainsCategories[i];
|
||||||
|
for (; i < len; i++)
|
||||||
|
all[i] = filteredTools[i-toolChainsCategories.length];
|
||||||
|
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +70,14 @@ public class ToolListContentProvider implements ITreeContentProvider{
|
||||||
// If parent is configuration, return a list of its option categories
|
// If parent is configuration, return a list of its option categories
|
||||||
if (parentElement instanceof IConfiguration) {
|
if (parentElement instanceof IConfiguration) {
|
||||||
IConfiguration config = (IConfiguration)parentElement;
|
IConfiguration config = (IConfiguration)parentElement;
|
||||||
// the categories are all accessed through the tools
|
// Get the contents to be displayed for the configuration
|
||||||
return config.getFilteredTools();
|
return getToplevelContent(config);
|
||||||
} else if( parentElement instanceof IResourceConfiguration) {
|
} else if( parentElement instanceof IResourceConfiguration) {
|
||||||
// If parent is a resource configuration, return a list of its tools
|
// If parent is a resource configuration, return a list of its tools.
|
||||||
|
// Resource configurations do not support categories that are children
|
||||||
|
// of toolchains. The reason for this is that options in such categories
|
||||||
|
// are intended to be global.
|
||||||
|
// TODO: Remove this restriction in future? Requires getToplevelContent() variant
|
||||||
IResourceConfiguration resConfig = (IResourceConfiguration)parentElement;
|
IResourceConfiguration resConfig = (IResourceConfiguration)parentElement;
|
||||||
return resConfig.getTools();
|
return resConfig.getTools();
|
||||||
} else if (parentElement instanceof ITool) {
|
} else if (parentElement instanceof ITool) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Copyright (c) 2002,2004 IBM Corporation and others.
|
* Copyright (c) 2002,2005 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Common Public License v0.5
|
* are made available under the terms of the Common Public License v0.5
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,12 +10,19 @@
|
||||||
* **********************************************************************/
|
* **********************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
|
import org.eclipse.jface.resource.ResourceManager;
|
||||||
|
import org.eclipse.jface.util.Assert;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
public class ToolListLabelProvider extends LabelProvider {
|
public class ToolListLabelProvider extends LabelProvider {
|
||||||
private final Image IMG_TOOL = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
|
private final Image IMG_TOOL = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_TOOL);
|
||||||
|
@ -23,17 +30,59 @@ public class ToolListLabelProvider extends LabelProvider {
|
||||||
private static final String TREE_LABEL = "BuildPropertyPage.label.ToolTree"; //$NON-NLS-1$
|
private static final String TREE_LABEL = "BuildPropertyPage.label.ToolTree"; //$NON-NLS-1$
|
||||||
private static final String ERROR_UNKNOWN_ELEMENT = "BuildPropertyPage.error.Unknown_tree_element"; //$NON-NLS-1$
|
private static final String ERROR_UNKNOWN_ELEMENT = "BuildPropertyPage.error.Unknown_tree_element"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private ImageDescriptor descriptor = null;
|
||||||
|
private ResourceManager manager = null;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* Returns the Image associated with the icon information retrieved out of OptionCategory.
|
||||||
|
*/
|
||||||
|
private Image getIconFromOptionCategory(IOptionCategory cat) {
|
||||||
|
|
||||||
|
Image img = null;
|
||||||
|
URL url = cat.getIconPath();
|
||||||
|
|
||||||
|
// Get the image from the URL.
|
||||||
|
if (url != null) {
|
||||||
|
descriptor = ImageDescriptor.createFromURL(url);
|
||||||
|
manager = JFaceResources.getResources(Display.getCurrent());
|
||||||
|
Assert.isNotNull(manager);
|
||||||
|
img = manager.createImageWithDefault(descriptor);
|
||||||
|
if (img == null) {
|
||||||
|
// Report error by displaying a warning message
|
||||||
|
System.err.println("Couldn't create image from URL \"" + url + "\", to display icon for Tool Options." ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
// Return a tool image for a tool or tool reference
|
// Return a tool image for a tool or tool reference
|
||||||
if (element instanceof ITool) {
|
if (element instanceof ITool) {
|
||||||
|
if (element instanceof IOptionCategory) {
|
||||||
|
// Retrieve the Image from Icon information included
|
||||||
|
IOptionCategory cat = (IOptionCategory)element;
|
||||||
|
Image img = getIconFromOptionCategory(cat);
|
||||||
|
|
||||||
|
if (img != null) {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Use default icon for display
|
||||||
return IMG_TOOL;
|
return IMG_TOOL;
|
||||||
}
|
|
||||||
else if (element instanceof IOptionCategory) {
|
} else if (element instanceof IOptionCategory) {
|
||||||
|
// Return a OptionCategory image for an OptionCategory reference
|
||||||
|
IOptionCategory cat = (IOptionCategory)element;
|
||||||
|
Image img = getIconFromOptionCategory(cat);
|
||||||
|
|
||||||
|
if (img != null) {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
// Use default icon for display
|
||||||
return IMG_CAT;
|
return IMG_CAT;
|
||||||
} else {
|
} else {
|
||||||
throw unknownElement(element);
|
throw unknownElement(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -57,4 +106,15 @@ public class ToolListLabelProvider extends LabelProvider {
|
||||||
protected RuntimeException unknownElement(Object element) {
|
protected RuntimeException unknownElement(Object element) {
|
||||||
return new RuntimeException(ManagedBuilderUIMessages.getFormattedString(ERROR_UNKNOWN_ELEMENT, element.getClass().getName()));
|
return new RuntimeException(ManagedBuilderUIMessages.getFormattedString(ERROR_UNKNOWN_ELEMENT, element.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disposing any images that were allocated for it.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
if (descriptor != null && manager != null) {
|
||||||
|
manager.destroyImage(descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue