org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111

int j = 0; j < updates.length; j++)
      {
        toBeUpdated.add(iuToUpdate);
        if ((defaultUpdates != null) && (defaultUpdates.contains(updates[j]))) {
          elementsToPlan.add(updates[j]);
        }
      }
      if (!selectionSpecified)
      {
        HashMap<String, Update> latestVersions = new HashMap();
        boolean foundUpdate = false;
        boolean foundPatch = false;
        Update latestUpdate;
        for (int j = 0; j < updates.length; j++)
        {
          String key;
          String key;
          if (QueryUtil.isPatch(replacement))
          {
            foundPatch = true;
            key = replacement.getId();
          }
          else
          {
            foundUpdate = true;
            key = toUpdate.getId();
          }
          latestUpdate = (Update)latestVersions.get(key);
          IInstallableUnit latestIU = latestUpdate == null ? null : replacement;
          if ((latestIU == null) || (replacement.getVersion().compareTo(latestIU.getVersion()) > 0)) {
            latestVersions.put(key, updates[j]);
          }
        }
        if ((foundPatch) && (foundUpdate))
        {
          Set<String> keys = new HashSet();
          keys.addAll(latestVersions.keySet());
          for (latestUpdate = keys.iterator(); latestUpdate.hasNext();)
          {
            String id = (String)latestUpdate.next();
            if (!id.equals(iuToUpdate.getId())) {
              latestVersions.remove(id);
            }
          }
        }
        elementsToPlan.addAll(latestVersions.values());
      }
      sub.worked(100);
    }
    if ((toBeUpdated.size() <= 0) || (elementsToPlan.isEmpty()))
    {
      sub.done();
      status.add(PlanAnalyzer.getStatus(10000, null));
      return;
    }
    request = ProfileChangeRequest.createByProfileId(session.getProvisioningAgent(), profileId);
    for (localIterator = elementsToPlan.iterator(); localIterator.hasNext();)
    {
      Update update = (Update)localIterator.next();
      IInstallableUnit theUpdate = replacement;
      if (defaultUpdates == null)
      {
        defaultUpdates = new ArrayList();
        defaultUpdates.add(update);
      }
      else if (!defaultUpdates.contains(update))
      {
        defaultUpdates.add(update);
      }
      request.add(theUpdate);
      request.setInstallableUnitProfileProperty(theUpdate, "org.eclipse.equinox.p2.type.root", Boolean.toString(true));
      if (QueryUtil.isPatch(theUpdate)) {
        request.setInstallableUnitInclusionRules(theUpdate, ProfileInclusionRules.createOptionalInclusionRule(theUpdate));
      } else {
        request.remove(toUpdate);
      }
    }
    sub.done();
  }
  
  protected String getProvisioningJobName()
  {
    return Messages.UpdateOperation_UpdateJobName;
  }
  
  protected String getResolveJobName()
  {
    return Messages.UpdateOperation_ResolveJobName;
  }
  
  protected void prepareToResolve()
  {
    super.prepareToResolve();
    if (iusToUpdate == null) {
      iusToUpdate = getInstalledIUs();
    }
  }
  
  private Collection<IInstallableUnit> getInstalledIUs()
  {
    IProfile profile = session.getProfileRegistry().getProfile(profileId);
    if (profile == null) {
      return CollectionUtils.emptyList();
    }
    IQuery<IInstallableUnit> query = new UserVisibleRootQuery();
    IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
    return queryResult.toUnmodifiableSet();
  }
  
  void makeResolveJob(IProgressMonitor monitor)
  {
    request = null;
    noChangeRequest = PlanAnalyzer.getProfileChangeAlteredStatus();
    
    final ProfileChangeRequest[] requestHolder = new ProfileChangeRequest[1];
    job = new SearchForUpdatesResolutionJob(getResolveJobName(), session, profileId, request, getFirstPassProvisioningContext(), getSecondPassEvaluator(), noChangeRequest, new IRunnableWithProgress()
    {
      public void run(IProgressMonitor mon)
        throws OperationCanceledException
      {
        if ((job.getState() == 0) && (session.hasScheduledOperationsFor(profileId)))
        {
          noChangeRequest.add(PlanAnalyzer.getStatus(10052, null));
        }
        else
        {
          computeProfileChangeRequest(noChangeRequest, mon);
          requestHolder[0] = request;
        }
      }
    }, requestHolder, this);
  }
  
  public boolean hasResolved()
  {
    return (request != null) && (super.hasResolved());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.operations.UpdateOperation
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd