我目前正在开发一个必须删除Eclipse Environment变量的插件,现在我有了这个:
public static void removeEnvironmentVariable(IProject proj, String variable) {
// environment path
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(proj);
IEnvironmentVariableManager envManager =
CCorePlugin.getDefault().getBuildEnvironmentManager();
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
// We must iterate through all configurations
for(ICConfigurationDescription config : prjDesc.getConfigurations()) {
contribEnv.removeVariable(variable, config);
}
// Save the changes to the environment
try {
CoreModel.getDefault().setProjectDescription(proj, prjDesc);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
我做错了什么?