It works, thanks James :)
> Date: Fri, 21 May 2010 14:02:15 +0100 > Subject: Re: [cdt-dev] modify build variables > From: jamesblackburn@xxxxxxxxx > To: cdt-dev@xxxxxxxxxxx > > Take a look at IEnvironmentVariableManagerTests in > org.eclipse.cdt.core.tests plugin. > > The environment is per configuration. So you could do something like this: > > prjDesc = CoreModel.getDefault().getProjectDescription(project); > ICConfigurationDescription[] descs = prjDesc.getConfigurations(); > > IEnvironmentVariableManager envManager = > CCorePlugin.getDefault().getBuildEnvironmentManager(); > IContributedEnvironment contribEnv = envManager.getContributedEnvironment(); > > // Try setting an environment variable > final IEnvironmentVariable var = new EnvironmentVariable("FOO", "BAR"); > contribEnv.addVariable(var, prjDesc.getConfigurationById(id1)); > > // Get an environment variable: > IEnvironmentVariable var2 = envManager.getVariable(var.getName(), > prjDesc.getConfigurationById(id1), true); > > // Save the changes to the environment > CoreModel.getDefault().setProjectDescription(project, prjDesc); > > > Cheers, > James > > On 21 May 2010 13:42, Flo Menier <josieenfrance@xxxxxxxxxxx> wrote: > > > > I added a build variable (with variable name "Path", > > variable value "C:\IFX_Tools") for one c project, how can I modify it in > > Java code > > IWorkspace workspace = ResourcesPlugin.getWorkspace(); > > pathVariableManager = > > workspace.getRoot().getWorkspace().getPathVariableManager(); > > ICdtVariable path = > > CdtVariableManager.fBuildSystemVariableSupplier.getVariable("Path", null); > > > > System.out.println("Is > > fBuildSystemVariableSupplier?"+path.getStringValue()); > > I've tried all types: fBuildSystemVariableSupplier > > ,fEnvironmentMacroSupplier,fCdtMacroSupplier, fEclipseVariablesMacroSupplier > > but I always got "null". > > Is the problem of null parameter in > > "CdtVariableManager.fBuildSystemVariableSupplier.getVariable("Path", null); > > "? > > > > thanks in advance > > > > > > > > ________________________________ > > Votre messagerie et bien plus où que vous soyez. Passez à Windows Live > > Hotmail, c'est gratuit ! Inscrivez-vous > > _______________________________________________ > > cdt-dev mailing list > > cdt-dev@xxxxxxxxxxx > > https://dev.eclipse.org/mailman/listinfo/cdt-dev > > > > > _______________________________________________ > cdt-dev mailing list > cdt-dev@xxxxxxxxxxx > https://dev.eclipse.org/mailman/listinfo/cdt-dev
Hotmail : un service de messagerie gratuit, fiable et complet Profitez-en
|