org.eclipse.cdt.internal.core.cdtvariables
Class CdtVariableManager

java.lang.Object
  extended by org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager
All Implemented Interfaces:
ICdtVariableManager

public class CdtVariableManager
extends java.lang.Object
implements ICdtVariableManager

The default IBuildMacroProvider implementation

Since:
3.0

Field Summary
static BuildSystemVariableSupplier fBuildSystemVariableSupplier
           
static CdtMacroSupplier fCdtMacroSupplier
           
static EclipseVariablesVariableSupplier fEclipseVariablesMacroSupplier
           
static EnvironmentVariableSupplier fEnvironmentMacroSupplier
           
static UserDefinedVariableSupplier fUserDefinedMacroSupplier
           
 
Method Summary
 void checkVariableIntegrity(org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
          checks the integrity of the Macros If there are inconsistencies, such as when a macro value refers to a nonexistent macro or when two macros refer to each other, this method will throw the BuildMacroException exception The BuildMacroException will contain the human-readable string describing the inconsistency and the array of the IBuildMacro interfaces that will represent the macros that caused the inconsistency.
 java.lang.String convertStringListToString(java.lang.String[] value, java.lang.String listDelimiter)
          converts StringList value into String of the following format: "< listDelimiter >< listDelimiter > ...
static CdtVariableManager getDefault()
           
 org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo getMacroContextInfo(int contextType, java.lang.Object contextData)
           
 org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor getMacroSubstitutor(org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo info, java.lang.String inexistentMacroValue, java.lang.String listDelimiter)
           
 org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier[] getSuppliers(int contextType, java.lang.Object contextData)
           
 ICdtVariable getVariable(java.lang.String macroName, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
          Returns reference to the IBuildMacro interface representing Macro of the specified name or null if there is there is no such macro
 ICdtVariable[] getVariables(org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
           
 boolean isEnvironmentVariable(ICdtVariable variable, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
           
 boolean isStringListValue(java.lang.String value, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
           
 boolean isUserVariable(ICdtVariable variable, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
           
 java.lang.String[] resolveStringListValue(java.lang.String value, java.lang.String nonexistentMacrosValue, java.lang.String listDelimiter, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
          if the string contains a value that can be treated as a StringList resolves it to arrays of strings otherwise throws the BuildMacroException exception
 java.lang.String[] resolveStringListValues(java.lang.String[] value, java.lang.String nonexistentMacrosValue, java.lang.String listDelimiter, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
          resolves macros in the array of string-list values
 java.lang.String resolveValue(java.lang.String value, java.lang.String nonexistentMacrosValue, java.lang.String listDelimiter, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
          resolves all macros in the string.
 org.eclipse.core.variables.IStringVariable toEclipseVariable(ICdtVariable variable, org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fUserDefinedMacroSupplier

public static final UserDefinedVariableSupplier fUserDefinedMacroSupplier

fBuildSystemVariableSupplier

public static final BuildSystemVariableSupplier fBuildSystemVariableSupplier

fEnvironmentMacroSupplier

public static final EnvironmentVariableSupplier fEnvironmentMacroSupplier

fCdtMacroSupplier

public static final CdtMacroSupplier fCdtMacroSupplier

fEclipseVariablesMacroSupplier

public static final EclipseVariablesVariableSupplier fEclipseVariablesMacroSupplier
Method Detail

getDefault

public static CdtVariableManager getDefault()

getVariable

public ICdtVariable getVariable(java.lang.String macroName,
                                org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
Description copied from interface: ICdtVariableManager
Returns reference to the IBuildMacro interface representing Macro of the specified name or null if there is there is no such macro

Specified by:
getVariable in interface ICdtVariableManager

getVariables

public ICdtVariable[] getVariables(org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
Specified by:
getVariables in interface ICdtVariableManager
Returns:
the array of the IBuildMacro representing all available macros

getSuppliers

public org.eclipse.cdt.utils.cdtvariables.ICdtVariableSupplier[] getSuppliers(int contextType,
                                                                              java.lang.Object contextData)

getMacroContextInfo

public org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo getMacroContextInfo(int contextType,
                                                                                   java.lang.Object contextData)
Parameters:
contextType -
contextData -
Returns:

convertStringListToString

public java.lang.String convertStringListToString(java.lang.String[] value,
                                                  java.lang.String listDelimiter)
Description copied from interface: ICdtVariableManager
converts StringList value into String of the following format: "< listDelimiter >< listDelimiter > ... "

Specified by:
convertStringListToString in interface ICdtVariableManager

resolveValue

public java.lang.String resolveValue(java.lang.String value,
                                     java.lang.String nonexistentMacrosValue,
                                     java.lang.String listDelimiter,
                                     org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
                              throws CdtVariableException
Description copied from interface: ICdtVariableManager
resolves all macros in the string.

Specified by:
resolveValue in interface ICdtVariableManager
Parameters:
value - the value to be resolved
nonexistentMacrosValue - specifies the value that inexistent macro references will be expanded to. If null the BuildMacroException is thrown in case the string to be resolved references inexistent macros
listDelimiter - if not null, StringList macros are expanded as �< listDelimiter >< listDelimiter > ... � otherwise the BuildMacroException is thrown in case the string to be resolved references string-list macros
Throws:
CdtVariableException

resolveStringListValue

public java.lang.String[] resolveStringListValue(java.lang.String value,
                                                 java.lang.String nonexistentMacrosValue,
                                                 java.lang.String listDelimiter,
                                                 org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
                                          throws CdtVariableException
Description copied from interface: ICdtVariableManager
if the string contains a value that can be treated as a StringList resolves it to arrays of strings otherwise throws the BuildMacroException exception

Specified by:
resolveStringListValue in interface ICdtVariableManager
Throws:
CdtVariableException
See Also:
isStringListValue

isStringListValue

public boolean isStringListValue(java.lang.String value,
                                 org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
                          throws CdtVariableException
Specified by:
isStringListValue in interface ICdtVariableManager
Returns:
true if the specified expression can be treated as StringList 1. The string value is �${}�
Throws:
CdtVariableException

checkVariableIntegrity

public void checkVariableIntegrity(org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
                            throws CdtVariableException
Description copied from interface: ICdtVariableManager
checks the integrity of the Macros If there are inconsistencies, such as when a macro value refers to a nonexistent macro or when two macros refer to each other, this method will throw the BuildMacroException exception The BuildMacroException will contain the human-readable string describing the inconsistency and the array of the IBuildMacro interfaces that will represent the macros that caused the inconsistency. This information will be used in the UI to notify the user about the macro inconsistencies (see also the �User interface for viewing and editing Build Macros� section of this design)

Specified by:
checkVariableIntegrity in interface ICdtVariableManager
Throws:
CdtVariableException

getMacroSubstitutor

public org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor getMacroSubstitutor(org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo info,
                                                                                   java.lang.String inexistentMacroValue,
                                                                                   java.lang.String listDelimiter)

resolveStringListValues

public java.lang.String[] resolveStringListValues(java.lang.String[] value,
                                                  java.lang.String nonexistentMacrosValue,
                                                  java.lang.String listDelimiter,
                                                  org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
                                           throws CdtVariableException
Description copied from interface: ICdtVariableManager
resolves macros in the array of string-list values

Specified by:
resolveStringListValues in interface ICdtVariableManager
Throws:
CdtVariableException
See Also:
isStringListValue

isEnvironmentVariable

public boolean isEnvironmentVariable(ICdtVariable variable,
                                     org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
Specified by:
isEnvironmentVariable in interface ICdtVariableManager

toEclipseVariable

public org.eclipse.core.variables.IStringVariable toEclipseVariable(ICdtVariable variable,
                                                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
Specified by:
toEclipseVariable in interface ICdtVariableManager

isUserVariable

public boolean isUserVariable(ICdtVariable variable,
                              org.eclipse.cdt.core.settings.model.ICConfigurationDescription cfg)
Specified by:
isUserVariable in interface ICdtVariableManager