/** * 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()); }
protected void writeUpdateDescriptor(IInstallableUnit iu, IUpdateDescriptor descriptor) { if (descriptor == null) return; if (descriptor.getIUsBeingUpdated().size() > 1) throw new IllegalStateException(); IMatchExpression<IInstallableUnit> singleUD = descriptor.getIUsBeingUpdated().iterator().next(); start(UPDATE_DESCRIPTOR_ELEMENT); if (RequiredCapability.isSimpleRequirement(singleUD)) { attribute(ID_ATTRIBUTE, RequiredCapability.extractName(singleUD)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(singleUD)); } else { writeMatchExpression(singleUD); } attribute(UPDATE_DESCRIPTOR_SEVERITY, descriptor.getSeverity()); attribute(DESCRIPTION_ATTRIBUTE, descriptor.getDescription()); end(UPDATE_DESCRIPTOR_ELEMENT); }
protected void writeUpdateDescriptor(IInstallableUnit iu, IUpdateDescriptor descriptor) { if (descriptor == null) return; if (descriptor.getIUsBeingUpdated().size() > 1) throw new IllegalStateException(); IMatchExpression<IInstallableUnit> singleUD = descriptor.getIUsBeingUpdated().iterator().next(); start(UPDATE_DESCRIPTOR_ELEMENT); if (RequiredCapability.isSimpleRequirement(singleUD)) { attribute(ID_ATTRIBUTE, RequiredCapability.extractName(singleUD)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(singleUD)); } else { writeMatchExpression(singleUD); } attribute(UPDATE_DESCRIPTOR_SEVERITY, descriptor.getSeverity()); attribute(DESCRIPTION_ATTRIBUTE, descriptor.getDescription()); end(UPDATE_DESCRIPTOR_ELEMENT); }
protected void writeUpdateDescriptor(IInstallableUnit iu, IUpdateDescriptor descriptor) { if (descriptor == null) return; if (descriptor.getIUsBeingUpdated().size() > 1) throw new IllegalStateException(); IMatchExpression<IInstallableUnit> singleUD = descriptor.getIUsBeingUpdated().iterator().next(); start(UPDATE_DESCRIPTOR_ELEMENT); if (RequiredCapability.isSimpleRequirement(singleUD)) { attribute(ID_ATTRIBUTE, RequiredCapability.extractName(singleUD)); attribute(VERSION_RANGE_ATTRIBUTE, RequiredCapability.extractRange(singleUD)); } else { writeMatchExpression(singleUD); } attribute(UPDATE_DESCRIPTOR_SEVERITY, descriptor.getSeverity()); attribute(DESCRIPTION_ATTRIBUTE, descriptor.getDescription()); end(UPDATE_DESCRIPTOR_ELEMENT); }