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

java.lang.Object
  extended by org.eclipse.cdt.managedbuilder.internal.core.OptionReference
All Implemented Interfaces:
IBuildObject, IOption

public class OptionReference
extends java.lang.Object
implements IOption

An OptionReference plays two roles in the managed build model. It is used to store overridden option values in a toolchain specification at the level of a Configuration and it stores user option settings between sessions.


Field Summary
 
Fields inherited from interface org.eclipse.cdt.managedbuilder.core.IOption
ALL, APPLICABILITY_CALCULATOR, BOOLEAN, BROWSE_DIR, BROWSE_FILE, BROWSE_NONE, BROWSE_TYPE, CATEGORY, COMMAND, COMMAND_FALSE, DEFAULT_VALUE, DIR, ENUM_VALUE, ENUMERATED, FILE, FILTER_ALL, FILTER_FILE, FILTER_PROJECT, INCLUDE_FILES, INCLUDE_PATH, IS_DEFAULT, LIBRARIES, LIBRARY_FILES, LIBRARY_PATHS, LIST_ITEM_BUILTIN, LIST_ITEM_VALUE, LIST_VALUE, MACRO_FILES, NONE, OBJECTS, PREPROCESSOR_SYMBOLS, PROJECT, RESOURCE_FILTER, STRING, STRING_LIST, TOOL_TIP, TYPE_BOOL, TYPE_DEFINED_SYMBOLS, TYPE_ENUM, TYPE_INC_FILES, TYPE_INC_PATH, TYPE_LIB, TYPE_LIB_FILES, TYPE_LIB_PATHS, TYPE_STR_LIST, TYPE_STRING, TYPE_SYMBOL_FILES, TYPE_UNDEF_DEFINED_SYMBOLS, TYPE_UNDEF_INC_FILES, TYPE_UNDEF_INC_PATH, TYPE_UNDEF_LIB_FILES, TYPE_UNDEF_LIB_PATHS, TYPE_UNDEF_SYMBOL_FILES, TYPE_USER_OBJS, UNDEF_INCLUDE_FILES, UNDEF_INCLUDE_PATH, UNDEF_LIBRARY_FILES, UNDEF_LIBRARY_PATHS, UNDEF_MACRO_FILES, UNDEF_PREPROCESSOR_SYMBOLS, VALUE, VALUE_HANDLER, VALUE_HANDLER_EXTRA_ARGUMENT, VALUE_TYPE
 
Fields inherited from interface org.eclipse.cdt.managedbuilder.core.IBuildObject
ID, NAME
 
Constructor Summary
OptionReference(ToolReference owner, org.w3c.dom.Element element)
          Created from project file.
OptionReference(ToolReference owner, IManagedConfigElement element)
          This constructor will be called when the receiver is created from the settings found in an extension point.
OptionReference(ToolReference owner, IOption option)
          Constructor called when the option reference is created from an existing IOption
 
Method Summary
 IOptionApplicability getApplicabilityCalculator()
           
 java.lang.String[] getApplicableValues()
          If this option is defined as an enumeration, this function returns the list of possible values for that enum.
 java.lang.String getBaseId()
           
 java.lang.String[] getBasicStringListValue()
          in case the option basic value type is STRING_LIST, returns the String list value, throws BuildException otherwise
 OptionStringValue[] getBasicStringListValueElements()
           
 int getBasicValueType()
          Returns the type of the option value, i.e. whether it is string, boolean, string list or enumenration.
 boolean getBooleanValue()
          Answers the value for a boolean option.
 int getBrowseType()
          Returns the setting of the browseType attribute
 java.lang.String[] getBuiltIns()
          Answers an array of strings containing the built-in values defined for a stringList, includePaths, definedSymbols, or libs option.
 IOptionCategory getCategory()
          Returns the category for this option.
 java.lang.String getCommand()
          Answers a String containing the actual command line option associated with the option
 java.lang.String getCommandFalse()
          Answers a String containing the actual command line option associated with a Boolean option when the value is False
 java.lang.Object getDefaultValue()
          Returns the raw default value of this option.
 java.lang.String[] getDefinedSymbols()
          Answers the user-defined preprocessor symbols.
 java.lang.String getEnumCommand(java.lang.String id)
          Answers the command associated with the enumeration id.
 java.lang.String getEnumeratedId(java.lang.String name)
           
 java.lang.String getEnumName(java.lang.String id)
          Answers the "name" associated with the enumeration id.
 java.lang.String getId()
           
 java.lang.String[] getIncludePaths()
          Answers an array of String containing the includes paths defined in the build model.
 java.lang.String[] getLibraries()
          Answers an array or Strings containing the libraries that must be linked into the project.
 java.lang.String getManagedBuildRevision()
           
 java.lang.String getName()
           
 IOption getOption()
           
 IHoldsOptions getOptionHolder()
          Returns the holder (parent) of this option.
 IBuildObject getParent()
          Returns the parent of this option.
 int getResourceFilter()
          Returns the setting of the resourceFilter attribute
 java.lang.String getSelectedEnum()
          Answers a String containing the unique ID of the selected enumeration in an enumerated option.
 java.lang.String[] getStringListValue()
          Returns the current value for this option if it is a List of Strings.
 java.lang.String getStringValue()
          Returns the current value for this option if it is a String
 IOption getSuperClass()
          Returns the IOption that is the superclass of this option, or null if the attribute was not specified.
 ToolReference getToolReference()
          Answers the tool reference that contains the receiver.
 java.lang.String getToolTip()
          Answers a String containing the tooltip associated with the option
 java.lang.String[] getUserObjects()
          Answers all of the user-defined object files that must be linked with the final build target.
 java.lang.Object getValue()
          Returns the raw value of this option.
 IManagedOptionValueHandler getValueHandler()
          Returns the value handler specified for this tool.
 org.eclipse.core.runtime.IConfigurationElement getValueHandlerElement()
           
 java.lang.String getValueHandlerExtraArgument()
          Returns the value handlers extra argument specified for this tool
 int getValueType()
          Get the type for the value of the option.
 org.eclipse.core.runtime.PluginVersionIdentifier getVersion()
           
 boolean isExtensionElement()
          Returns true if this option was loaded from a manifest file, and false if it was loaded from a project (.cdtbuild) file.
 boolean isValid()
          Returns true if this option is valid and false if the option cannot be safely used due to an error in the MBS grammar.
 boolean overridesOnlyValue()
          Returns true if this option only oveerides the value attribute of its superclass and false if it overrides other attributes.
 boolean references(IOption target)
          Answers true if the receiver is a reference to the IOption specified in the argument, esle answers false.
 void resolveReferences()
           
 void serialize(org.w3c.dom.Document doc, org.w3c.dom.Element element)
          Persist receiver to project file.
 void setBrowseType(int type)
          Sets the browseType attribute.
 void setCategory(IOptionCategory category)
          Sets the category for this option.
 void setCommand(java.lang.String cmd)
          Sets a String containing the actual command line option associated with the option
 void setCommandFalse(java.lang.String cmd)
          Sets a String containing the actual command line option associated with a Boolean option when the value is False
 void setDefaultValue(java.lang.Object v)
          Sets the default value of this option.
 void setResourceFilter(int filter)
          Sets the resourceFilter attribute.
 void setToolTip(java.lang.String tooltip)
          Sets a String containing the tooltip associated with the option
 void setValue(boolean value)
          Sets the boolean value of the receiver to the value specified in the argument.
 void setValue(java.lang.Object v)
          Sets the raw value of this option.
 void setValue(java.lang.String value)
          Sets the string value of the receiver to the value specified in the argument.
 void setValue(java.lang.String[] value)
          Sets the value of the receiver to be an array of items.
 void setValueHandlerElement(org.eclipse.core.runtime.IConfigurationElement element)
           
 void setValueHandlerExtraArgument(java.lang.String extraArgument)
          Sets the value handlers extra argument specified for this tool
 void setValueType(int type)
          Sets the value-type of this option.
 void setVersion(org.eclipse.core.runtime.PluginVersionIdentifier version)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptionReference

public OptionReference(ToolReference owner,
                       IManagedConfigElement element)
This constructor will be called when the receiver is created from the settings found in an extension point.

Parameters:
owner -
element -

OptionReference

public OptionReference(ToolReference owner,
                       IOption option)
Constructor called when the option reference is created from an existing IOption

Parameters:
owner -
option -

OptionReference

public OptionReference(ToolReference owner,
                       org.w3c.dom.Element element)
Created from project file.

Parameters:
owner -
element -
Method Detail

resolveReferences

public void resolveReferences()

serialize

public void serialize(org.w3c.dom.Document doc,
                      org.w3c.dom.Element element)
Persist receiver to project file.

Parameters:
doc -
element -

getApplicableValues

public java.lang.String[] getApplicableValues()
Description copied from interface: IOption
If this option is defined as an enumeration, this function returns the list of possible values for that enum. If this option is not defined as an enumeration, it returns null.

Specified by:
getApplicableValues in interface IOption
Returns:
String []

getCategory

public IOptionCategory getCategory()
Description copied from interface: IOption
Returns the category for this option.

Specified by:
getCategory in interface IOption
Returns:
IOptionCategory

getCommand

public java.lang.String getCommand()
Description copied from interface: IOption
Answers a String containing the actual command line option associated with the option

Specified by:
getCommand in interface IOption
Returns:
String

getCommandFalse

public java.lang.String getCommandFalse()
Description copied from interface: IOption
Answers a String containing the actual command line option associated with a Boolean option when the value is False

Specified by:
getCommandFalse in interface IOption
Returns:
String

getToolTip

public java.lang.String getToolTip()
Description copied from interface: IOption
Answers a String containing the tooltip associated with the option

Specified by:
getToolTip in interface IOption
Returns:
String

getDefinedSymbols

public java.lang.String[] getDefinedSymbols()
                                     throws BuildException
Description copied from interface: IOption
Answers the user-defined preprocessor symbols.

Specified by:
getDefinedSymbols in interface IOption
Returns:
String[]
Throws:
BuildException

getEnumCommand

public java.lang.String getEnumCommand(java.lang.String id)
Description copied from interface: IOption
Answers the command associated with the enumeration id. For example, if the enumeration id was gnu.debug.level.default for the debug level option of the Gnu compiler, and the plugin manifest defined that as -g, then the return value would be the String "-g"

Specified by:
getEnumCommand in interface IOption
Returns:

getEnumName

public java.lang.String getEnumName(java.lang.String id)
Description copied from interface: IOption
Answers the "name" associated with the enumeration id.

Specified by:
getEnumName in interface IOption
Returns:

getEnumeratedId

public java.lang.String getEnumeratedId(java.lang.String name)
Specified by:
getEnumeratedId in interface IOption
Returns:

getId

public java.lang.String getId()
Specified by:
getId in interface IBuildObject

getBaseId

public java.lang.String getBaseId()
Specified by:
getBaseId in interface IBuildObject

getIncludePaths

public java.lang.String[] getIncludePaths()
                                   throws BuildException
Description copied from interface: IOption
Answers an array of String containing the includes paths defined in the build model.

Specified by:
getIncludePaths in interface IOption
Returns:
String[]
Throws:
BuildException

getLibraries

public java.lang.String[] getLibraries()
                                throws BuildException
Description copied from interface: IOption
Answers an array or Strings containing the libraries that must be linked into the project.

Specified by:
getLibraries in interface IOption
Returns:
String[]
Throws:
BuildException

getName

public java.lang.String getName()
Specified by:
getName in interface IBuildObject

getBooleanValue

public boolean getBooleanValue()
                        throws BuildException
Description copied from interface: IOption
Answers the value for a boolean option.

Specified by:
getBooleanValue in interface IOption
Returns:
boolean
Throws:
BuildException

getBrowseType

public int getBrowseType()
Description copied from interface: IOption
Returns the setting of the browseType attribute

Specified by:
getBrowseType in interface IOption
Returns:
int

getBuiltIns

public java.lang.String[] getBuiltIns()
Description copied from interface: IOption
Answers an array of strings containing the built-in values defined for a stringList, includePaths, definedSymbols, or libs option. If none have been defined, the array will be empty but never null.

Specified by:
getBuiltIns in interface IOption
Returns:
String[]

getOption

public IOption getOption()
Returns:
the IOption the reference is for

getSelectedEnum

public java.lang.String getSelectedEnum()
                                 throws BuildException
Description copied from interface: IOption
Answers a String containing the unique ID of the selected enumeration in an enumerated option. For an option that has not been changed by the user, the receiver will answer with the default defined in the plugin manifest. If the user has modified the selection, the receiver will answer with the overridden selection.

Specified by:
getSelectedEnum in interface IOption
Returns:
String
Throws:
BuildException - if the option type is not an enumeration

getStringListValue

public java.lang.String[] getStringListValue()
                                      throws BuildException
Description copied from interface: IOption
Returns the current value for this option if it is a List of Strings.

Specified by:
getStringListValue in interface IOption
Returns:
String []
Throws:
BuildException

getStringValue

public java.lang.String getStringValue()
                                throws BuildException
Description copied from interface: IOption
Returns the current value for this option if it is a String

Specified by:
getStringValue in interface IOption
Returns:
String
Throws:
BuildException

getParent

public IBuildObject getParent()
Description copied from interface: IOption
Returns the parent of this option. This is an object implementing ITool or IToolChain.

Specified by:
getParent in interface IOption
Returns:
IBuildObject

getOptionHolder

public IHoldsOptions getOptionHolder()
Description copied from interface: IOption
Returns the holder (parent) of this option. This may be an object implenting ITool or IToolChain, which both extend IHoldsOptions

Specified by:
getOptionHolder in interface IOption
Returns:
IHoldsOptions

getToolReference

public ToolReference getToolReference()
Answers the tool reference that contains the receiver.

Returns:
ToolReference

getUserObjects

public java.lang.String[] getUserObjects()
                                  throws BuildException
Description copied from interface: IOption
Answers all of the user-defined object files that must be linked with the final build target.

Specified by:
getUserObjects in interface IOption
Returns:
Throws:
BuildException

getValueType

public int getValueType()
Description copied from interface: IOption
Get the type for the value of the option.

Specified by:
getValueType in interface IOption
Returns:
int

getValue

public java.lang.Object getValue()
Description copied from interface: IOption
Returns the raw value of this option.

Specified by:
getValue in interface IOption
Returns:
Object The Object that contains the raw value of the option. The type of Object is specific to the option type.

references

public boolean references(IOption target)
Answers true if the receiver is a reference to the IOption specified in the argument, esle answers false.

Parameters:
target -
Returns:
boolean

setValue

public void setValue(boolean value)
              throws BuildException
Sets the boolean value of the receiver to the value specified in the argument. If the receive is not a reference to a boolean option, method will throw an exception.

Specified by:
setValue in interface IOption
Parameters:
value -
Throws:
BuildException

setValue

public void setValue(java.lang.String value)
              throws BuildException
Description copied from interface: IOption
Sets the string value of the receiver to the value specified in the argument.

Specified by:
setValue in interface IOption
Parameters:
value -
Throws:
BuildException

setValue

public void setValue(java.lang.String[] value)
              throws BuildException
Sets the value of the receiver to be an array of items.

Specified by:
setValue in interface IOption
Parameters:
value - An array of strings to place in the option reference.
Throws:
BuildException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isExtensionElement

public boolean isExtensionElement()
Description copied from interface: IOption
Returns true if this option was loaded from a manifest file, and false if it was loaded from a project (.cdtbuild) file.

Specified by:
isExtensionElement in interface IOption
Returns:
boolean

overridesOnlyValue

public boolean overridesOnlyValue()
Description copied from interface: IOption
Returns true if this option only oveerides the value attribute of its superclass and false if it overrides other attributes.

Specified by:
overridesOnlyValue in interface IOption
Returns:
boolean

setValue

public void setValue(java.lang.Object v)
Description copied from interface: IOption
Sets the raw value of this option.

Specified by:
setValue in interface IOption
Parameters:
v - The Object that contains the raw value of the option. The type of Object is specific to the option type.

setValueType

public void setValueType(int type)
Description copied from interface: IOption
Sets the value-type of this option. Use with care.

Specified by:
setValueType in interface IOption

getDefaultValue

public java.lang.Object getDefaultValue()
Description copied from interface: IOption
Returns the raw default value of this option.

Specified by:
getDefaultValue in interface IOption
Returns:
Object The Object that contains the raw default value of the option. The type of Object is specific to the option type.

setDefaultValue

public void setDefaultValue(java.lang.Object v)
Description copied from interface: IOption
Sets the default value of this option.

Specified by:
setDefaultValue in interface IOption
Parameters:
v - The Object that contains the default value of the option. The type of Object is specific to the option type.

getSuperClass

public IOption getSuperClass()
Description copied from interface: IOption
Returns the IOption that is the superclass of this option, or null if the attribute was not specified.

Specified by:
getSuperClass in interface IOption
Returns:
IOption

getResourceFilter

public int getResourceFilter()
Description copied from interface: IOption
Returns the setting of the resourceFilter attribute

Specified by:
getResourceFilter in interface IOption
Returns:
int

getApplicabilityCalculator

public IOptionApplicability getApplicabilityCalculator()
Specified by:
getApplicabilityCalculator in interface IOption
Returns:
an instance of the class that calculates whether the option is visible, enabled, and used in command line generation

setResourceFilter

public void setResourceFilter(int filter)
Description copied from interface: IOption
Sets the resourceFilter attribute.

Specified by:
setResourceFilter in interface IOption

setBrowseType

public void setBrowseType(int type)
Description copied from interface: IOption
Sets the browseType attribute.

Specified by:
setBrowseType in interface IOption

setCategory

public void setCategory(IOptionCategory category)
Description copied from interface: IOption
Sets the category for this option.

Specified by:
setCategory in interface IOption

setCommand

public void setCommand(java.lang.String cmd)
Description copied from interface: IOption
Sets a String containing the actual command line option associated with the option

Specified by:
setCommand in interface IOption

setCommandFalse

public void setCommandFalse(java.lang.String cmd)
Description copied from interface: IOption
Sets a String containing the actual command line option associated with a Boolean option when the value is False

Specified by:
setCommandFalse in interface IOption

setToolTip

public void setToolTip(java.lang.String tooltip)
Description copied from interface: IOption
Sets a String containing the tooltip associated with the option

Specified by:
setToolTip in interface IOption

getVersion

public org.eclipse.core.runtime.PluginVersionIdentifier getVersion()
Specified by:
getVersion in interface IBuildObject

setVersion

public void setVersion(org.eclipse.core.runtime.PluginVersionIdentifier version)
Specified by:
setVersion in interface IBuildObject

getManagedBuildRevision

public java.lang.String getManagedBuildRevision()
Specified by:
getManagedBuildRevision in interface IBuildObject

getValueHandlerElement

public org.eclipse.core.runtime.IConfigurationElement getValueHandlerElement()

setValueHandlerElement

public void setValueHandlerElement(org.eclipse.core.runtime.IConfigurationElement element)

getValueHandler

public IManagedOptionValueHandler getValueHandler()
Description copied from interface: IOption
Returns the value handler specified for this tool.

Specified by:
getValueHandler in interface IOption
Returns:
IManagedOptionValueHandler

getValueHandlerExtraArgument

public java.lang.String getValueHandlerExtraArgument()
Description copied from interface: IOption
Returns the value handlers extra argument specified for this tool

Specified by:
getValueHandlerExtraArgument in interface IOption
Returns:
String

setValueHandlerExtraArgument

public void setValueHandlerExtraArgument(java.lang.String extraArgument)
Description copied from interface: IOption
Sets the value handlers extra argument specified for this tool

Specified by:
setValueHandlerExtraArgument in interface IOption

isValid

public boolean isValid()
Description copied from interface: IOption
Returns true if this option is valid and false if the option cannot be safely used due to an error in the MBS grammar.

Specified by:
isValid in interface IOption
Returns:
boolean

getBasicStringListValue

public java.lang.String[] getBasicStringListValue()
                                           throws BuildException
Description copied from interface: IOption
in case the option basic value type is STRING_LIST, returns the String list value, throws BuildException otherwise

Specified by:
getBasicStringListValue in interface IOption
Returns:
Throws:
BuildException

getBasicValueType

public int getBasicValueType()
                      throws BuildException
Description copied from interface: IOption
Returns the type of the option value, i.e. whether it is string, boolean, string list or enumenration. As opposed to the getValueType() method, the returned type does not specifies the "sense" of the value, e.g. whether it represents the list of includes or not. possible return values: IOption.BOOLEAN IOption.STRING IOption.ENUMERATED IOption.STRING_LIST the STRING_LIST basic value type corresponds to the following option value types: INCLUDE_PATH, PREPROCESSOR_SYMBOLS, LIBRARIES, OBJECTS, INCLUDE_FILES, LIBRARY_PATHS, LIBRARY_FILES, MACRO_FILES

Specified by:
getBasicValueType in interface IOption
Throws:
BuildException

getBasicStringListValueElements

public OptionStringValue[] getBasicStringListValueElements()
                                                    throws BuildException
Specified by:
getBasicStringListValueElements in interface IOption
Throws:
BuildException