Search in sources :

Example 1 with Title

use of org.eclipse.mylyn.docs.epub.dc.Title in project mylyn.docs by eclipse.

the class Publication method addTitle.

/**
 * Adds a required <i>title</i> specification to the publication.
 *
 * @param id
 *            identifier or <code>null</code>
 * @param lang
 *            the language code or <code>null</code>
 * @param value
 *            the new title
 * @return the new title
 */
public Title addTitle(String id, Locale lang, String value) {
    if (value == null) {
        // $NON-NLS-1$
        throw new IllegalArgumentException("A value must be specified");
    }
    log(// $NON-NLS-1$
    MessageFormat.format(// $NON-NLS-1$
    Messages.getString("OPSPublication.20"), // $NON-NLS-1$
    value, // $NON-NLS-1$
    lang == null ? Messages.getString("OPSPublication.3") : lang.getDisplayName()), // $NON-NLS-1$
    Severity.VERBOSE, indent);
    Title dc = DCFactory.eINSTANCE.createTitle();
    setDcLocalized(dc, id, lang, value);
    opfPackage.getMetadata().getTitles().add(dc);
    return dc;
}
Also used : Title(org.eclipse.mylyn.docs.epub.dc.Title)

Example 2 with Title

use of org.eclipse.mylyn.docs.epub.dc.Title in project mylyn.docs by eclipse.

the class PublicationProxy method getTitle.

@SuppressWarnings("rawtypes")
public String getTitle() {
    EList<Title> titles = publication.getPackage().getMetadata().getTitles();
    if (titles.size() > 0) {
        FeatureMap fm = titles.get(0).getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                return ((FeatureEList) o).get(0).toString();
            }
        }
    }
    return EMPTY_STRING;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Title(org.eclipse.mylyn.docs.epub.dc.Title)

Aggregations

Title (org.eclipse.mylyn.docs.epub.dc.Title)2 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)1