monitor = Policy.monitorFor(monitor);
try {
ArrayList infos = null;
String projectName = null;
for (int i = 0; i < buildersToBeLinked.size(); i++) {
BuilderPersistentInfo info = (BuilderPersistentInfo) buildersToBeLinked.get(i);
if (!info.getProjectName().equals(projectName)) {
if (infos != null) { // if it is not the first iteration
IProject project = workspace.getRoot().getProject(projectName);
workspace.getBuildManager().setBuildersPersistentInfo(project, infos);
}
projectName = info.getProjectName();
infos = new ArrayList(5);
}
info.setLastBuildTree(trees[index++]);
infos.add(info);
}
if (infos != null) {
IProject project = workspace.getRoot().getProject(projectName);
workspace.getBuildManager().setBuildersPersistentInfo(project, infos);