Search in sources :

Example 1 with DTDElementContent

use of org.eclipse.wst.dtd.core.internal.emf.DTDElementContent 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 DTDElementContent

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

the class DTDPrinter method visitDTDElement.

public void visitDTDElement(DTDElement element) {
    generateComment(element);
    updateStartOffset(element, sb.length());
    // $NON-NLS-1$
    sb.append("<!ELEMENT " + element.getName());
    DTDElementContent content = element.getContent();
    if (content instanceof DTDPCDataContent || content instanceof DTDElementReferenceContent) {
        // $NON-NLS-1$
        sb.append(" (");
        super.visitDTDElement(element);
        // $NON-NLS-1$
        sb.append(")");
    } else // end of if ()
    {
        // $NON-NLS-1$
        sb.append(" ");
        super.visitDTDElement(element);
    }
    // end of else
    endTag();
    // -1 for the newline char
    updateEndOffset(element, sb.length() - 1);
    visitAttributes(element);
}
Also used : DTDElementContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementContent) DTDElementReferenceContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent) DTDPCDataContent(org.eclipse.wst.dtd.core.internal.emf.DTDPCDataContent)

Example 3 with DTDElementContent

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

the class DTDElementImpl method basicSetContent.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetContent(DTDElementContent newContent, NotificationChain msgs) {
    DTDElementContent oldContent = content;
    content = newContent;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_ELEMENT__CONTENT, oldContent, newContent);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : DTDElementContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementContent) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 4 with DTDElementContent

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

the class DTDUtil method getName.

// This gets the name with pseudo namespace prefixes if dtdFile is not
// null
public static String getName(DTDObject obj, DTDFile dtdFile) {
    // $NON-NLS-1$
    String name = "";
    if (obj instanceof DTDEntity) {
        DTDEntity entity = (DTDEntity) obj;
        if (dtdFile != null && !entity.getDTDFile().equals(dtdFile)) {
            // $NON-NLS-1$
            name = new Path(entity.getDTDFile().getName()).lastSegment() + ": ";
        }
        // $NON-NLS-1$ //$NON-NLS-2$
        name += "%" + ((DTDEntity) obj).getName() + ";";
    } else if (obj instanceof DTDElement) {
        DTDElement element = (DTDElement) obj;
        if (dtdFile != null && !element.getDTDFile().equals(dtdFile)) {
            // $NON-NLS-1$
            name = new Path(element.getDTDFile().getName()).lastSegment() + ": ";
        }
        name += ((DTDElement) obj).getName();
    } else if (obj instanceof DTDElementContent) {
        return ((DTDElementContent) obj).getContentName();
    }
    return name;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) DTDElementContent(org.eclipse.wst.dtd.core.internal.emf.DTDElementContent) DTDElement(org.eclipse.wst.dtd.core.internal.emf.DTDElement) DTDEntity(org.eclipse.wst.dtd.core.internal.emf.DTDEntity)

Aggregations

DTDElementContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementContent)4 DTDElementReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent)2 Iterator (java.util.Iterator)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 DTDElement (org.eclipse.wst.dtd.core.internal.emf.DTDElement)1 DTDEntity (org.eclipse.wst.dtd.core.internal.emf.DTDEntity)1 DTDEntityReferenceContent (org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent)1 DTDGroupContent (org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent)1 DTDObject (org.eclipse.wst.dtd.core.internal.emf.DTDObject)1 DTDPCDataContent (org.eclipse.wst.dtd.core.internal.emf.DTDPCDataContent)1