mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics - JavaDoc and code formatting
This commit is contained in:
parent
b4f9e7052e
commit
d1bb13b08c
8 changed files with 330 additions and 406 deletions
|
@ -14,7 +14,6 @@ import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
|||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
|
||||
/**
|
||||
*
|
||||
* this interface represent the environment variable provider - the main entry-point
|
||||
* to be used for querying the build environment
|
||||
*
|
||||
|
@ -23,12 +22,10 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IEnvironmentVariableProvider {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the reference to the IBuildEnvironmentVariable interface representing
|
||||
* the variable of a given name
|
||||
*
|
||||
* @param 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
|
||||
|
@ -48,17 +45,27 @@ public interface IEnvironmentVariableProvider{
|
|||
* 2. IManagedProject to represent the managed project
|
||||
* 3. IWorkspace to represent the workspace
|
||||
* 4. null to represent the system environment passed to eclipse
|
||||
*
|
||||
* @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public IBuildEnvironmentVariable getVariable(
|
||||
String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros);
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
/**
|
||||
* Get variable for the given configuration, normally including those defined in project properties
|
||||
* and workspace preferences.
|
||||
*
|
||||
* See also {@code CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(String name, ICConfigurationDescription cfg, boolean resolveMacros)}
|
||||
*
|
||||
* @param variableName - name of the variable (not including $ sign).
|
||||
* @param cfg - configuration or {@code null} for workspace preferences only.
|
||||
* @param resolveMacros - if {@code true} expand macros, {@code false} otherwise.
|
||||
* @return variable defined for the configuration or the workspace.
|
||||
* Returns {@code null} if variable is not defined.
|
||||
*/
|
||||
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, 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
|
||||
|
@ -67,14 +74,22 @@ public interface IEnvironmentVariableProvider{
|
|||
* @return the array of IBuildEnvironmentVariable that represents the environment variables
|
||||
*/
|
||||
@Deprecated
|
||||
public IBuildEnvironmentVariable[] getVariables(
|
||||
Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
public IEnvironmentVariable[] getVariables(
|
||||
IConfiguration cfg, boolean resolveMacros);
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros);
|
||||
|
||||
/**
|
||||
* Get variables for the given configuration, normally including those defined in project properties
|
||||
* and workspace preferences.
|
||||
*
|
||||
* See also {@code CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(ICConfigurationDescription cfg, boolean resolveMacros)}
|
||||
*
|
||||
* @param cfg - configuration or {@code null} for workspace preferences only.
|
||||
* @param resolveMacros - if {@code true} expand macros, {@code false} otherwise.
|
||||
* @return array of variables defined for the configuration or the workspace.
|
||||
* Returns an empty array if no variables are defined.
|
||||
*/
|
||||
public IEnvironmentVariable[] getVariables(IConfiguration cfg, boolean resolveMacros);
|
||||
|
||||
/**
|
||||
* @return 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
|
||||
|
@ -97,7 +112,8 @@ public interface IEnvironmentVariableProvider{
|
|||
|
||||
|
||||
/**
|
||||
* returns the array of String that holds the build paths of the specified type
|
||||
* @return the array of String that holds the build paths of the specified type
|
||||
*
|
||||
* @param configuration represent the configuration for which the paths were changed
|
||||
* @param buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx
|
||||
* (the IEnvVarBuildPath will represent the build environment variables, see also
|
||||
|
@ -107,19 +123,15 @@ public interface IEnvironmentVariableProvider{
|
|||
String[] getBuildPaths(IConfiguration configuration, int buildPathType);
|
||||
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
void subscribe(
|
||||
IEnvironmentBuildPathsChangeListener listener);
|
||||
void subscribe(IEnvironmentBuildPathsChangeListener listener);
|
||||
|
||||
/**
|
||||
*
|
||||
* removes the include and library paths change listener
|
||||
*/
|
||||
void unsubscribe(
|
||||
IEnvironmentBuildPathsChangeListener listener);
|
||||
void unsubscribe(IEnvironmentBuildPathsChangeListener listener);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,10 +35,8 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
|
|||
* build environment functionality to the MBS
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
public class EnvironmentVariableProvider implements
|
||||
IEnvironmentVariableProvider {
|
||||
public class EnvironmentVariableProvider implements IEnvironmentVariableProvider {
|
||||
// private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$NON-NLS-1$
|
||||
|
||||
// private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$
|
||||
|
@ -58,7 +56,6 @@ public class EnvironmentVariableProvider implements
|
|||
* paths from environment variable values
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
static public class DefaultBuildPathResolver implements IBuildPathResolver {
|
||||
private String fDelimiter;
|
||||
|
@ -68,9 +65,7 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] resolveBuildPaths(int pathType, String variableName,
|
||||
String variableValue, IConfiguration configuration) {
|
||||
|
||||
public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
|
||||
if (fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
|
||||
return new String[]{variableValue};
|
||||
|
||||
|
@ -92,13 +87,8 @@ public class EnvironmentVariableProvider implements
|
|||
return fInstance;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||
Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
|
||||
return null;
|
||||
|
||||
|
@ -109,13 +99,11 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros){
|
||||
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros) {
|
||||
return getVariable(variableName, cfg, resolveMacros, true);
|
||||
}
|
||||
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths){
|
||||
public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths) {
|
||||
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||
if (des != null) {
|
||||
IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros);
|
||||
|
@ -171,61 +159,42 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level,
|
||||
boolean includeParentLevels, boolean resolveMacros) {
|
||||
|
||||
public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros) {
|
||||
if (level instanceof IConfiguration) {
|
||||
return wrap(getVariables((IConfiguration)level, resolveMacros));
|
||||
}
|
||||
return new IBuildEnvironmentVariable[0];
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultDelimiter() {
|
||||
return fMngr.getDefaultDelimiter();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
|
||||
*/
|
||||
@Override
|
||||
public boolean isVariableCaseSensitive() {
|
||||
return fMngr.isVariableCaseSensitive();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariableSupplier[] getSuppliers(Object level) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getBuildPaths()
|
||||
*/
|
||||
@Override
|
||||
public String[] getBuildPaths(IConfiguration configuration,
|
||||
int buildPathType) {
|
||||
public String[] getBuildPaths(IConfiguration configuration, int buildPathType) {
|
||||
ITool tools[] = configuration.getFilteredTools();
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
for(int i = 0; i < tools.length; i++){
|
||||
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths();
|
||||
for (ITool tool : tools) {
|
||||
IEnvVarBuildPath pathDescriptors[] = tool.getEnvVarBuildPaths();
|
||||
|
||||
if (pathDescriptors == null || pathDescriptors.length == 0)
|
||||
continue;
|
||||
|
||||
for(int j = 0; j < pathDescriptors.length; j++){
|
||||
IEnvVarBuildPath curPathDes = pathDescriptors[j];
|
||||
for (IEnvVarBuildPath curPathDes : pathDescriptors) {
|
||||
if (curPathDes.getType() != buildPathType)
|
||||
continue;
|
||||
|
||||
|
@ -241,9 +210,7 @@ public class EnvironmentVariableProvider implements
|
|||
pathResolver = new DefaultBuildPathResolver(delimiter);
|
||||
}
|
||||
|
||||
for(int k = 0; k < vars.length; k++){
|
||||
String varName = vars[k];
|
||||
|
||||
for (String varName : vars) {
|
||||
IEnvironmentVariable var = getVariable(varName,configuration,true, false);
|
||||
if (var == null)
|
||||
continue;
|
||||
|
@ -259,8 +226,8 @@ public class EnvironmentVariableProvider implements
|
|||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
* returns a list of registered listeners
|
||||
/**
|
||||
* @return a list of registered listeners
|
||||
*/
|
||||
private List<IEnvironmentBuildPathsChangeListener> getListeners() {
|
||||
if (fListeners == null)
|
||||
|
@ -268,7 +235,7 @@ public class EnvironmentVariableProvider implements
|
|||
return fListeners;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* notifies registered listeners
|
||||
*/
|
||||
private void notifyListeners(IConfiguration configuration, int buildPathType) {
|
||||
|
@ -278,9 +245,6 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#subscribe()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) {
|
||||
if (listener == null)
|
||||
|
@ -292,9 +256,6 @@ public class EnvironmentVariableProvider implements
|
|||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#unsubscribe()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) {
|
||||
if (listener == null)
|
||||
|
@ -305,7 +266,7 @@ public class EnvironmentVariableProvider implements
|
|||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables for the given configuration
|
||||
* If the build variables are changed, the notification is sent
|
||||
*/
|
||||
|
@ -313,7 +274,7 @@ public class EnvironmentVariableProvider implements
|
|||
checkBuildPathVariables(configuration, getVariables(configuration ,true, false));
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables of the specified type
|
||||
* for the given configuration
|
||||
* If the build variables are changed, the notification is sent
|
||||
|
@ -324,7 +285,7 @@ public class EnvironmentVariableProvider implements
|
|||
checkBuildPathVariables(configuration,buildPathType,cr);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables
|
||||
* for the given configuration given the set of the variables
|
||||
* defined for this configuration
|
||||
|
@ -337,7 +298,7 @@ public class EnvironmentVariableProvider implements
|
|||
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of whether the given variable is the build path variable
|
||||
* and if true checks whether it is changed.
|
||||
* In the case of it is changed all other build path variables are checked
|
||||
|
@ -350,7 +311,7 @@ public class EnvironmentVariableProvider implements
|
|||
checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_LIBRARY, varName, var);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of whether the given variable is the build path variable
|
||||
* of the specified type and if true checks whether it is changed.
|
||||
* In the case of it is changed all other build path variables of that type are checked
|
||||
|
@ -370,7 +331,7 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* performs a check of the build path variables of the specified type
|
||||
* for the given configuration given the set of the variables
|
||||
* defined for this configuration.
|
||||
|
@ -385,7 +346,7 @@ public class EnvironmentVariableProvider implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns the container of the build variables of the specified type
|
||||
*/
|
||||
protected StoredBuildPathEnvironmentContainer getStoredBuildPathVariables(int buildPathType) {
|
||||
|
@ -394,7 +355,7 @@ public class EnvironmentVariableProvider implements
|
|||
getStoredIncludeBuildPathVariables();
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns the container of the Include path variables
|
||||
*/
|
||||
protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables() {
|
||||
|
@ -403,7 +364,7 @@ public class EnvironmentVariableProvider implements
|
|||
return fIncludeStoredBuildPathVariables;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns the container of the Library path variables
|
||||
*/
|
||||
protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables() {
|
||||
|
|
|
@ -63,9 +63,6 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
private static String rootCygwin = null;
|
||||
private static String etcCygwin = null;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildPathResolver#resolveBuildPaths(int, java.lang.String, java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration)
|
||||
*/
|
||||
@Override
|
||||
public String[] resolveBuildPaths(int pathType, String variableName,
|
||||
String variableValue, IConfiguration configuration) {
|
||||
|
@ -92,7 +89,8 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* returns "/etc" path in Windows format
|
||||
*/
|
||||
public static String getEtcPath() {
|
||||
|
@ -100,17 +98,17 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
return etcCygwin;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* returns "/usr/bin" path in Windows format
|
||||
*/
|
||||
public static String getBinPath() {
|
||||
if (!checked) findPaths();
|
||||
return binCygwin;
|
||||
}
|
||||
/*
|
||||
|
||||
/**
|
||||
* returns Cygwin root ("/") path in Windows format
|
||||
*/
|
||||
|
||||
public static String getRootPath() {
|
||||
if (!checked) findPaths();
|
||||
return rootCygwin;
|
||||
|
@ -140,6 +138,7 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute path of the pattern by
|
||||
* simply appending the pattern to the root
|
||||
|
|
|
@ -16,13 +16,10 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
|
|||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
|
||||
|
||||
|
||||
/**
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class GnuCygwinConfigurationEnvironmentSupplier implements
|
||||
IConfigurationEnvironmentVariableSupplier {
|
||||
|
||||
public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
|
||||
private static final String PATH = "PATH"; //$NON-NLS-1$
|
||||
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
|
||||
private static final String PROPERTY_DELIMITER = "path.separator"; //$NON-NLS-1$
|
||||
|
@ -32,50 +29,46 @@ public class GnuCygwinConfigurationEnvironmentSupplier implements
|
|||
private static final String LC_ALL = "LC_ALL"; //$NON-NLS-1$
|
||||
private static final String LC_MESSAGES = "LC_MESSAGES"; //$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
|
||||
if (variableName == null)
|
||||
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
if (variableName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!System.getProperty(PROPERTY_OSNAME).toLowerCase().startsWith("windows ")) //$NON-NLS-1$
|
||||
if (!System.getProperty(PROPERTY_OSNAME).toLowerCase().startsWith("windows ")) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
|
||||
if (variableName.equalsIgnoreCase(PATH)) {
|
||||
String p = CygwinPathResolver.getBinPath();
|
||||
if (p != null)
|
||||
if (p != null) {
|
||||
return new BuildEnvVar(PATH, p.replace('/','\\'), IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX));
|
||||
}
|
||||
} else if (variableName.equalsIgnoreCase(LANG)) {
|
||||
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
|
||||
String langValue = System.getenv(LANG);
|
||||
if (langValue == null || langValue.length() == 0)
|
||||
if (langValue == null || langValue.length() == 0) {
|
||||
langValue = System.getenv(LC_ALL);
|
||||
if (langValue == null || langValue.length() == 0)
|
||||
}
|
||||
if (langValue == null || langValue.length() == 0) {
|
||||
langValue = System.getenv(LC_MESSAGES);
|
||||
if (langValue != null && langValue.length() > 0)
|
||||
}
|
||||
if (langValue != null && langValue.length() > 0) {
|
||||
// langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict"
|
||||
// we replace codeset with Latin1 as CDT console garbles UTF
|
||||
// and ignore modifier which is not used by LANG
|
||||
langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
else
|
||||
} else {
|
||||
langValue = "C.ISO-8859-1"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return new BuildEnvVar(LANG, langValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier#getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
|
||||
*/
|
||||
@Override
|
||||
public IBuildEnvironmentVariable[] getVariables(
|
||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
|
||||
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||
IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider);
|
||||
IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider);
|
||||
|
||||
|
|
|
@ -32,24 +32,17 @@ import org.osgi.framework.Version;
|
|||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class IsGnuCygwinToolChainSupported implements
|
||||
IManagedIsToolChainSupported {
|
||||
|
||||
public class IsGnuCygwinToolChainSupported implements IManagedIsToolChainSupported {
|
||||
static final String[] CHECKED_NAMES = {"gcc", "binutils", "make"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
static boolean suppChecked = false;
|
||||
static boolean toolchainIsSupported = false;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain, org.eclipse.core.runtime.PluginVersionIdentifier, java.lang.String)
|
||||
*/
|
||||
/**
|
||||
* @since 8.0
|
||||
*/
|
||||
@Override
|
||||
public boolean isSupported(IToolChain toolChain, Version version, String instance) {
|
||||
|
||||
if (suppChecked) return toolchainIsSupported;
|
||||
|
||||
String etcCygwin = CygwinPathResolver.getEtcPath();
|
||||
|
@ -80,7 +73,9 @@ public class IsGnuCygwinToolChainSupported implements
|
|||
String s;
|
||||
while ((s = data.readLine()) != null ) {
|
||||
for (int j = 0; j < CHECKED_NAMES.length; j++) {
|
||||
if (s.startsWith(CHECKED_NAMES[j])) {found[j] = true;}
|
||||
if (s.startsWith(CHECKED_NAMES[j])) {
|
||||
found[j] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
arePackagesInstalled = true;
|
||||
|
|
|
@ -25,9 +25,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
*/
|
||||
public class MingwEnvironmentVariableSupplier implements
|
||||
IConfigurationEnvironmentVariableSupplier {
|
||||
|
||||
public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
|
||||
private static boolean checked = false;
|
||||
private static IPath binDir = null;
|
||||
|
||||
|
|
|
@ -34,14 +34,11 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
|
|||
|
||||
/**
|
||||
* This class implements the IEnvironmentVariableProvider interface and provides all
|
||||
* build environment funvtionality to the MBS
|
||||
* build environment functionality to the MBS
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
*/
|
||||
public class EnvironmentVariableManager implements
|
||||
IEnvironmentVariableManager {
|
||||
|
||||
public class EnvironmentVariableManager implements IEnvironmentVariableManager {
|
||||
private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$
|
||||
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
|
||||
|
||||
|
@ -114,20 +111,16 @@ public class EnvironmentVariableManager implements
|
|||
return fInstance;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns a variable of a given name or null
|
||||
/**
|
||||
* @return a variable of a given name or null
|
||||
* the context information is taken from the contextInfo passed
|
||||
* @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
|
||||
*/
|
||||
public static EnvVarDescriptor getVariable(String variableName,
|
||||
IEnvironmentContextInfo contextInfo, boolean includeParentLevels){
|
||||
|
||||
public static EnvVarDescriptor getVariable(String variableName, IEnvironmentContextInfo contextInfo, boolean includeParentLevels) {
|
||||
if (contextInfo == null)
|
||||
return null;
|
||||
if ((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null)
|
||||
return null;
|
||||
|
||||
|
||||
IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
|
||||
|
||||
if (!includeParentLevels) {
|
||||
|
@ -178,12 +171,8 @@ public class EnvironmentVariableManager implements
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariable getVariable(String variableName,
|
||||
ICConfigurationDescription cfg, boolean resolveMacros) {
|
||||
public IEnvironmentVariable getVariable(String variableName, ICConfigurationDescription cfg, boolean resolveMacros) {
|
||||
if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
|
||||
return null;
|
||||
|
||||
|
@ -203,8 +192,8 @@ public class EnvironmentVariableManager implements
|
|||
return info;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns the context info that should be used for the given level
|
||||
/**
|
||||
* @return the context info that should be used for the given level
|
||||
* or null if the the given level is not supported
|
||||
*/
|
||||
public IEnvironmentContextInfo getContextInfo(Object level) {
|
||||
|
@ -214,13 +203,11 @@ public class EnvironmentVariableManager implements
|
|||
return getDefaultContextInfo(level);
|
||||
}
|
||||
|
||||
/*
|
||||
* returns a list of defined variables.
|
||||
/**
|
||||
* @return a list of defined variables.
|
||||
* the context information is taken from the contextInfo passed
|
||||
* @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
|
||||
*/
|
||||
public static EnvVarCollector getVariables(IEnvironmentContextInfo contextInfo,
|
||||
boolean includeParentLevels) {
|
||||
public static EnvVarCollector getVariables(IEnvironmentContextInfo contextInfo, boolean includeParentLevels) {
|
||||
if (contextInfo == null)
|
||||
return null;
|
||||
|
||||
|
@ -281,13 +268,8 @@ public class EnvironmentVariableManager implements
|
|||
return envVarSet;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros) {
|
||||
|
||||
|
||||
IEnvironmentContextInfo info = getContextInfo(cfg);
|
||||
EnvVarCollector varSet = getVariables(info,true);
|
||||
|
||||
|
@ -305,8 +287,8 @@ public class EnvironmentVariableManager implements
|
|||
return new EnvVarDescriptor[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* returns an array of the IContextInfo that holds the context informations
|
||||
/**
|
||||
* @return an array of the IContextInfo that holds the context informations
|
||||
* starting from the one passed to this method and including all subsequent parents
|
||||
*/
|
||||
public static IEnvironmentContextInfo[] getAllContextInfos(IEnvironmentContextInfo contextInfo) {
|
||||
|
@ -330,25 +312,16 @@ public class EnvironmentVariableManager implements
|
|||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultDelimiter() {
|
||||
return isWin32() ? DELIMITER_WIN32 : DELIMITER_UNIX;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
|
||||
*/
|
||||
@Override
|
||||
public boolean isVariableCaseSensitive() {
|
||||
return !isWin32();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
|
||||
*/
|
||||
public ICoreEnvironmentVariableSupplier[] getSuppliers(Object level) {
|
||||
IEnvironmentContextInfo info = getContextInfo(level);
|
||||
if (info != null)
|
||||
|
@ -356,8 +329,8 @@ public class EnvironmentVariableManager implements
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns true if the first passed contextInfo is the child of the second one
|
||||
/**
|
||||
* @return true if the first passed contextInfo is the child of the second one
|
||||
*/
|
||||
public boolean checkParentContextRelation(IEnvironmentContextInfo child, IEnvironmentContextInfo parent) {
|
||||
if (child == null || parent == null)
|
||||
|
@ -428,5 +401,4 @@ public class EnvironmentVariableManager implements
|
|||
return fContributedEnvironment;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -385,9 +385,6 @@ public class UserDefinedEnvironmentSupplier extends
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariable getVariable(String name, Object context) {
|
||||
if (getValidName(name) == null)
|
||||
|
@ -399,9 +396,6 @@ public class UserDefinedEnvironmentSupplier extends
|
|||
return EnvVarOperationProcessor.performOperation(env.getVariable(name), var);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariables()
|
||||
*/
|
||||
@Override
|
||||
public IEnvironmentVariable[] getVariables(Object context) {
|
||||
StorableEnvironment env = getEnvironment(context);
|
||||
|
|
Loading…
Add table
Reference in a new issue