org.eclipse.cdt.managedbuilder.internal.envvar
Class EnvironmentVariableProvider

java.lang.Object
  extended by org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableProvider
All Implemented Interfaces:
IEnvironmentVariableProvider

public class EnvironmentVariableProvider
extends java.lang.Object
implements IEnvironmentVariableProvider

This class implements the IEnvironmentVariableProvider interface and provides all build environment funvtionality to the MBS

Since:
3.0

Nested Class Summary
static class EnvironmentVariableProvider.DefaultBuildPathResolver
          This class is used by the EnvironmentVariableProvider to calculate the build paths in case a tool-integrator did not provide the special logic for obtaining the build paths from environment variable values
 
Method Summary
 void checkBuildPathVariables(IConfiguration configuration)
           
 void checkBuildPathVariables(IConfiguration configuration, int buildPathType)
           
 java.lang.String[] getBuildPaths(IConfiguration configuration, int buildPathType)
          returns the array of String that holds the build paths of the specified type
static EnvironmentVariableProvider getDefault()
           
 java.lang.String getDefaultDelimiter()
           
 IEnvironmentVariableSupplier[] getSuppliers(java.lang.Object level)
          This method is defined to be used basically by the UI classes and should not be used by the tool-integrator
 IEnvironmentVariable getVariable(java.lang.String variableName, IConfiguration cfg, boolean resolveMacros)
           
 IEnvironmentVariable getVariable(java.lang.String variableName, IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths)
           
 IBuildEnvironmentVariable getVariable(java.lang.String variableName, java.lang.Object level, boolean includeParentLevels, boolean resolveMacros)
           
 IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros)
           
 IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths)
           
 IBuildEnvironmentVariable[] getVariables(java.lang.Object level, boolean includeParentLevels, boolean resolveMacros)
          if environment variable names are case insensitive in the current OS, the environment variable provider will remove the duplicates of the variables if their names differ only by case
 boolean isVariableCaseSensitive()
           
 void subscribe(IEnvironmentBuildPathsChangeListener listener)
          adds the listener that will return notifications about the include and library paths changes.
 void unsubscribe(IEnvironmentBuildPathsChangeListener listener)
          removes the include and library paths change listener
static IBuildEnvironmentVariable wrap(IEnvironmentVariable var)
           
static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable[] vars)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefault

public static EnvironmentVariableProvider getDefault()

getVariable

public IBuildEnvironmentVariable getVariable(java.lang.String variableName,
                                             java.lang.Object level,
                                             boolean includeParentLevels,
                                             boolean resolveMacros)
Specified by:
getVariable in interface IEnvironmentVariableProvider
Parameters:
variableName - environment variable name if environment variable names are case insensitive in the current OS, the environment variable provider will query the getVariable method of suppliers always passing it the uppercase variable name not depending on the case of the variableName passed to the IEnvironmentVariableProvider.getVariable() method. This will prevent the supplier from answering different values for the same variable given the names that differ only by case. E.g. if the current OS does not support case sensitive variables both of the calls below: provider.getVariable("FOO",level,includeParentContexts); provider.getVariable("foo",level,includeParentContexts); will result in asking suppliers for the "FOO" variable
level - could be one of the following: 1. IConfiguration to represent the configuration 2. IManagedProject to represent the managed project 3. IWorkspace to represent the workspace 4. null to represent the system environment passed to eclipse
Returns:
the reference to the IBuildEnvironmentVariable interface representing the variable of a given name

getVariable

public IEnvironmentVariable getVariable(java.lang.String variableName,
                                        IConfiguration cfg,
                                        boolean resolveMacros)
Specified by:
getVariable in interface IEnvironmentVariableProvider

getVariable

public IEnvironmentVariable getVariable(java.lang.String variableName,
                                        IConfiguration cfg,
                                        boolean resolveMacros,
                                        boolean checkBuildPaths)

getVariables

public IEnvironmentVariable[] getVariables(IConfiguration cfg,
                                           boolean resolveMacros)
Specified by:
getVariables in interface IEnvironmentVariableProvider

getVariables

public IEnvironmentVariable[] getVariables(IConfiguration cfg,
                                           boolean resolveMacros,
                                           boolean checkBuildPaths)

wrap

public static IBuildEnvironmentVariable wrap(IEnvironmentVariable var)

wrap

public static IBuildEnvironmentVariable[] wrap(IEnvironmentVariable[] vars)

getVariables

public IBuildEnvironmentVariable[] getVariables(java.lang.Object level,
                                                boolean includeParentLevels,
                                                boolean resolveMacros)
Description copied from interface: IEnvironmentVariableProvider
if environment variable names are case insensitive in the current OS, the environment variable provider will remove the duplicates of the variables if their names differ only by case

Specified by:
getVariables in interface IEnvironmentVariableProvider
Returns:
the array of IBuildEnvironmentVariable that represents the environment variables

getDefaultDelimiter

public java.lang.String getDefaultDelimiter()
Specified by:
getDefaultDelimiter in interface IEnvironmentVariableProvider
Returns:
the String representing default system delimiter. That is the ":" for Unix-like systems and the ";" for Win32 systems. This method will be used by the tool-integrator provided variable supplier e.g. in order to concatenate the list of paths into the environment variable, etc.

isVariableCaseSensitive

public boolean isVariableCaseSensitive()
Specified by:
isVariableCaseSensitive in interface IEnvironmentVariableProvider
Returns:
true if the OS supports case sensitive variables (Unix-like systems) or false if it does not (Win32 systems)

getSuppliers

public IEnvironmentVariableSupplier[] getSuppliers(java.lang.Object level)
Description copied from interface: IEnvironmentVariableProvider
This method is defined to be used basically by the UI classes and should not be used by the tool-integrator

Specified by:
getSuppliers in interface IEnvironmentVariableProvider
Returns:
the array of the provider-internal suppliers for the given level

getBuildPaths

public java.lang.String[] getBuildPaths(IConfiguration configuration,
                                        int buildPathType)
Description copied from interface: IEnvironmentVariableProvider
returns the array of String that holds the build paths of the specified type

Specified by:
getBuildPaths in interface IEnvironmentVariableProvider
Parameters:
configuration - represent the configuration for which the paths were changed
buildPathType - can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx (the IEnvVarBuildPath will represent the build environment variables, see also the "Specifying the Includes and Library paths environment variables", the "envVarBuildPath schema" and the "Expected CDT/MBS code changes" sections)

subscribe

public void subscribe(IEnvironmentBuildPathsChangeListener listener)
Description copied from interface: IEnvironmentVariableProvider
adds the listener that will return notifications about the include and library paths changes. The ManagedBuildManager will register the change listener and will notify all registered Scanned Info Change Listeners about the include paths change.

Specified by:
subscribe in interface IEnvironmentVariableProvider

unsubscribe

public void unsubscribe(IEnvironmentBuildPathsChangeListener listener)
Description copied from interface: IEnvironmentVariableProvider
removes the include and library paths change listener

Specified by:
unsubscribe in interface IEnvironmentVariableProvider

checkBuildPathVariables

public void checkBuildPathVariables(IConfiguration configuration)

checkBuildPathVariables

public void checkBuildPathVariables(IConfiguration configuration,
                                    int buildPathType)