if (!cc.contains(id)) {
toDownload.add(id);
}
}
final ChangesetHeaderDownloadTask task;
final Future<?> future;
if (toDownload.isEmpty()) {
task = null;
future = null;
} else {
task = new ChangesetHeaderDownloadTask(toDownload);
future = Main.worker.submit(task);
}
Runnable r = new Runnable() {
@Override
public void run() {
// first, wait for the download task to finish, if a download
// task was launched
if (future != null) {
try {
future.get();
} catch(InterruptedException e) {
Main.warn("InterruptedException in "+getClass().getSimpleName()+" while downloading changeset header");
} catch(ExecutionException e) {
Main.error(e);
BugReportExceptionHandler.handleException(e.getCause());
return;
}
}
if (task != null) {
if (task.isCanceled())
// don't launch the changeset manager if the download task
// was canceled
return;
if (task.isFailed()) {
toDownload.clear();
}
}
// launch the task
launchChangesetManager(toDownload);