Esempio n. 1
0
 private Version parseVersion(Unit unitReference) {
   try {
     return Version.parseVersion(unitReference.getVersion());
   } catch (IllegalArgumentException e) {
     throw new TargetDefinitionSyntaxException(
         NLS.bind(
             "Cannot parse version \"{0}\" of unit \"{1}\"",
             unitReference.getVersion(), unitReference.getId()),
         e);
   }
 }
Esempio n. 2
0
  private IInstallableUnit getUnitInstance(IQueryable<IInstallableUnit> units, Unit unitReference) {
    IQueryResult<IInstallableUnit> queryResult = searchUnitInThisLocation(units, unitReference);

    if (queryResult.isEmpty()) {
      throw new TargetDefinitionResolutionException(
          NLS.bind(
              "Could not find \"{0}/{1}\" in the repositories of the current location",
              unitReference.getId(), unitReference.getVersion()));
    }
    // if the repository contains the same iu/version twice, both are identical and
    // it is OK to use either
    IInstallableUnit unitInstance = queryResult.iterator().next();
    return unitInstance;
  }