diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java index f4c5b89c9..918de138c 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java @@ -24,11 +24,11 @@ public class DownloadJob extends Job { private final LinkedList requestsPending; private final SimpleArtifactRepository repository; - private final IProgressMonitor masterMonitor; + private final SubMonitor masterMonitor; private final MultiStatus overallStatus; DownloadJob(String name, SimpleArtifactRepository repository, LinkedList requestsPending, - IProgressMonitor masterMonitor, MultiStatus overallStatus) { + SubMonitor masterMonitor, MultiStatus overallStatus) { super(name); setSystem(true); this.repository = repository; @@ -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); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java index edb44e52b..2daf80dd7 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java @@ -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(); } @@ -929,7 +930,7 @@ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monito //ignore } } finally { - monitor.done(); + subMonitor.done(); } }