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); }
void handleSelectionChanged(IStructuredSelection selection) { if (!selection.isEmpty()) { Object selected = selection.getFirstElement(); if (selected instanceof License) licenseTextBox.setText(((License) selected).getBody()); else if (selected instanceof IUWithLicenseParent) licenseTextBox.setText(((IUWithLicenseParent) selected).license.getBody()); } }
final ILicense license = licenses.hasNext() ? licenses.next() : null; if (license != null && license.getBody().length() > 0) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); gd.heightHint = computeHeightLimit(text, 20); text.setLayoutData(gd); text.setText(license.getBody()); text.setEditable(false);
private void writeLicenses(Collection<ILicense> licenses) { if (licenses != null && licenses.size() > 0) { // In the future there may be more than one license, so we write this // as a collection of one. // See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216911 start(LICENSES_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, licenses.size()); for (ILicense license : licenses) { if (license == null) continue; start(LICENSE_ELEMENT); if (license.getLocation() != null) { attribute(URI_ATTRIBUTE, license.getLocation().toString()); try { // we write the URL attribute for backwards compatibility with 3.4.x // this attribute should be removed if we make a breaking format change. attribute(URL_ATTRIBUTE, URIUtil.toURL(license.getLocation()).toExternalForm()); } catch (MalformedURLException e) { attribute(URL_ATTRIBUTE, license.getLocation().toString()); } } cdata(license.getBody(), true); end(LICENSE_ELEMENT); } end(LICENSES_ELEMENT); } }
private void writeLicenses(Collection<ILicense> licenses) { if (licenses != null && licenses.size() > 0) { // In the future there may be more than one license, so we write this // as a collection of one. // See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216911 start(LICENSES_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, licenses.size()); for (ILicense license : licenses) { if (license == null) continue; start(LICENSE_ELEMENT); if (license.getLocation() != null) { attribute(URI_ATTRIBUTE, license.getLocation().toString()); try { // we write the URL attribute for backwards compatibility with 3.4.x // this attribute should be removed if we make a breaking format change. attribute(URL_ATTRIBUTE, URIUtil.toURL(license.getLocation()).toExternalForm()); } catch (MalformedURLException e) { attribute(URL_ATTRIBUTE, license.getLocation().toString()); } } cdata(license.getBody(), true); end(LICENSE_ELEMENT); } end(LICENSES_ELEMENT); } }
private void writeLicenses(Collection<ILicense> licenses) { if (licenses != null && licenses.size() > 0) { // In the future there may be more than one license, so we write this // as a collection of one. // See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=216911 start(LICENSES_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, licenses.size()); for (ILicense license : licenses) { if (license == null) continue; start(LICENSE_ELEMENT); if (license.getLocation() != null) { attribute(URI_ATTRIBUTE, license.getLocation().toString()); try { // we write the URL attribute for backwards compatibility with 3.4.x // this attribute should be removed if we make a breaking format change. attribute(URL_ATTRIBUTE, URIUtil.toURL(license.getLocation()).toExternalForm()); } catch (MalformedURLException e) { attribute(URL_ATTRIBUTE, license.getLocation().toString()); } } cdata(license.getBody(), true); end(LICENSE_ELEMENT); } end(LICENSES_ELEMENT); } }