Search in sources :

Example 1 with DTDEnumGroupKind

use of org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind in project webtools.sourceediting by eclipse.

the class DTDModelBuilder method createDTDEnumeration.

private DTDEnumerationType createDTDEnumeration(DTDAttribute dtdattr, AttNode attdef, int enumKind) {
    DTDEnumerationType enumeration = getFactory().createDTDEnumerationType();
    DTDEnumGroupKind groupKind = DTDEnumGroupKind.get(enumKind);
    enumeration.setKind(groupKind);
    dtdattr.getDTDElement().getDTDFile().getDTDEnumerationType().add(enumeration);
    // Enumeration values
    Enumeration tokenIter = attdef.elements();
    if (tokenIter != null) {
        while (tokenIter.hasMoreElements()) {
            String val = (String) tokenIter.nextElement();
            EEnumLiteral enumLiteral = createEEnumLiteral();
            // enumLiteral.setXMIDocument(dtdattr.getXMIDocument());
            // MOF2EMF Port
            // enumLiteral.refSetLiteral(val);
            enumLiteral.setName(val);
            // enumLiteral.setNumber(i++);
            enumeration.getEnumLiterals().add(enumLiteral);
        }
    }
    return enumeration;
}
Also used : Enumeration(java.util.Enumeration) DTDEnumerationType(org.eclipse.wst.dtd.core.internal.emf.DTDEnumerationType) EEnumLiteral(org.eclipse.emf.ecore.EEnumLiteral) DTDEnumGroupKind(org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind)

Example 2 with DTDEnumGroupKind

use of org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind in project webtools.sourceediting by eclipse.

the class DTDEnumerationTypeImpl method setKind.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setKind(DTDEnumGroupKind newKind) {
    DTDEnumGroupKind oldKind = kind;
    kind = newKind == null ? KIND_EDEFAULT : newKind;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_ENUMERATION_TYPE__KIND, oldKind, kind));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DTDEnumGroupKind(org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind)

Example 3 with DTDEnumGroupKind

use of org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind in project webtools.sourceediting by eclipse.

the class DTDAttributeImpl method createDTDEnumeration.

public DTDEnumerationType createDTDEnumeration(String[] enumValues, int enumKind) {
    DTDEnumerationType enumeration = DTDFactoryImpl.instance().createDTDEnumerationType();
    // enum.setID("Enum_" + ((DTDElement)getMOFDomain()).getName() + "_" +
    // getName());
    DTDEnumGroupKind groupKind = DTDEnumGroupKind.get(enumKind);
    enumeration.setKind(groupKind);
    // Enumeration values
    if (enumValues != null) {
        for (int i = 0; i < enumValues.length; i++) {
            EcorePackage ePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
            EEnumLiteral enumLiteral = ((EcoreFactory) ePackage.getEFactoryInstance()).createEEnumLiteral();
            // MOF2EMF Port
            // enumLiteral.refSetLiteral(enumValues[i]);
            enumLiteral.setName(enumValues[i]);
            // MOF2EMF Port
            // enumLiteral.refSetLiteral(i);
            enumLiteral.setValue(i);
            enumeration.getEnumLiterals().add(enumLiteral);
        }
    }
    getDTDElement().getDTDFile().getDTDEnumerationType().add(enumeration);
    return enumeration;
}
Also used : DTDEnumerationType(org.eclipse.wst.dtd.core.internal.emf.DTDEnumerationType) EcoreFactory(org.eclipse.emf.ecore.EcoreFactory) EcorePackage(org.eclipse.emf.ecore.EcorePackage) EEnumLiteral(org.eclipse.emf.ecore.EEnumLiteral) DTDEnumGroupKind(org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind)

Example 4 with DTDEnumGroupKind

use of org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind in project webtools.sourceediting by eclipse.

the class DTDModelBuilder method createDTDEnumeration.

public DTDEnumerationType createDTDEnumeration(DTDAttribute dtdattr, String[] enumValues, int enumKind) {
    DTDEnumerationType enumeration = getFactory().createDTDEnumerationType();
    DTDEnumGroupKind groupKind = DTDEnumGroupKind.get(enumKind);
    enumeration.setKind(groupKind);
    // Enumeration values
    if (enumValues != null) {
        for (int i = 0; i < enumValues.length; i++) {
            EEnumLiteral enumLiteral = createEEnumLiteral();
            // enumVal.setXMIDocument(dtdattr.getXMIDocument());
            // MOF2EMF Port
            // enumLiteral.refSetLiteral(enumValues[i]);
            enumLiteral.setName(enumValues[i]);
            // enumLiteral.setNumber(i);
            enumeration.getEnumLiterals().add(enumLiteral);
        }
    }
    dtdattr.getDTDElement().getDTDFile().getDTDEnumerationType().add(enumeration);
    return enumeration;
}
Also used : DTDEnumerationType(org.eclipse.wst.dtd.core.internal.emf.DTDEnumerationType) EEnumLiteral(org.eclipse.emf.ecore.EEnumLiteral) DTDEnumGroupKind(org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind)

Aggregations

DTDEnumGroupKind (org.eclipse.wst.dtd.core.internal.emf.DTDEnumGroupKind)4 EEnumLiteral (org.eclipse.emf.ecore.EEnumLiteral)3 DTDEnumerationType (org.eclipse.wst.dtd.core.internal.emf.DTDEnumerationType)3 Enumeration (java.util.Enumeration)1 EcoreFactory (org.eclipse.emf.ecore.EcoreFactory)1 EcorePackage (org.eclipse.emf.ecore.EcorePackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1