Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/envvar/EnvironmentVariableManagerToolChain.java20
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java16
2 files changed, 20 insertions, 16 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/envvar/EnvironmentVariableManagerToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/envvar/EnvironmentVariableManagerToolChain.java
index 451b6918fbb..e5d52a004fb 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/envvar/EnvironmentVariableManagerToolChain.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/envvar/EnvironmentVariableManagerToolChain.java
@@ -12,11 +12,13 @@ package org.eclipse.cdt.managedbuilder.internal.envvar;
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
import org.eclipse.cdt.internal.core.envvar.ICoreEnvironmentVariableSupplier;
import org.eclipse.cdt.internal.core.envvar.IEnvironmentContextInfo;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
@@ -27,14 +29,17 @@ import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
/**
* Helper class to resolve environment variables directly from toolchain. The intention is
* to use that in New Project Wizard and other scenarios when no configuration is available yet.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class EnvironmentVariableManagerToolChain extends EnvironmentVariableManager {
private final IToolChain toolChain;
+ private final ICConfigurationDescription cfgDescription;
public EnvironmentVariableManagerToolChain(IToolChain toolchain) {
this.toolChain = toolchain;
+ IConfiguration cfg = toolChain.getParent();
+ cfgDescription = cfg != null ? ManagedBuildManager.getDescriptionForConfiguration(cfg) : null;
}
/**
@@ -154,6 +159,11 @@ public class EnvironmentVariableManagerToolChain extends EnvironmentVariableMana
*/
@Override
public IEnvironmentContextInfo getContextInfo(Object level) {
+ if (cfgDescription != null) {
+ // Use regular EnvironmentVariableManager when configuration is available
+ return super.getContextInfo(level);
+ }
+
return new ToolChainEnvironmentContextInfo(toolChain);
}
@@ -162,7 +172,15 @@ public class EnvironmentVariableManagerToolChain extends EnvironmentVariableMana
*/
@Override
public ICoreVariableContextInfo getMacroContextInfoForContext(Object context) {
+ if (cfgDescription != null) {
+ // Use regular EnvironmentVariableManager when configuration is available
+ return super.getMacroContextInfoForContext(context);
+ }
+
return new ToolChainCoreVariableContextInfo(toolChain);
}
+ public IEnvironmentVariable getVariable(String variableName, boolean resolveMacros) {
+ return getVariable(variableName, cfgDescription, resolveMacros);
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java
index 21998a342dc..5ef738e1572 100644
--- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/IsGnuCygwinToolChainSupported.java
@@ -12,14 +12,9 @@
package org.eclipse.cdt.managedbuilder.gnu.cygwin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.internal.core.Cygwin;
-import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableManagerToolChain;
import org.osgi.framework.Version;
@@ -33,16 +28,7 @@ public class IsGnuCygwinToolChainSupported implements IManagedIsToolChainSupport
@Override
public boolean isSupported(IToolChain toolChain, Version version, String instance) {
- IConfiguration cfg = toolChain.getParent();
- ICConfigurationDescription cfgDescription = cfg != null ? ManagedBuildManager.getDescriptionForConfiguration(cfg) : null;
-
- IEnvironmentVariableManager envMngr;
- if (cfgDescription != null) {
- envMngr = EnvironmentVariableManager.getDefault();
- } else {
- envMngr = new EnvironmentVariableManagerToolChain(toolChain);
- }
- IEnvironmentVariable var = envMngr.getVariable(ENV_PATH, cfgDescription, true);
+ IEnvironmentVariable var = new EnvironmentVariableManagerToolChain(toolChain).getVariable(ENV_PATH, true);
String envPath = var != null ? var.getValue() : null;
return Cygwin.isAvailable(envPath);
}

Back to the top