Exemplo n.º 1
0
 public static String getResolutionFailureMessage(VersionConstraint unsatisfied) {
   if (unsatisfied.isResolved()) throw new IllegalArgumentException();
   if (unsatisfied instanceof ImportPackageSpecification) {
     if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(
         ((ImportPackageSpecification) unsatisfied).getDirective(Constants.RESOLUTION_DIRECTIVE)))
       return NLS.bind(
           EclipseAdaptorMsg.ECLIPSE_MISSING_OPTIONAL_IMPORTED_PACKAGE, toString(unsatisfied));
     if (ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(
         ((ImportPackageSpecification) unsatisfied).getDirective(Constants.RESOLUTION_DIRECTIVE)))
       return NLS.bind(
           EclipseAdaptorMsg.ECLIPSE_MISSING_DYNAMIC_IMPORTED_PACKAGE, toString(unsatisfied));
     return NLS.bind(EclipseAdaptorMsg.ECLIPSE_MISSING_IMPORTED_PACKAGE, toString(unsatisfied));
   } else if (unsatisfied instanceof BundleSpecification) {
     if (((BundleSpecification) unsatisfied).isOptional())
       return NLS.bind(
           EclipseAdaptorMsg.ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE, toString(unsatisfied));
     return NLS.bind(EclipseAdaptorMsg.ECLIPSE_MISSING_REQUIRED_BUNDLE, toString(unsatisfied));
   } else if (unsatisfied instanceof HostSpecification) {
     return NLS.bind(EclipseAdaptorMsg.ECLIPSE_MISSING_HOST, toString(unsatisfied));
   } else if (unsatisfied instanceof NativeCodeSpecification) {
     return NLS.bind(EclipseAdaptorMsg.ECLIPSE_MISSING_NATIVECODE, unsatisfied.toString());
   } else if (unsatisfied instanceof GenericSpecification) {
     return NLS.bind(
         EclipseAdaptorMsg.ECLIPSE_MISSING_REQUIRED_CAPABILITY, unsatisfied.toString());
   }
   return NLS.bind(EclipseAdaptorMsg.ECLIPSE_MISSING_REQUIREMENT, unsatisfied.toString());
 }
Exemplo n.º 2
0
 public static String getResolutionFailureMessage(VersionConstraint unsatisfied) {
   if (unsatisfied.isResolved()) throw new IllegalArgumentException();
   if (unsatisfied instanceof ImportPackageSpecification)
     return NLS.bind(
         PDERuntimeMessages.MessageHelper_missing_imported_package, toString(unsatisfied));
   else if (unsatisfied instanceof BundleSpecification) {
     if (((BundleSpecification) unsatisfied).isOptional())
       return NLS.bind(
           PDERuntimeMessages.MessageHelper_missing_optional_required_bundle,
           toString(unsatisfied));
     return NLS.bind(
         PDERuntimeMessages.MessageHelper_missing_required_bundle, toString(unsatisfied));
   } else return NLS.bind(PDERuntimeMessages.MessageHelper_missing_host, toString(unsatisfied));
 }
Exemplo n.º 3
0
 private static String toString(VersionConstraint constraint) {
   org.eclipse.osgi.service.resolver.VersionRange versionRange = constraint.getVersionRange();
   if (versionRange == null) return constraint.getName();
   return constraint.getName() + '_' + versionRange;
 }