Hi Axel.
Here's a sample how to set global
variables:
UserDefinedEnvironmentSupplier fUserSupplier =
EnvironmentVariableManager.fUserSupplier;
StorableEnvironment vars =
fUserSupplier.getWorkspaceEnvironmentCopy();
vars.createVariable("name",
"value",
IEnvironmentVariable.ENVVAR_APPEND, ";");
fUserSupplier.setWorkspaceEnvironment(vars);
Here's a sample how to set configuration-wide env
variable:
IProject prj = ...;
IContributedEnvironment ice =
CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
// get it once before changing
ICProjectDescription prjd =
CoreModel.getDefault().getProjectDescription(prj, false);
ICConfigurationDescription cfgd =
prjd.getActiveConfiguration(); // or
getConfigurations(), etc...
// one modification among many possible
ones...
ice.addVariable("name",
"value",
IEnvironmentVariable.ENVVAR_APPEND, ";",
cfgd);
// do it once after all modifications are
done
try {
CoreModel.getDefault().setProjectDescription(prj,
prjd);
}
catch
(CoreException e) {}
----------------------------------- With best regards, Oleg
Krasilnikov
I wrote a plugin for eclipse.
I want to set some CDT environment variables
as
if I had written it in
Preferences->C/C++->Environment->set Variable.
Can someone give a hint how to do this as
uncomplicated as possible from my own plugin -
maybe as a extension point hint?!
Regards
R4DIUM --------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: 125252, Moscow, Russian Federation,
Chapayevsky Per, 14.
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
|