From b1fc6f69bef0788f34d8c0f6eb4f173b8e62bfb9 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sun, 16 Sep 2012 07:22:50 -0400 Subject: [PATCH] bug 357442: User-friendlier message about missing toolchain --- ...figurationEnvironmentVariableSupplier.java | 68 +++++++++---------- .../dataprovider/BuildConfigurationData.java | 20 +++--- .../DataProviderMessages.properties | 2 +- 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IConfigurationEnvironmentVariableSupplier.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IConfigurationEnvironmentVariableSupplier.java index a52d4a873d5..2ad85459956 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IConfigurationEnvironmentVariableSupplier.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IConfigurationEnvironmentVariableSupplier.java @@ -13,49 +13,45 @@ package org.eclipse.cdt.managedbuilder.envvar; import org.eclipse.cdt.managedbuilder.core.IConfiguration; /** - * - * this interface is to be implemented by the tool-integrator - * for supplying the configuration-specific environment - * + * This interface is to be implemented by the tool-integrator for supplying the configuration-specific + * environment. + * * @since 3.0 */ -public interface IConfigurationEnvironmentVariableSupplier{ +public interface IConfigurationEnvironmentVariableSupplier { /** - * - * @param variableName the variable name - * @param configuration configuration + * @param variableName - the variable name. + * @param configuration - configuration. * @param provider the instance of the environment variable provider to be used for querying the - * environment variables from within the supplier. The supplier should use this provider to obtain - * the already defined environment instead of using the "default" provider returned by the - * ManagedBuildManager.getEnvironmentVariableProvider(). - * The provider passed to a supplier will ignore searching the variables for the levels - * higher than the current supplier level, will query only the lower-precedence suppliers - * for the current level and will query all suppliers for the lower levels. - * This is done to avoid infinite loops that could be caused if the supplier calls the provider - * and the provider in turn calls that supplier again. Also the supplier should not know anything - * about the environment variables defined for the higher levels. - * @return the reference to the IBuildEnvironmentVariable interface representing - * the variable of a given name + * environment variables from within the supplier. The supplier should use this provider to obtain + * the already defined environment instead of using the "default" provider returned by the + * ManagedBuildManager.getEnvironmentVariableProvider(). + * The provider passed to a supplier will ignore searching the variables for the levels + * higher than the current supplier level, will query only the lower-precedence suppliers + * for the current level and will query all suppliers for the lower levels. + * This is done to avoid infinite loops that could be caused if the supplier calls the provider + * and the provider in turn calls that supplier again. Also the supplier should not know anything + * about the environment variables defined for the higher levels. + * @return The reference to the IBuildEnvironmentVariable interface representing + * the variable of a given name or {@code null} if the variable is not defined. */ - IBuildEnvironmentVariable getVariable(String variableName, - IConfiguration configuration, - IEnvironmentVariableProvider provider); + IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider); /** - * @param configuration configuration - * @param provider the instance of the environment variable provider to be used for querying the - * environment variables from within the supplier. The supplier should use this provider to obtain - * the already defined environment instead of using the "default" provider returned by the - * ManagedBuildManager.getEnvironmentVariableProvider(). - * The provider passed to a supplier will ignore searching the variables for the levels - * higher than the current supplier level, will query only the lower-precedence suppliers - * for the current level and will query all suppliers for the lower levels. - * This is done to avoid infinite loops that could be caused if the supplier calls the provider - * and the provider in turn calls that supplier again. Also the supplier should not know anything - * about the environment variables defined for the higher levels. - * @return the array of IBuildEnvironmentVariable that represents the environment variables + * @param configuration - configuration. + * @param provider - the instance of the environment variable provider to be used for querying the + * environment variables from within the supplier. The supplier should use this provider to obtain + * the already defined environment instead of using the "default" provider returned by the + * ManagedBuildManager.getEnvironmentVariableProvider(). + * The provider passed to a supplier will ignore searching the variables for the levels + * higher than the current supplier level, will query only the lower-precedence suppliers + * for the current level and will query all suppliers for the lower levels. + * This is done to avoid infinite loops that could be caused if the supplier calls the provider + * and the provider in turn calls that supplier again. Also the supplier should not know anything + * about the environment variables defined for the higher levels. + * @return The array of IBuildEnvironmentVariable that represents the environment variables. + * If the array contains any {@code null} it will be ignored. */ - IBuildEnvironmentVariable[] getVariables (IConfiguration configuration, - IEnvironmentVariableProvider provider); + IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/BuildConfigurationData.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/BuildConfigurationData.java index 4886881035a..1a88d7fd75f 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/BuildConfigurationData.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/BuildConfigurationData.java @@ -26,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.core.IFileInfo; import org.eclipse.cdt.managedbuilder.core.IFolderInfo; import org.eclipse.cdt.managedbuilder.core.IResourceInfo; import org.eclipse.cdt.managedbuilder.core.ITool; +import org.eclipse.cdt.managedbuilder.core.IToolChain; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; @@ -39,7 +40,7 @@ public class BuildConfigurationData extends CConfigurationData { public BuildConfigurationData(IConfiguration cfg){ fCfg = (Configuration)cfg; } - + public IConfiguration getConfiguration(){ return fCfg; } @@ -51,7 +52,7 @@ public class BuildConfigurationData extends CConfigurationData { IFileInfo info = fCfg.createFileInfo(path, ((BuildFileData)base).getFileInfo(), id, path.lastSegment()); return info.getFileData(); } - + @Override public CFileData createFileData(IPath path, CFolderData base, CLanguageData baseLangData) throws CoreException { @@ -67,7 +68,7 @@ public class BuildConfigurationData extends CConfigurationData { } - + @Override public CFolderData createFolderData(IPath path, CFolderData base) throws CoreException { @@ -153,7 +154,7 @@ public class BuildConfigurationData extends CConfigurationData { // return fCdtVars; return new BuildVariablesContributor(this); } - + void clearCachedData(){ fCfg.clearCachedData(); CResourceData[] datas = getResourceDatas(); @@ -161,7 +162,7 @@ public class BuildConfigurationData extends CConfigurationData { // BuildLanguageData lData; // BuildLanguageData[] lDatas; - + for(int i = 0; i < datas.length; i++){ data = datas[i]; if(data.getType() == ICSettingBase.SETTING_FOLDER){ @@ -178,16 +179,17 @@ public class BuildConfigurationData extends CConfigurationData { String msg = null; if(!fCfg.isSupported()){ flags |= CConfigurationStatus.TOOLCHAIN_NOT_SUPPORTED; - msg = DataProviderMessages.getString("BuildConfigurationData.NoConfigurationSupport"); //$NON-NLS-1$ - + IToolChain toolChain = fCfg.getToolChain(); + String tname = toolChain != null ? toolChain.getName() : ""; //$NON-NLS-1$ + msg = NLS.bind(DataProviderMessages.getString("BuildConfigurationData.NoToolchainSupport"), tname); //$NON-NLS-1$ } else if (ManagedBuildManager.getExtensionConfiguration(fCfg)==null){ flags |= CConfigurationStatus.SETTINGS_INVALID; msg = NLS.bind(DataProviderMessages.getString("BuildConfigurationData.OrphanedConfiguration"), fCfg.getId()); //$NON-NLS-1$ } - + if(flags != 0) return new CConfigurationStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), flags, msg, null); - + return CConfigurationStatus.CFG_STATUS_OK; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/DataProviderMessages.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/DataProviderMessages.properties index 0d61f21330a..1127a644861 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/DataProviderMessages.properties +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/dataprovider/DataProviderMessages.properties @@ -21,5 +21,5 @@ ProjectConverter.6=the project conversion failed ProjectConverter.7=targets conversion ProjectConverter.8=the project conversion failed due to unknown reason ProjectConverter.9=the given project is not a valid CDT project -BuildConfigurationData.NoConfigurationSupport=The configuration support is not installed on the system +BuildConfigurationData.NoToolchainSupport=Toolchain "{0}" is not detected. Refer to "C/C++ Development User Guide", "Before you begin" about installing toolchains. BuildConfigurationData.OrphanedConfiguration=Orphaned configuration. No base extension cfg exists for {0}