1 11 package org.eclipse.osgi.internal.resolver; 12 13 import org.eclipse.osgi.service.resolver.*; 14 import org.eclipse.osgi.util.NLS; 15 16 public class ResolverErrorImpl implements ResolverError { 17 private BundleDescriptionImpl bundle; 18 private int type; 19 private String data; 20 private VersionConstraint unsatisfied; 21 public ResolverErrorImpl(BundleDescriptionImpl bundle, int type, String data, VersionConstraint unsatisfied) { 22 this.bundle = bundle; 23 this.data = data; 24 this.type = type; 25 this.unsatisfied = unsatisfied; 26 } 27 28 public BundleDescription getBundle() { 29 return bundle; 30 } 31 32 public int getType() { 33 return type; 34 } 35 36 public String getData() { 37 return data; 38 } 39 40 public VersionConstraint getUnsatisfiedConstraint() { 41 return unsatisfied; 42 } 43 44 public String toString() { 45 switch (getType()) { 46 case ResolverError.EXPORT_PACKAGE_PERMISSION : 47 case ResolverError.IMPORT_PACKAGE_PERMISSION : 48 case ResolverError.REQUIRE_BUNDLE_PERMISSION : 49 case ResolverError.PROVIDE_BUNDLE_PERMISSION : 50 case ResolverError.FRAGMENT_BUNDLE_PERMISSION : 51 case ResolverError.HOST_BUNDLE_PERMISSION : 52 return NLS.bind(StateMsg.RES_ERROR_MISSING_PERMISSION, getData()); 53 case ResolverError.MISSING_IMPORT_PACKAGE : 54 case ResolverError.MISSING_REQUIRE_BUNDLE : 55 case ResolverError.MISSING_FRAGMENT_HOST : 56 case ResolverError.MISSING_EXECUTION_ENVIRONMENT : 57 case ResolverError.MISSING_GENERIC_CAPABILITY : 58 return NLS.bind(StateMsg.RES_ERROR_MISSING_CONSTRAINT, getData()); 59 case ResolverError.FRAGMENT_CONFLICT : 60 return NLS.bind(StateMsg.RES_ERROR_FRAGMENT_CONFLICT, getData()); 61 case ResolverError.IMPORT_PACKAGE_USES_CONFLICT : 62 case ResolverError.REQUIRE_BUNDLE_USES_CONFLICT : 63 return NLS.bind(StateMsg.RES_ERROR_USES_CONFLICT, getData()); 64 case ResolverError.SINGLETON_SELECTION : 65 return NLS.bind(StateMsg.RES_ERROR_SINGLETON_CONFLICT, getData()); 66 case ResolverError.PLATFORM_FILTER : 67 return NLS.bind(StateMsg.RES_ERROR_PLATFORM_FILTER, getData()); 68 default : 69 return StateMsg.RES_ERROR_UNKNOWN; 70 } 71 } 72 } 73 | Popular Tags |