public static void replaceBuilderProperties(IProject prj, String compiler, String vm, String includes/*, String cml*/, String fs) throws Exception{
IProjectDescription desc = prj.getDescription();
ICommand[] commands = desc.getBuildSpec();
boolean found = false;
ICommand builder = null;
ArrayList<ICommand> list = new ArrayList<ICommand>();
for (int i = 0; i < commands.length; ++i){
if ((found = commands[i].getBuilderName().equals(XVRBuilder.BUILDER_ID)))
builder = commands[i];
else
list.add(commands[i]);
}
if(!found)
throw new Exception("XVR builder not found.");
Map<String, String> arg = builder.getArguments();
if(compiler != null)
arg.put(XVRProjectSupport.ARG_COMPILER_KEY, compiler);
if(vm != null)
arg.put(XVRProjectSupport.ARG_GLUT, vm);
if(includes != null)
arg.put(XVRProjectSupport.ARG_INCLUDE_DIRS_PARAM_KEY, includes);
if(fs != null)
arg.put(XVRProjectSupport.ARG_FS, fs);
builder.setArguments(arg);
list.add(builder);
desc.setBuildSpec(list.toArray(new ICommand[list.size()]));
prj.setDescription(desc,IProject.FORCE, null);
//prj.setDescription(desc,(IProject.KEEP_HISTORY | IProject.AVOID_NATURE_CONFIG), null);