private ILicense getLicense(IInstallableUnit iu, ILicense license, String locale) { String body = (license != null ? license.getBody() : null); if (body == null || body.length() <= 1 || body.charAt(0) != '%') return license; final String actualKey = body.substring(1); // Strip off the % body = getLocalizedIUProperty(iu, actualKey, locale); return MetadataFactory.createLicense(license.getLocation(), body); }
/** * Return the localized value for the specified IInstallableUnit * property. * * @param iu the IInstallableUnit in question * @param propertyKey the name of the property to be retrieved * @param locale The locale to return the property for * @return the localized property value, or <code>null</code> if no * such property is defined. */ public String getIUProperty(IInstallableUnit iu, String propertyKey, String locale) { if (locale == null) locale = getCurrentLocale(); String value = iu.getProperty(propertyKey); if (value == null || value.length() <= 1 || value.charAt(0) != '%') return value; // else have a localizable property final String actualKey = value.substring(1); // Strip off the % return getLocalizedIUProperty(iu, actualKey, locale); }
/** * Return the copyright for the specified IInstallableUnit, * localized for the receiver's locale. * * @param iu the IInstallableUnit in question * @return the localized copyright defined by the IInstallableUnit */ public ICopyright getCopyright(IInstallableUnit iu, String locale) { if (locale == null) locale = getCurrentLocale(); ICopyright copyright = iu.getCopyright(); String body = (copyright != null ? copyright.getBody() : null); if (body == null || body.length() <= 1 || body.charAt(0) != '%') return copyright; final String actualKey = body.substring(1); // Strip off the % body = getLocalizedIUProperty(iu, actualKey, locale); return MetadataFactory.createCopyright(copyright.getLocation(), body); }
/** * Return an update descriptor localized for the receiver's locale. * * @param iu the IInstallableUnit in question * @return the localized update descriptor defined by the IInstallableUnit */ public IUpdateDescriptor getUpdateDescriptor(IInstallableUnit iu, String locale) { if (locale == null) locale = getCurrentLocale(); IUpdateDescriptor descriptor = iu.getUpdateDescriptor(); String body = (descriptor != null ? descriptor.getDescription() : null); if (body == null || body.length() <= 1 || body.charAt(0) != '%') return descriptor; final String actualKey = body.substring(1); // Strip off the % body = getLocalizedIUProperty(iu, actualKey, locale); return MetadataFactory.createUpdateDescriptor(descriptor.getIUsBeingUpdated(), descriptor.getSeverity(), body, descriptor.getLocation()); }