Skip to content

Commit

Permalink
Ensure DownloadJob.run(IProgressMonitor) provides monitor task details
Browse files Browse the repository at this point in the history
IProgressMonitor.slice() only propagates the work to its parent monitor,
but not any details.

Follow-up to #576
  • Loading branch information
ptziegler committed Dec 19, 2024
1 parent 1cfa5de commit 57a3cf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class DownloadJob extends Job {

private final LinkedList<IArtifactRequest> requestsPending;
private final SimpleArtifactRepository repository;
private final IProgressMonitor masterMonitor;
private final SubMonitor masterMonitor;
private final MultiStatus overallStatus;

DownloadJob(String name, SimpleArtifactRepository repository, LinkedList<IArtifactRequest> requestsPending,
IProgressMonitor masterMonitor, MultiStatus overallStatus) {
SubMonitor masterMonitor, MultiStatus overallStatus) {
super(name);
setSystem(true);
this.repository = repository;
Expand Down Expand Up @@ -56,8 +56,7 @@ protected IStatus run(IProgressMonitor jobMonitor) {
if (masterMonitor.isCanceled())
return Status.CANCEL_STATUS;
// process the actual request
SubMonitor subMonitor = SubMonitor.convert(masterMonitor.slice(1), 1);
IStatus status = repository.getArtifact(request, subMonitor);
IStatus status = repository.getArtifact(request, masterMonitor.newChild(1));
if (!status.isOK()) {
synchronized (overallStatus) {
overallStatus.add(status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,11 +914,12 @@ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monito
}
} else {
// initialize the various jobs needed to process the get artifact requests
monitor.beginTask(NLS.bind(Messages.sar_downloading, Integer.toString(requests.length)), requests.length);
SubMonitor subMonitor = SubMonitor.convert(monitor,
NLS.bind(Messages.sar_downloading, Integer.toString(requests.length)), requests.length);
try {
DownloadJob jobs[] = new DownloadJob[numberOfJobs];
for (int i = 0; i < numberOfJobs; i++) {
jobs[i] = new DownloadJob(Messages.sar_downloadJobName + i, this, requestsPending, monitor,
jobs[i] = new DownloadJob(Messages.sar_downloadJobName + i, this, requestsPending, subMonitor,
overallStatus);
jobs[i].schedule();
}
Expand Down

0 comments on commit 57a3cf3

Please sign in to comment.