1
0
Fork 0
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:
Andrew Gvozdev 2012-07-08 16:06:19 -04:00
parent b4f9e7052e
commit d1bb13b08c
8 changed files with 330 additions and 406 deletions

View file

@ -14,7 +14,6 @@ import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
/** /**
*
* this interface represent the environment variable provider - the main entry-point * this interface represent the environment variable provider - the main entry-point
* to be used for querying the build environment * 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. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IEnvironmentVariableProvider { public interface IEnvironmentVariableProvider {
/** /**
*
*
* @return the reference to the IBuildEnvironmentVariable interface representing * @return the reference to the IBuildEnvironmentVariable interface representing
* the variable of a given name * the variable of a given name
*
* @param variableName environment variable name * @param variableName environment variable name
* if environment variable names are case insensitive in the current OS, * if environment variable names are case insensitive in the current OS,
* the environment variable provider will query the getVariable method of suppliers always * 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 * 2. IManagedProject to represent the managed project
* 3. IWorkspace to represent the workspace * 3. IWorkspace to represent the workspace
* 4. null to represent the system environment passed to eclipse * 4. null to represent the system environment passed to eclipse
*
* @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead * @deprecated use {@link IEnvironmentVariableProvider#getVariable(String, IConfiguration, boolean)} instead
*/ */
@Deprecated @Deprecated
public IBuildEnvironmentVariable getVariable( public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
String variableName, Object level, boolean includeParentLevels, boolean resolveMacros);
public IEnvironmentVariable getVariable(String variableName,
IConfiguration cfg, 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, * 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 * the environment variable provider will remove the duplicates of the variables if their names
* differ only by case * differ only by case
@ -67,14 +74,22 @@ public interface IEnvironmentVariableProvider{
* @return the array of IBuildEnvironmentVariable that represents the environment variables * @return the array of IBuildEnvironmentVariable that represents the environment variables
*/ */
@Deprecated @Deprecated
public IBuildEnvironmentVariable[] getVariables( public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros);
Object level, boolean includeParentLevels, boolean resolveMacros);
public IEnvironmentVariable[] getVariables(
IConfiguration cfg, 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 * @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 * 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 * 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 configuration represent the configuration for which the paths were changed
* @param buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx * @param buildPathType can be set to one of the IEnvVarBuildPath.BUILDPATH _xxx
* (the IEnvVarBuildPath will represent the build environment variables, see also * (the IEnvVarBuildPath will represent the build environment variables, see also
@ -107,19 +123,15 @@ public interface IEnvironmentVariableProvider{
String[] getBuildPaths(IConfiguration configuration, int buildPathType); String[] getBuildPaths(IConfiguration configuration, int buildPathType);
/** /**
*
* adds the listener that will return notifications about the include and library paths changes. * 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 * The ManagedBuildManager will register the change listener and will notify all registered
* Scanned Info Change Listeners about the include paths change. * Scanned Info Change Listeners about the include paths change.
*/ */
void subscribe( void subscribe(IEnvironmentBuildPathsChangeListener listener);
IEnvironmentBuildPathsChangeListener listener);
/** /**
*
* removes the include and library paths change listener * removes the include and library paths change listener
*/ */
void unsubscribe( void unsubscribe(IEnvironmentBuildPathsChangeListener listener);
IEnvironmentBuildPathsChangeListener listener);
} }

View file

@ -35,10 +35,8 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
* build environment functionality to the MBS * build environment functionality to the MBS
* *
* @since 3.0 * @since 3.0
*
*/ */
public class EnvironmentVariableProvider implements public class EnvironmentVariableProvider implements IEnvironmentVariableProvider {
IEnvironmentVariableProvider {
// private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$NON-NLS-1$ // private static final QualifiedName fBuildPathVarProperty = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "buildPathVar"); //$NON-NLS-1$
// private static final String DELIMITER_WIN32 = ";"; //$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 * paths from environment variable values
* *
* @since 3.0 * @since 3.0
*
*/ */
static public class DefaultBuildPathResolver implements IBuildPathResolver { static public class DefaultBuildPathResolver implements IBuildPathResolver {
private String fDelimiter; private String fDelimiter;
@ -68,9 +65,7 @@ public class EnvironmentVariableProvider implements
} }
@Override @Override
public String[] resolveBuildPaths(int pathType, String variableName, public String[] resolveBuildPaths(int pathType, String variableName, String variableValue, IConfiguration configuration) {
String variableValue, IConfiguration configuration) {
if (fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$ if (fDelimiter == null || "".equals(fDelimiter)) //$NON-NLS-1$
return new String[]{variableValue}; return new String[]{variableValue};
@ -92,13 +87,8 @@ public class EnvironmentVariableProvider implements
return fInstance; return fInstance;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
*/
@Override @Override
public IBuildEnvironmentVariable getVariable(String variableName, public IBuildEnvironmentVariable getVariable(String variableName, Object level, boolean includeParentLevels, boolean resolveMacros) {
Object level, boolean includeParentLevels, boolean resolveMacros) {
if (variableName == null || "".equals(variableName)) //$NON-NLS-1$ if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
return null; return null;
@ -109,13 +99,11 @@ public class EnvironmentVariableProvider implements
} }
@Override @Override
public IEnvironmentVariable getVariable(String variableName, public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros) {
IConfiguration cfg, boolean resolveMacros){
return getVariable(variableName, cfg, resolveMacros, true); return getVariable(variableName, cfg, resolveMacros, true);
} }
public IEnvironmentVariable getVariable(String variableName, public IEnvironmentVariable getVariable(String variableName, IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths) {
IConfiguration cfg, boolean resolveMacros, boolean checkBuildPaths){
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg); ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(cfg);
if (des != null) { if (des != null) {
IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros); IEnvironmentVariable variable = fMngr.getVariable(variableName, des, resolveMacros);
@ -171,61 +159,42 @@ public class EnvironmentVariableProvider implements
} }
return null; return null;
} }
*/
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
*/ */
@Override @Override
public IBuildEnvironmentVariable[] getVariables(Object level, public IBuildEnvironmentVariable[] getVariables(Object level, boolean includeParentLevels, boolean resolveMacros) {
boolean includeParentLevels, boolean resolveMacros) {
if (level instanceof IConfiguration) { if (level instanceof IConfiguration) {
return wrap(getVariables((IConfiguration)level, resolveMacros)); return wrap(getVariables((IConfiguration)level, resolveMacros));
} }
return new IBuildEnvironmentVariable[0]; return new IBuildEnvironmentVariable[0];
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
*/
@Override @Override
public String getDefaultDelimiter() { public String getDefaultDelimiter() {
return fMngr.getDefaultDelimiter(); return fMngr.getDefaultDelimiter();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
*/
@Override @Override
public boolean isVariableCaseSensitive() { public boolean isVariableCaseSensitive() {
return fMngr.isVariableCaseSensitive(); return fMngr.isVariableCaseSensitive();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
*/
@Override @Override
public IEnvironmentVariableSupplier[] getSuppliers(Object level) { public IEnvironmentVariableSupplier[] getSuppliers(Object level) {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getBuildPaths()
*/
@Override @Override
public String[] getBuildPaths(IConfiguration configuration, public String[] getBuildPaths(IConfiguration configuration, int buildPathType) {
int buildPathType) {
ITool tools[] = configuration.getFilteredTools(); ITool tools[] = configuration.getFilteredTools();
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for(int i = 0; i < tools.length; i++){ for (ITool tool : tools) {
IEnvVarBuildPath pathDescriptors[] = tools[i].getEnvVarBuildPaths(); IEnvVarBuildPath pathDescriptors[] = tool.getEnvVarBuildPaths();
if (pathDescriptors == null || pathDescriptors.length == 0) if (pathDescriptors == null || pathDescriptors.length == 0)
continue; continue;
for(int j = 0; j < pathDescriptors.length; j++){ for (IEnvVarBuildPath curPathDes : pathDescriptors) {
IEnvVarBuildPath curPathDes = pathDescriptors[j];
if (curPathDes.getType() != buildPathType) if (curPathDes.getType() != buildPathType)
continue; continue;
@ -241,9 +210,7 @@ public class EnvironmentVariableProvider implements
pathResolver = new DefaultBuildPathResolver(delimiter); pathResolver = new DefaultBuildPathResolver(delimiter);
} }
for(int k = 0; k < vars.length; k++){ for (String varName : vars) {
String varName = vars[k];
IEnvironmentVariable var = getVariable(varName,configuration,true, false); IEnvironmentVariable var = getVariable(varName,configuration,true, false);
if (var == null) if (var == null)
continue; continue;
@ -259,8 +226,8 @@ public class EnvironmentVariableProvider implements
return list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
/* /**
* returns a list of registered listeners * @return a list of registered listeners
*/ */
private List<IEnvironmentBuildPathsChangeListener> getListeners() { private List<IEnvironmentBuildPathsChangeListener> getListeners() {
if (fListeners == null) if (fListeners == null)
@ -268,7 +235,7 @@ public class EnvironmentVariableProvider implements
return fListeners; return fListeners;
} }
/* /**
* notifies registered listeners * notifies registered listeners
*/ */
private void notifyListeners(IConfiguration configuration, int buildPathType) { 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 @Override
public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) { public synchronized void subscribe(IEnvironmentBuildPathsChangeListener listener) {
if (listener == null) if (listener == null)
@ -292,9 +256,6 @@ public class EnvironmentVariableProvider implements
listeners.add(listener); listeners.add(listener);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#unsubscribe()
*/
@Override @Override
public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) { public synchronized void unsubscribe(IEnvironmentBuildPathsChangeListener listener) {
if (listener == null) if (listener == null)
@ -305,7 +266,7 @@ public class EnvironmentVariableProvider implements
listeners.remove(listener); listeners.remove(listener);
} }
/* /**
* performs a check of the build path variables for the given configuration * performs a check of the build path variables for the given configuration
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
*/ */
@ -313,7 +274,7 @@ public class EnvironmentVariableProvider implements
checkBuildPathVariables(configuration, getVariables(configuration ,true, false)); checkBuildPathVariables(configuration, getVariables(configuration ,true, false));
} }
/* /**
* performs a check of the build path variables of the specified type * performs a check of the build path variables of the specified type
* for the given configuration * for the given configuration
* If the build variables are changed, the notification is sent * If the build variables are changed, the notification is sent
@ -324,7 +285,7 @@ public class EnvironmentVariableProvider implements
checkBuildPathVariables(configuration,buildPathType,cr); checkBuildPathVariables(configuration,buildPathType,cr);
} }
/* /**
* performs a check of the build path variables * performs a check of the build path variables
* for the given configuration given the set of the variables * for the given configuration given the set of the variables
* defined for this configuration * defined for this configuration
@ -337,7 +298,7 @@ public class EnvironmentVariableProvider implements
checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr); checkBuildPathVariables(configuration,IEnvVarBuildPath.BUILDPATH_LIBRARY,cr);
} }
/* /**
* performs a check of whether the given variable is the build path variable * performs a check of whether the given variable is the build path variable
* and if true checks whether it is changed. * and if true checks whether it is changed.
* In the case of it is changed all other build path variables are checked * 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); checkBuildPathVariable(configuration, IEnvVarBuildPath.BUILDPATH_LIBRARY, varName, var);
} }
/* /**
* performs a check of whether the given variable is the build path variable * 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. * 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 * 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 * performs a check of the build path variables of the specified type
* for the given configuration given the set of the variables * for the given configuration given the set of the variables
* defined for this configuration. * defined for this configuration.
@ -385,7 +346,7 @@ public class EnvironmentVariableProvider implements
} }
} }
/* /**
* returns the container of the build variables of the specified type * returns the container of the build variables of the specified type
*/ */
protected StoredBuildPathEnvironmentContainer getStoredBuildPathVariables(int buildPathType) { protected StoredBuildPathEnvironmentContainer getStoredBuildPathVariables(int buildPathType) {
@ -394,7 +355,7 @@ public class EnvironmentVariableProvider implements
getStoredIncludeBuildPathVariables(); getStoredIncludeBuildPathVariables();
} }
/* /**
* returns the container of the Include path variables * returns the container of the Include path variables
*/ */
protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables() { protected StoredBuildPathEnvironmentContainer getStoredIncludeBuildPathVariables() {
@ -403,7 +364,7 @@ public class EnvironmentVariableProvider implements
return fIncludeStoredBuildPathVariables; return fIncludeStoredBuildPathVariables;
} }
/* /**
* returns the container of the Library path variables * returns the container of the Library path variables
*/ */
protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables() { protected StoredBuildPathEnvironmentContainer getStoredLibraryBuildPathVariables() {

View file

@ -63,9 +63,6 @@ public class CygwinPathResolver implements IBuildPathResolver {
private static String rootCygwin = null; private static String rootCygwin = null;
private static String etcCygwin = 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 @Override
public String[] resolveBuildPaths(int pathType, String variableName, public String[] resolveBuildPaths(int pathType, String variableName,
String variableValue, IConfiguration configuration) { String variableValue, IConfiguration configuration) {
@ -92,7 +89,8 @@ public class CygwinPathResolver implements IBuildPathResolver {
} }
return result; return result;
} }
/*
/**
* returns "/etc" path in Windows format * returns "/etc" path in Windows format
*/ */
public static String getEtcPath() { public static String getEtcPath() {
@ -100,17 +98,17 @@ public class CygwinPathResolver implements IBuildPathResolver {
return etcCygwin; return etcCygwin;
} }
/* /**
* returns "/usr/bin" path in Windows format * returns "/usr/bin" path in Windows format
*/ */
public static String getBinPath() { public static String getBinPath() {
if (!checked) findPaths(); if (!checked) findPaths();
return binCygwin; return binCygwin;
} }
/*
/**
* returns Cygwin root ("/") path in Windows format * returns Cygwin root ("/") path in Windows format
*/ */
public static String getRootPath() { public static String getRootPath() {
if (!checked) findPaths(); if (!checked) findPaths();
return rootCygwin; return rootCygwin;
@ -140,6 +138,7 @@ public class CygwinPathResolver implements IBuildPathResolver {
} }
return null; return null;
} }
/** /**
* Returns the absolute path of the pattern by * Returns the absolute path of the pattern by
* simply appending the pattern to the root * simply appending the pattern to the root

View file

@ -16,13 +16,10 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider; import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar; import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class GnuCygwinConfigurationEnvironmentSupplier implements public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
IConfigurationEnvironmentVariableSupplier {
private static final String PATH = "PATH"; //$NON-NLS-1$ private static final String PATH = "PATH"; //$NON-NLS-1$
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$ private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
private static final String PROPERTY_DELIMITER = "path.separator"; //$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_ALL = "LC_ALL"; //$NON-NLS-1$
private static final String LC_MESSAGES = "LC_MESSAGES"; //$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 @Override
public IBuildEnvironmentVariable getVariable(String variableName, public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) { if (variableName == null) {
if (variableName == null)
return 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; return null;
}
if (variableName.equalsIgnoreCase(PATH)) { if (variableName.equalsIgnoreCase(PATH)) {
String p = CygwinPathResolver.getBinPath(); 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)); return new BuildEnvVar(PATH, p.replace('/','\\'), IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX));
}
} else if (variableName.equalsIgnoreCase(LANG)) { } else if (variableName.equalsIgnoreCase(LANG)) {
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1 // Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
String langValue = System.getenv(LANG); String langValue = System.getenv(LANG);
if (langValue == null || langValue.length() == 0) if (langValue == null || langValue.length() == 0) {
langValue = System.getenv(LC_ALL); langValue = System.getenv(LC_ALL);
if (langValue == null || langValue.length() == 0) }
if (langValue == null || langValue.length() == 0) {
langValue = System.getenv(LC_MESSAGES); 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" // langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict"
// we replace codeset with Latin1 as CDT console garbles UTF // we replace codeset with Latin1 as CDT console garbles UTF
// and ignore modifier which is not used by LANG // and ignore modifier which is not used by LANG
langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$ langValue = langValue.replaceFirst("([^.@]*)(\\..*)?(@.*)?", "$1.ISO-8859-1"); //$NON-NLS-1$ //$NON-NLS-2$
else } else {
langValue = "C.ISO-8859-1"; //$NON-NLS-1$ langValue = "C.ISO-8859-1"; //$NON-NLS-1$
}
return new BuildEnvVar(LANG, langValue); return new BuildEnvVar(LANG, langValue);
} }
return null; 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 @Override
public IBuildEnvironmentVariable[] getVariables( public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
IConfiguration configuration, IEnvironmentVariableProvider provider) {
IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider); IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider);
IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider); IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider);

View file

@ -32,24 +32,17 @@ import org.osgi.framework.Version;
* *
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class IsGnuCygwinToolChainSupported implements public class IsGnuCygwinToolChainSupported implements IManagedIsToolChainSupported {
IManagedIsToolChainSupported {
static final String[] CHECKED_NAMES = {"gcc", "binutils", "make"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ static final String[] CHECKED_NAMES = {"gcc", "binutils", "make"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
static boolean suppChecked = false; static boolean suppChecked = false;
static boolean toolchainIsSupported = 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 * @since 8.0
*/ */
@Override @Override
public boolean isSupported(IToolChain toolChain, Version version, String instance) { public boolean isSupported(IToolChain toolChain, Version version, String instance) {
if (suppChecked) return toolchainIsSupported; if (suppChecked) return toolchainIsSupported;
String etcCygwin = CygwinPathResolver.getEtcPath(); String etcCygwin = CygwinPathResolver.getEtcPath();
@ -80,7 +73,9 @@ public class IsGnuCygwinToolChainSupported implements
String s; String s;
while ((s = data.readLine()) != null ) { while ((s = data.readLine()) != null ) {
for (int j = 0; j < CHECKED_NAMES.length; j++) { 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; arePackagesInstalled = true;

View file

@ -25,9 +25,7 @@ import org.eclipse.core.runtime.Platform;
* *
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class MingwEnvironmentVariableSupplier implements public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
IConfigurationEnvironmentVariableSupplier {
private static boolean checked = false; private static boolean checked = false;
private static IPath binDir = null; private static IPath binDir = null;

View file

@ -34,14 +34,11 @@ import org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor;
/** /**
* This class implements the IEnvironmentVariableProvider interface and provides all * This class implements the IEnvironmentVariableProvider interface and provides all
* build environment funvtionality to the MBS * build environment functionality to the MBS
* *
* @since 3.0 * @since 3.0
*
*/ */
public class EnvironmentVariableManager implements public class EnvironmentVariableManager implements IEnvironmentVariableManager {
IEnvironmentVariableManager {
private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$ private static final String DELIMITER_WIN32 = ";"; //$NON-NLS-1$
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$ private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
@ -114,20 +111,16 @@ public class EnvironmentVariableManager implements
return fInstance; 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 * the context information is taken from the contextInfo passed
* @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
*/ */
public static EnvVarDescriptor getVariable(String variableName, public static EnvVarDescriptor getVariable(String variableName, IEnvironmentContextInfo contextInfo, boolean includeParentLevels) {
IEnvironmentContextInfo contextInfo, boolean includeParentLevels){
if (contextInfo == null) if (contextInfo == null)
return null; return null;
if ((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null) if ((variableName = EnvVarOperationProcessor.normalizeName(variableName)) == null)
return null; return null;
IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo); IEnvironmentContextInfo infos[] = getAllContextInfos(contextInfo);
if (!includeParentLevels) { if (!includeParentLevels) {
@ -178,12 +171,8 @@ public class EnvironmentVariableManager implements
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariable()
*/
@Override @Override
public IEnvironmentVariable getVariable(String variableName, public IEnvironmentVariable getVariable(String variableName, ICConfigurationDescription cfg, boolean resolveMacros) {
ICConfigurationDescription cfg, boolean resolveMacros) {
if (variableName == null || "".equals(variableName)) //$NON-NLS-1$ if (variableName == null || "".equals(variableName)) //$NON-NLS-1$
return null; return null;
@ -203,8 +192,8 @@ public class EnvironmentVariableManager implements
return info; 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 * or null if the the given level is not supported
*/ */
public IEnvironmentContextInfo getContextInfo(Object level) { public IEnvironmentContextInfo getContextInfo(Object level) {
@ -214,13 +203,11 @@ public class EnvironmentVariableManager implements
return getDefaultContextInfo(level); return getDefaultContextInfo(level);
} }
/* /**
* returns a list of defined variables. * @return a list of defined variables.
* the context information is taken from the contextInfo passed * the context information is taken from the contextInfo passed
* @see org.eclipse.cdt.managedbuilder.internal.envvar.IContextInfo
*/ */
public static EnvVarCollector getVariables(IEnvironmentContextInfo contextInfo, public static EnvVarCollector getVariables(IEnvironmentContextInfo contextInfo, boolean includeParentLevels) {
boolean includeParentLevels) {
if (contextInfo == null) if (contextInfo == null)
return null; return null;
@ -281,13 +268,8 @@ public class EnvironmentVariableManager implements
return envVarSet; return envVarSet;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getVariables()
*/
@Override @Override
public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros) { public IEnvironmentVariable[] getVariables(ICConfigurationDescription cfg, boolean resolveMacros) {
IEnvironmentContextInfo info = getContextInfo(cfg); IEnvironmentContextInfo info = getContextInfo(cfg);
EnvVarCollector varSet = getVariables(info,true); EnvVarCollector varSet = getVariables(info,true);
@ -305,8 +287,8 @@ public class EnvironmentVariableManager implements
return new EnvVarDescriptor[0]; 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 * starting from the one passed to this method and including all subsequent parents
*/ */
public static IEnvironmentContextInfo[] getAllContextInfos(IEnvironmentContextInfo contextInfo) { public static IEnvironmentContextInfo[] getAllContextInfos(IEnvironmentContextInfo contextInfo) {
@ -330,25 +312,16 @@ public class EnvironmentVariableManager implements
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getDefaultDelimiter()
*/
@Override @Override
public String getDefaultDelimiter() { public String getDefaultDelimiter() {
return isWin32() ? DELIMITER_WIN32 : DELIMITER_UNIX; return isWin32() ? DELIMITER_WIN32 : DELIMITER_UNIX;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#isVariableCaseSensitive()
*/
@Override @Override
public boolean isVariableCaseSensitive() { public boolean isVariableCaseSensitive() {
return !isWin32(); return !isWin32();
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider#getSuppliers()
*/
public ICoreEnvironmentVariableSupplier[] getSuppliers(Object level) { public ICoreEnvironmentVariableSupplier[] getSuppliers(Object level) {
IEnvironmentContextInfo info = getContextInfo(level); IEnvironmentContextInfo info = getContextInfo(level);
if (info != null) if (info != null)
@ -356,8 +329,8 @@ public class EnvironmentVariableManager implements
return null; 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) { public boolean checkParentContextRelation(IEnvironmentContextInfo child, IEnvironmentContextInfo parent) {
if (child == null || parent == null) if (child == null || parent == null)
@ -428,5 +401,4 @@ public class EnvironmentVariableManager implements
return fContributedEnvironment; return fContributedEnvironment;
} }
} }

View file

@ -385,9 +385,6 @@ public class UserDefinedEnvironmentSupplier extends
} }
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariable()
*/
@Override @Override
public IEnvironmentVariable getVariable(String name, Object context) { public IEnvironmentVariable getVariable(String name, Object context) {
if (getValidName(name) == null) if (getValidName(name) == null)
@ -399,9 +396,6 @@ public class UserDefinedEnvironmentSupplier extends
return EnvVarOperationProcessor.performOperation(env.getVariable(name), var); return EnvVarOperationProcessor.performOperation(env.getVariable(name), var);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableSupplier#getVariables()
*/
@Override @Override
public IEnvironmentVariable[] getVariables(Object context) { public IEnvironmentVariable[] getVariables(Object context) {
StorableEnvironment env = getEnvironment(context); StorableEnvironment env = getEnvironment(context);