public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
   SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
   try {
     MultiStatus overallStatus =
         new MultiStatus(TestActivator.PI_PROV_TESTS, IStatus.OK, null, null);
     for (int i = 0; i < requests.length; i++) {
       overallStatus.add(getArtifact((ArtifactRequest) requests[i], subMonitor.newChild(1)));
     }
     return (monitor.isCanceled() ? Status.CANCEL_STATUS : overallStatus);
   } finally {
     subMonitor.done();
   }
 }
 private IStatus computeAllRemediations(IProgressMonitor monitor) {
   SubMonitor sub = SubMonitor.convert(monitor, remedyConfigs.length);
   sub.setTaskName(Messages.RemediationOperation_ProfileChangeRequestProgress);
   List<Remedy> tmpRemedies = new ArrayList<Remedy>(remedyConfigs.length);
   try {
     for (int i = 0; i < remedyConfigs.length; i++) {
       sub.subTask((i + 1) + " / " + remedyConfigs.length); // $NON-NLS-1$
       if (sub.isCanceled()) return Status.CANCEL_STATUS;
       Remedy remedy =
           computeRemedy(remedyConfigs[i], sub.newChild(1, SubMonitor.SUPPRESS_ALL_LABELS));
       if (remedy != null) {
         tmpRemedies.add(remedy);
       }
     }
   } finally {
     sub.done();
   }
   remedies = tmpRemedies;
   return getResolutionResult();
 }
Example #3
0
  void perform(
      MultiStatus status, EngineSession session, Operand[] operands, IProgressMonitor monitor) {
    SubMonitor subMonitor =
        SubMonitor.convert(monitor, prePerformWork + mainPerformWork + postPerformWork);
    session.recordPhaseEnter(this);
    prePerform(status, session, subMonitor.newChild(prePerformWork));
    if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return;
    session.recordPhaseStart(this);

    subMonitor.setWorkRemaining(mainPerformWork + postPerformWork);
    mainPerform(status, session, operands, subMonitor.newChild(mainPerformWork));
    if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return;

    session.recordPhaseEnd(this);
    subMonitor.setWorkRemaining(postPerformWork);
    postPerform(status, session, subMonitor.newChild(postPerformWork));
    phaseParameters.clear();
    if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return;
    session.recordPhaseExit(this);
    subMonitor.done();
  }