Search in sources :

Example 1 with FeatureEList

use of org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList in project mylyn.docs by eclipse.

the class PublicationProxy method getSubject.

@SuppressWarnings("rawtypes")
public String getSubject() {
    EList<Subject> subjects = publication.getPackage().getMetadata().getSubjects();
    if (subjects.size() > 0) {
        FeatureMap fm = subjects.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) Subject(org.eclipse.mylyn.docs.epub.dc.Subject)

Example 2 with FeatureEList

use of org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList in project mylyn.docs by eclipse.

the class PublicationProxy method getLanguage.

@SuppressWarnings("rawtypes")
public String getLanguage() {
    EList<Language> languages = publication.getPackage().getMetadata().getLanguages();
    if (languages.size() > 0) {
        FeatureMap fm = languages.get(0).getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                String iso639 = ((FeatureEList) o).get(0).toString();
                Locale l = new Locale(iso639);
                return l.getDisplayLanguage();
            }
        }
    }
    return EMPTY_STRING;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Locale(java.util.Locale) Language(org.eclipse.mylyn.docs.epub.dc.Language)

Example 3 with FeatureEList

use of org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList in project mylyn.docs by eclipse.

the class PublicationProxy method getPublicationDate.

@SuppressWarnings("rawtypes")
public String getPublicationDate() {
    EList<Date> dates = publication.getPackage().getMetadata().getDates();
    if (dates.size() > 0) {
        for (Date date : dates) {
            if (date.getEvent().equals("publication")) {
                // $NON-NLS-1$
                FeatureMap fm = date.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) Date(org.eclipse.mylyn.docs.epub.dc.Date)

Example 4 with FeatureEList

use of org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList 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)

Example 5 with FeatureEList

use of org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList in project mylyn.docs by eclipse.

the class AbstractTest method getText.

@SuppressWarnings("rawtypes")
public String getText(DCType identifier) {
    FeatureMap fm = identifier.getMixed();
    Object o = fm.get(TEXT, false);
    if (o instanceof FeatureEList) {
        if (((FeatureEList) o).size() > 0) {
            return ((FeatureEList) o).get(0).toString();
        }
    }
    return null;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)

Aggregations

FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)10 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)10 Locale (java.util.Locale)1 Creator (org.eclipse.mylyn.docs.epub.dc.Creator)1 Date (org.eclipse.mylyn.docs.epub.dc.Date)1 Identifier (org.eclipse.mylyn.docs.epub.dc.Identifier)1 Language (org.eclipse.mylyn.docs.epub.dc.Language)1 Rights (org.eclipse.mylyn.docs.epub.dc.Rights)1 Subject (org.eclipse.mylyn.docs.epub.dc.Subject)1 Title (org.eclipse.mylyn.docs.epub.dc.Title)1 Meta (org.eclipse.mylyn.docs.epub.ncx.Meta)1 NavPoint (org.eclipse.mylyn.docs.epub.ncx.NavPoint)1