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);
}
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);
}
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;
}
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;
}
Aggregations