/*
* this for loop sets up all the projects needed for the session and
* computes the missing files.
*/
for (Entry<String, String> entry : projectNames.entrySet()) {
SubMonitor lMonitor = subMonitor.newChild(100 / numberOfLoops);
String projectID = entry.getKey();
String projectName = entry.getValue();
checkCancellation();
ProjectExchangeInfo projectInfo = null;
for (ProjectExchangeInfo pInfo : this.projectInfos) {
if (pInfo.getProjectID().equals(projectID))
projectInfo = pInfo;
}
if (projectInfo == null) {
log.error("tried to add a project that wasn't shared");
// this should never happen
continue;
}
VCSAdapter vcs = null;
if (preferenceUtils.useVersionControl() && useVersionControl) {
vcs = VCSAdapter.getAdapter(projectInfo.getFileList()
.getVcsProviderID());
}
IProject iProject = eclipseHelper.getWorkspace().getRoot()
.getProject(projectName);
if (iProject.exists()) {
/*
* Saving unsaved files is supposed to be done in
* JoinSessionWizard#performFinish().
*/
if (EditorAPI.existUnsavedFiles(iProject)) {
log.error("Unsaved files detected.");
}
} else {
iProject = null;
}
IProject localProject = assignLocalProject(iProject, projectName,
projectID, vcs, lMonitor.newChild(30), projectInfo);
localProjects.put(projectID, localProject);
checkCancellation();
if (vcs != null && !isPartialRemoteProject(projectID)) {
log.debug("initVcState");
initVcState(localProject, vcs, lMonitor.newChild(40),
projectInfo.getFileList());
}
checkCancellation();
log.debug("compute required Files for project " + projectName
+ " with ID: " + projectID);
FileList requiredFiles = computeRequiredFiles(localProject,
projectInfo.getFileList(), projectID, skipSyncs.get(projectID)
.booleanValue(), vcs, lMonitor.newChild(30));
requiredFiles.setProjectID(projectID);
checkCancellation();
missingFiles.add(requiredFiles);
lMonitor.done();
}
return missingFiles;
}