Source:
public static void addAutotoolsBuilder(IProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); if(prepareBuildCommands(description) == null){ return; } final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); final IProject proj = project; Job backgroundJob = new Job("Autotools Set Project Description") { protected IStatus run(IProgressMonitor monitor) { try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { protected boolean savedAutoBuildingValue; public void run(IProgressMonitor monitor) throws CoreException { IWorkspace workspace = ResourcesPlugin.getWorkspace(); turnOffAutoBuild(workspace); IProjectDescription prDescription = proj.getDescription(); ICommand[] commands = prepareBuildCommands(prDescription); if(commands == null){ return; } prDescription.setBuildSpec(commands); proj.setDescription(prDescription, new NullProgressMonitor()); restoreAutoBuild(workspace); } protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException { IWorkspaceDescription workspaceDesc = workspace.getDescription(); savedAutoBuildingValue = workspaceDesc.isAutoBuilding(); workspaceDesc.setAutoBuilding(false); workspace.setDescription(workspaceDesc); } protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException { IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(savedAutoBuildingValue); workspace.setDescription(workspaceDesc); } }, rule, IWorkspace.AVOID_UPDATE, monitor); } catch (CoreException e) { return e.getStatus(); } IStatus returnStatus = Status.OK_STATUS; return returnStatus; } }; backgroundJob.setRule(rule); backgroundJob.schedule(); }

Target:
public static void addAutotoolsBuilder(IProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] commands = description.getBuildSpec(); if(checkEquals(commands,getBuildCommandsList(description, commands))){ return; } final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); final IProject proj = project; Job backgroundJob = new Job("Autotools Set Project Description") { protected IStatus run(IProgressMonitor monitor) { try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { protected boolean savedAutoBuildingValue; public void run(IProgressMonitor monitor) throws CoreException { IWorkspace workspace = ResourcesPlugin.getWorkspace(); turnOffAutoBuild(workspace); IProjectDescription prDescription = proj.getDescription(); ICommand[] currentCommands = prDescription.getBuildSpec(); ICommand[] newCommands = getBuildCommandsList(prDescription, currentCommands); if(!checkEquals(currentCommands,newCommands)){ prDescription.setBuildSpec(newCommands); proj.setDescription(prDescription, new NullProgressMonitor()); } restoreAutoBuild(workspace); } protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException { IWorkspaceDescription workspaceDesc = workspace.getDescription(); savedAutoBuildingValue = workspaceDesc.isAutoBuilding(); workspaceDesc.setAutoBuilding(false); workspace.setDescription(workspaceDesc); } protected final void restoreAutoBuild(IWorkspace workspace) throws CoreException { IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(savedAutoBuildingValue); workspace.setDescription(workspaceDesc); } }, rule, IWorkspace.AVOID_UPDATE, monitor); } catch (CoreException e) { return e.getStatus(); } IStatus returnStatus = Status.OK_STATUS; return returnStatus; } }; backgroundJob.setRule(rule); backgroundJob.schedule(); }