Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Commit

Permalink
STS-2649: Cancellable descriptor download
Browse files Browse the repository at this point in the history
  • Loading branch information
katesherwood committed Jul 4, 2012
1 parent cde5882 commit 9dbc32d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -134,6 +134,7 @@ public IStatus run(IProgressMonitor monitor) {
}
finally {
resultLatch.countDown();
progress.done();
}
return result;
}
Expand Down

0 comments on commit 9dbc32d

Please sign in to comment.