Map<String, Boolean> skipSyncs, boolean useVersionControl)
throws SarosCancellationException {
this.monitor = subMonitor;
IWorkspace ws = eclipseHelper.getWorkspace();
IWorkspaceDescription desc = ws.getDescription();
boolean wasAutobuilding = desc.isAutoBuilding();
subMonitor.beginTask("Initializing shared project", 100);
try {
if (wasAutobuilding) {
desc.setAutoBuilding(false);
ws.setDescription(desc);
}
List<FileList> missingFiles = calculateMissingFiles(projectNames,
skipSyncs, useVersionControl, subMonitor.newChild(10));
transmitter.sendFileLists(peer, processID, missingFiles,
subMonitor.newChild(10));
checkCancellation();
if (this.doStream) {
// Host/Inviter decided to transmit files via stream
acceptStream(subMonitor.newChild(80));
} else {
// Host/Inviter decided to transmit files with one big archive
acceptArchive(localProjects.size(), subMonitor.newChild(80));
}
// We are finished with the exchanging process. Add all projects
// resources to the session.
for (String projectID : localProjects.keySet()) {
IProject iProject = localProjects.get(projectID);
if (isPartialRemoteProject(projectID)) {
List<IPath> paths = getRemoteFileList(projectID).getPaths();
List<IResource> dependentResources = new ArrayList<IResource>();
for (IPath iPath : paths) {
dependentResources.add(iProject.findMember(iPath));
}
sessionManager.getSarosSession().addSharedResources(
iProject, projectID, dependentResources);
} else {
sessionManager.getSarosSession().addSharedResources(
iProject, projectID, null);
}
sessionManager.notifyProjectAdded(iProject);
}
} catch (Exception e) {
processException(e);
} finally {
// Re-enable auto-building...
if (wasAutobuilding) {
desc.setAutoBuilding(true);
try {
ws.setDescription(desc);
} catch (CoreException e) {
localCancel(
"An error occurred while synchronising the project",