Search in sources :

Example 6 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(Identifier element) {
    FeatureMap fm = element.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)

Example 7 with FeatureEList

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

the class PublicationProxy method getIdentifier.

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

Example 8 with FeatureEList

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

the class PublicationProxy method getRights.

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

Example 9 with FeatureEList

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

the class PublicationProxy method getCreator.

/**
 * Returns the name of the first instance of an {@link Creator} in the publication. If a value has not been assigned
 * an empty string will be returned.
 *
 * @return the creator name
 */
@SuppressWarnings("rawtypes")
public String getCreator() {
    EList<Creator> creators = publication.getPackage().getMetadata().getCreators();
    if (creators.size() > 0) {
        FeatureMap fm = creators.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) Creator(org.eclipse.mylyn.docs.epub.dc.Creator)

Example 10 with FeatureEList

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

the class TestOPSPublication method getText.

@SuppressWarnings("rawtypes")
public String getText(Object element) {
    if (element instanceof NavPoint) {
        FeatureMap fm = ((NavPoint) element).getNavLabels().get(0).getText().getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                return ((FeatureEList) o).get(0).toString();
            }
        }
    }
    if (element instanceof Meta) {
        Object o = ((Meta) element).getContent();
        return o.toString();
    }
    return "null";
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Meta(org.eclipse.mylyn.docs.epub.ncx.Meta) NavPoint(org.eclipse.mylyn.docs.epub.ncx.NavPoint)

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