/* (non-Javadoc)
  * @see com.siteview.mde.internal.core.target.impl.AbstractBundleContainer#resolveBundles(com.siteview.mde.internal.core.target.provisional.ITargetDefinition, org.eclipse.core.runtime.IProgressMonitor)
  */
 protected IResolvedBundle[] resolveBundles(ITargetDefinition definition, IProgressMonitor monitor)
     throws CoreException {
   File dir = getDirectory();
   if (dir.isDirectory()) {
     File site = getSite(dir);
     File[] files = site.listFiles();
     SubMonitor localMonitor =
         SubMonitor.convert(monitor, Messages.DirectoryBundleContainer_0, files.length);
     List bundles = new ArrayList(files.length);
     for (int i = 0; i < files.length; i++) {
       if (localMonitor.isCanceled()) {
         return new IResolvedBundle[0];
       }
       try {
         IResolvedBundle rb = generateBundle(files[i]);
         if (rb != null) {
           bundles.add(rb);
         }
       } catch (CoreException e) {
         // ignore invalid bundles
       }
       localMonitor.worked(1);
     }
     localMonitor.done();
     return (IResolvedBundle[]) bundles.toArray(new IResolvedBundle[bundles.size()]);
   }
   throw new CoreException(
       new Status(
           IStatus.ERROR,
           MDECore.PLUGIN_ID,
           NLS.bind(Messages.DirectoryBundleContainer_1, dir.toString())));
 }
 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();
   }
 }
 @Override
 protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
   SubMonitor sub = SubMonitor.convert(monitor, 1);
   if (currentRemedy != null) {
     request = currentRemedy.getRequest();
     sub.worked(1);
     return;
   }
   try {
     status.add(computeAllRemediations(sub.newChild(1)));
   } catch (OperationCanceledException e) {
     status.add(Status.CANCEL_STATUS);
   }
   determineBestSolutions();
 }
 /*
  * (non-Javadoc)
  * @see org.eclipse.equinox.p2.operations.RepositoryTracker#refreshRepositories(java.net.URI[], org.eclipse.equinox.p2.operations.ProvisioningSession, org.eclipse.core.runtime.IProgressMonitor)
  */
 public void refreshRepositories(
     URI[] locations, ProvisioningSession session, IProgressMonitor monitor) {
   ui.signalRepositoryOperationStart();
   SubMonitor mon = SubMonitor.convert(monitor, locations.length * 100);
   for (int i = 0; i < locations.length; i++) {
     try {
       getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
       getMetadataRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
     } catch (ProvisionException e) {
       // ignore problematic repositories when refreshing
     }
   }
   // We have no idea how many repos may have been added/removed as a result of
   // refreshing these, this one, so we do not use a specific repository event to represent it.
   ui.signalRepositoryOperationComplete(null, true);
 }
 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();
 }
Exemple #6
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();
  }