Skip to content
Browse files

STS-2649: Cancellable descriptor download

  • Loading branch information...
1 parent cde5882 commit 9dbc32d7fdb4ed313a4fe822f74701f18b49eaa9 @katesherwood katesherwood committed
View
7 ...ns.content.core/src/org/springsource/ide/eclipse/commons/content/core/ContentManager.java
@@ -111,21 +111,21 @@ public CountDownLatch getLatch() {
public IStatus run(IProgressMonitor monitor) {
MultiStatus result = new MultiStatus(ContentPlugin.PLUGIN_ID, 0, NLS.bind(
"Download of ''{0}'' (''{1}'') failed", rootItem.getName(), rootItem.getId()), null);
+ SubMonitor progress = SubMonitor.convert(monitor, 20);
try {
List<ContentItem> dependencies = getDependencies(rootItem);
- SubMonitor progress = SubMonitor.convert(monitor, dependencies.size() * 3 + 1);
for (ContentItem item : dependencies) {
String url = item.getRemoteDescriptor().getUrl();
File baseDirectory = getInstallDirectory();
File archiveFile = new File(baseDirectory, item.getPathFromRemoteDescriptor() + ARCHIVE_EXTENSION);
File directory = new File(baseDirectory, item.getPathFromRemoteDescriptor());
- IStatus status = HttpUtil.download(url, archiveFile, directory, progress.newChild(3));
+ IStatus status = HttpUtil.download(url, archiveFile, directory, progress);
result.add(status);
}
// walk the file system to see if the download is there
- refresh(progress.newChild(1), false);
+ refresh(progress, false);
}
catch (CoreException e) {
return new Status(IStatus.ERROR, ContentPlugin.PLUGIN_ID, 0, NLS.bind(
@@ -134,6 +134,7 @@ public IStatus run(IProgressMonitor monitor) {
}
finally {
resultLatch.countDown();
+ progress.done();
}
return result;
}

0 comments on commit 9dbc32d

Please sign in to comment.
Something went wrong with that request. Please try again.