Search in sources :

Example 1 with DTDObject

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

the class DTDElementContentImpl method getPathname.

public String getPathname() {
    int cnt = 0;
    DTDObject parent = getGroup();
    if (parent == null) {
        parent = getElement();
    } else {
        DTDGroupContent group = (DTDGroupContent) parent;
        Iterator i = group.getContent().iterator();
        while (i.hasNext()) {
            DTDElementContent content = (DTDElementContent) i.next();
            if (content == this) {
                break;
            }
            if ((content instanceof DTDElementReferenceContent) || (content instanceof DTDEntityReferenceContent)) {
                continue;
            }
            cnt++;
        }
    }
    // $NON-NLS-1$ //$NON-NLS-2$
    return DTDPathnameUtil.makePath(((parent == null) ? "NULL_PARENT" : parent.getPathname()), "Content", null, cnt);
}
Also used : DTDElementContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementContent) DTDGroupContent(org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent) DTDElementReferenceContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent) DTDEntityReferenceContent(org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent) Iterator(java.util.Iterator) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Example 2 with DTDObject

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

the class DTDVisitor method visitDTDFileGen.

/**
 * @generated
 */
protected void visitDTDFileGen(DTDFile file) {
    Collection notations = file.listDTDNotation();
    for (Iterator i = notations.iterator(); i.hasNext(); ) {
        visitDTDNotation((DTDNotation) i.next());
    }
    Collection entities = file.listDTDEntity();
    for (Iterator i = entities.iterator(); i.hasNext(); ) {
        visitDTDEntity((DTDEntity) i.next());
    }
    Collection objects = file.listDTDElementAndDTDParameterEntityReference();
    for (Iterator i = objects.iterator(); i.hasNext(); ) {
        DTDObject object = (DTDObject) i.next();
        if (object instanceof DTDElement) {
            visitDTDElement((DTDElement) object);
        } else // end of if ()
        {
            visitDTDParameterEntityReference((DTDParameterEntityReference) object);
        }
    // end of if ()
    }
}
Also used : Iterator(java.util.Iterator) Collection(java.util.Collection) DTDElement(org.eclipse.wst.dtd.core.internal.emf.DTDElement) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Example 3 with DTDObject

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

the class DTDEntityImpl method findObject.

public DTDObject findObject(String relativePath) {
    Object[] result = DTDPathnameUtil.parsePathComponent(relativePath);
    String type = (String) result[0];
    if (type == null)
        return null;
    DTDObject obj = null;
    if (type.equals("Content")) {
        // $NON-NLS-1$
        obj = getContent();
    } else {
        return null;
    }
    String restPath = (String) result[3];
    if ((restPath == null) || (obj == null)) {
        return obj;
    } else {
        return obj.findObject(restPath);
    }
}
Also used : DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Example 4 with DTDObject

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

the class DTDElementImpl method findObject.

public DTDObject findObject(String relativePath) {
    Object[] result = DTDPathnameUtil.parsePathComponent(relativePath);
    String type = (String) result[0];
    if (type == null)
        return null;
    DTDObject obj = null;
    if (type.equals("Attr")) {
    // $NON-NLS-1$
    // TODO: fix port
    // obj = findAttribute(name);
    } else if ((type.equals("Content")) || (type.equals("ElemRef")) || (type.equals("EntRef"))) {
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        obj = getContent();
    } else {
        return null;
    }
    String restPath = (String) result[3];
    if ((restPath == null) || (obj == null)) {
        return obj;
    } else {
        return obj.findObject(restPath);
    }
}
Also used : DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Example 5 with DTDObject

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

the class DTDUtil method loadIncludedDTD.

// load xmiModels for included DTDs
private void loadIncludedDTD(ResourceSet resources, DTD dtd) {
    ExternalDTDModel extModel = getExternalDTDModel(resources, dtd.getName());
    if (extModel != null) {
        // now fill our hash tables for elements and parameter entities
        // so that we know what can be referenced by our main dtd
        DTDFile file = extModel.getExternalDTDFile();
        Collection elementList = file.listDTDElement();
        Collection entityList = file.listDTDEntity();
        Iterator i = elementList.iterator();
        while (i.hasNext()) {
            DTDObject object = (DTDObject) i.next();
            elementPool.put(getBaseName(object), object);
        }
        i = entityList.iterator();
        while (i.hasNext()) {
            DTDEntity entity = (DTDEntity) i.next();
            if (entity.isParameterEntity()) {
                pePool.put(getBaseName(entity), entity);
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) Collection(java.util.Collection) DTDEntity(org.eclipse.wst.dtd.core.internal.emf.DTDEntity) DTDFile(org.eclipse.wst.dtd.core.internal.emf.DTDFile) DTDObject(org.eclipse.wst.dtd.core.internal.emf.DTDObject)

Aggregations

DTDObject (org.eclipse.wst.dtd.core.internal.emf.DTDObject)7 Iterator (java.util.Iterator)4 Collection (java.util.Collection)3 InternalEObject (org.eclipse.emf.ecore.InternalEObject)3 DTDElement (org.eclipse.wst.dtd.core.internal.emf.DTDElement)2 DTDElementContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementContent)1 DTDElementReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent)1 DTDEntity (org.eclipse.wst.dtd.core.internal.emf.DTDEntity)1 DTDEntityReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent)1 DTDFile (org.eclipse.wst.dtd.core.internal.emf.DTDFile)1 DTDGroupContent (org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent)1