org.eclipse.cdt.managedbuilder.internal.core
Class HoldsOptions

java.lang.Object
  extended by org.eclipse.cdt.managedbuilder.internal.core.BuildObject
      extended by org.eclipse.cdt.managedbuilder.internal.core.HoldsOptions
All Implemented Interfaces:
IBuildObject, IBuildPropertiesRestriction, IHoldsOptions, IBuildPropertyChangeListener
Direct Known Subclasses:
TestToolchain, Tool, ToolChain

public abstract class HoldsOptions
extends BuildObject
implements IHoldsOptions, IBuildPropertiesRestriction, IBuildPropertyChangeListener

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 superClass 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 superClass in HoldsOptions must be IHoldOptions. Further note that the member resolved must inherit the value of its derived class. This achieved through the constructor.

Since:
3.0

Field Summary
 
Fields inherited from interface org.eclipse.cdt.managedbuilder.core.IHoldsOptions
OPTION, OPTION_CAT, OPTION_REF
 
Fields inherited from interface org.eclipse.cdt.managedbuilder.core.IBuildObject
ID, NAME
 
Method Summary
 void addChildCategory(IOptionCategory category)
           
 void addOption(Option option)
           
 void addOptionCategory(IOptionCategory category)
          Adds the IOptionCategory to this Option Holder's list of Option Categories.
 void adjustOptions(boolean extensions)
           
 IOption createOption(IOption superClass, java.lang.String Id, java.lang.String name, boolean isExtensionElement)
          Creates a child Option
 void createOptions(IHoldsOptions superClass)
          Creates options from the superclass and adds it to this class.
 IOptionCategory[] getChildCategories()
          Returns the option category children of this tool.
 IOption getOption(java.lang.String id)
          This is a deprecated method for retrieving an IOption from the receiver based on an ID.
 IOption getOptionById(java.lang.String id)
          Get the IOption in the receiver with the specified ID.
 IOption getOptionBySuperClassId(java.lang.String optionId)
          Get the IOption in the receiver with the specified ID, or an option with a superclass with this id.
 IOptionCategory getOptionCategory(java.lang.String id)
          Answers the IOptionCategory that has the unique identifier specified in the argument.
 IOption[] getOptions()
          Returns the complete list of options that are available for this object.
 IOption getOptionToSet(IOption option, boolean adjustExtension)
          This method should be called in order to obtain the option whose value and attributes could be directly changed/adjusted
 java.lang.String[] getRequiredTypeIds()
           
 java.lang.String[] getSupportedTypeIds()
           
 java.lang.String[] getSupportedValueIds(java.lang.String typeId)
           
abstract  boolean isExtensionElement()
           
 boolean needsRebuild()
          specifies whether the option holder is modified and needs rebuild
 void propertiesChanged()
           
 void removeOption(IOption option)
          Removes an option.
 boolean requiresType(java.lang.String typeId)
           
 void setRebuildState(boolean rebuild)
          sets the holder rebuild state
 boolean supportsType(IBuildPropertyType type)
           
 boolean supportsType(java.lang.String type)
           
 boolean supportsValue(IBuildPropertyType type, IBuildPropertyValue value)
           
 boolean supportsValue(java.lang.String type, java.lang.String value)
           
 
Methods inherited from class org.eclipse.cdt.managedbuilder.internal.core.BuildObject
getBaseId, getId, getManagedBuildRevision, getName, getVersion, getVersionFromId, setId, setManagedBuildRevision, setName, setVersion, toString, updateManagedBuildRevision
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.cdt.managedbuilder.core.IBuildObject
getBaseId, getId, getManagedBuildRevision, getName, getVersion, setVersion
 

Method Detail

createOption

public IOption createOption(IOption superClass,
                            java.lang.String Id,
                            java.lang.String name,
                            boolean isExtensionElement)
Description copied from interface: IHoldsOptions
Creates a child Option

Specified by:
createOption in interface IHoldsOptions
Returns:
IOption

createOptions

public void createOptions(IHoldsOptions superClass)
Description copied from interface: IHoldsOptions
Creates options from the superclass and adds it to this class. Each individual option in superclass, will become the superclass for the new option.

Specified by:
createOptions in interface IHoldsOptions

removeOption

public void removeOption(IOption option)
Description copied from interface: IHoldsOptions
Removes an option.

Specified by:
removeOption in interface IHoldsOptions

getOptions

public IOption[] getOptions()
Description copied from interface: IHoldsOptions
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.

Specified by:
getOptions in interface IHoldsOptions
Returns:
IOption[]

getOption

public IOption getOption(java.lang.String id)
Description copied from interface: IHoldsOptions
This is a deprecated method for retrieving an IOption from the receiver based on an ID. It is preferred that you use the newer method getOptionById

Specified by:
getOption in interface IHoldsOptions
Parameters:
id - unique identifier of the option to search for
Returns:
IOption
See Also:
org.eclipse.cdt.core.build.managed.IHoldsOptions#getOptionById(java.lang.String)

getOptionById

public IOption getOptionById(java.lang.String id)
Description copied from interface: IHoldsOptions
Get the IOption in the receiver with the specified ID. This is an efficient search in the receiver.

If the receiver does not have an option with that ID, the method returns null. It is the responsibility of the caller to verify the return value.

Specified by:
getOptionById in interface IHoldsOptions
Parameters:
id - unique identifier of the option to search for
Returns:
IOption

getOptionBySuperClassId

public IOption getOptionBySuperClassId(java.lang.String optionId)
Description copied from interface: IHoldsOptions
Get the IOption in the receiver with the specified ID, or an option with a superclass with this id.

If the receiver does not have an option with that ID, the method returns null. It is the responsibility of the caller to verify the return value.

Specified by:
getOptionBySuperClassId in interface IHoldsOptions
Parameters:
optionId - unique identifier of the option to search for
Returns:
IOption

getChildCategories

public IOptionCategory[] getChildCategories()
Description copied from interface: IHoldsOptions
Returns the option category children of this tool.

Specified by:
getChildCategories in interface IHoldsOptions
Returns:
IOptionCategory[]

addChildCategory

public void addChildCategory(IOptionCategory category)
Parameters:
category -

addOption

public void addOption(Option option)
Parameters:
option -

addOptionCategory

public void addOptionCategory(IOptionCategory category)
Description copied from interface: IHoldsOptions
Adds the IOptionCategory to this Option Holder's list of Option Categories.

Specified by:
addOptionCategory in interface IHoldsOptions
Parameters:
category - The option category to be added

getOptionCategory

public IOptionCategory getOptionCategory(java.lang.String id)
Description copied from interface: IHoldsOptions
Answers the IOptionCategory that has the unique identifier specified in the argument.

Specified by:
getOptionCategory in interface IHoldsOptions
Parameters:
id - The unique identifier of the option category
Returns:
IOptionCategory with the id specified in the argument

getOptionToSet

public IOption getOptionToSet(IOption option,
                              boolean adjustExtension)
                       throws BuildException
Description copied from interface: IHoldsOptions
This method should be called in order to obtain the option whose value and attributes could be directly changed/adjusted

Specified by:
getOptionToSet in interface IHoldsOptions
adjustExtension - - if false, modifications are to be made for the non-extension element (only for some particular configuration associated with some eclipse project) This is the most common use of this method. True is allowed only while while handling the LOAD value handler event. In this case modifications are to be made for the extension element. This could be used for adjusting extension options Note: changing this option will affect all non-extension configurations using this option!
Throws:
BuildException

needsRebuild

public boolean needsRebuild()
Description copied from interface: IHoldsOptions
specifies whether the option holder is modified and needs rebuild

Specified by:
needsRebuild in interface IHoldsOptions
Returns:
boolean

setRebuildState

public void setRebuildState(boolean rebuild)
Description copied from interface: IHoldsOptions
sets the holder rebuild state

Specified by:
setRebuildState in interface IHoldsOptions

propertiesChanged

public void propertiesChanged()
Specified by:
propertiesChanged in interface IBuildPropertyChangeListener

adjustOptions

public void adjustOptions(boolean extensions)

supportsType

public boolean supportsType(java.lang.String type)
Specified by:
supportsType in interface IBuildPropertiesRestriction

supportsType

public boolean supportsType(IBuildPropertyType type)

supportsValue

public boolean supportsValue(java.lang.String type,
                             java.lang.String value)
Specified by:
supportsValue in interface IBuildPropertiesRestriction

supportsValue

public boolean supportsValue(IBuildPropertyType type,
                             IBuildPropertyValue value)

isExtensionElement

public abstract boolean isExtensionElement()

getRequiredTypeIds

public java.lang.String[] getRequiredTypeIds()
Specified by:
getRequiredTypeIds in interface IBuildPropertiesRestriction

getSupportedTypeIds

public java.lang.String[] getSupportedTypeIds()
Specified by:
getSupportedTypeIds in interface IBuildPropertiesRestriction

getSupportedValueIds

public java.lang.String[] getSupportedValueIds(java.lang.String typeId)
Specified by:
getSupportedValueIds in interface IBuildPropertiesRestriction

requiresType

public boolean requiresType(java.lang.String typeId)
Specified by:
requiresType in interface IBuildPropertiesRestriction