use of org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent in project webtools.sourceediting by eclipse.
the class DTDMetrics method getElementReferences.
public Hashtable getElementReferences() {
if (elementReferenceMap == null) {
elementReferenceMap = new Hashtable();
new DTDVisitor() {
public void visitDTDElementReferenceContent(DTDElementReferenceContent elementReferenceContent) {
DTDElement dtdElement = elementReferenceContent.getReferencedElement();
Object visitation = elementReferenceMap.get(dtdElement);
if (visitation == null) {
elementReferenceMap.put(dtdElement, visitation = new Vector());
}
((Vector) visitation).addElement(elementReferenceContent);
}
}.visitDTDFile(dtdFile);
}
return elementReferenceMap;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent in project webtools.sourceediting by eclipse.
the class DTDMetrics method getElementReferencesGen.
/**
* @generated
*/
protected Hashtable getElementReferencesGen() {
if (elementReferenceMap == null) {
elementReferenceMap = new Hashtable();
new DTDVisitor() {
public void visitDTDElementReferenceContent(DTDElementReferenceContent elementReferenceContent) {
DTDElement dtdElement = elementReferenceContent.getReferencedElement();
Object visitation = elementReferenceMap.get(dtdElement);
if (visitation == null) {
elementReferenceMap.put(dtdElement, visitation = new Vector());
}
((Vector) visitation).addElement(elementReferenceContent);
}
}.visitDTDFile(dtdFile);
}
return elementReferenceMap;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent 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.DTDElementReferenceContent 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.DTDElementReferenceContent in project webtools.sourceediting by eclipse.
the class DTDPrinter method visitDTDElementContent.
public void visitDTDElementContent(DTDElementContent content) {
updateStartOffset(content, sb.length());
// $NON-NLS-1$
String trailingChars = "";
if (content instanceof DTDRepeatableContent) {
DTDRepeatableContent repeatContent = (DTDRepeatableContent) content;
DTDOccurrenceType occurrenceType = repeatContent.getOccurrence();
// Integer occurrence = repeatContent.getOccurrence();
if (occurrenceType != null) {
int occurType = occurrenceType.getValue();
if (occurType != DTDOccurrenceType.ONE) {
if (repeatContent instanceof DTDEntityReferenceContent) {
// $NON-NLS-1$
sb.append("(");
// $NON-NLS-1$
trailingChars = ")";
}
trailingChars += (char) occurType;
}
}
// end of if ()
}
if (content instanceof DTDGroupContent) {
super.visitDTDElementContent(content);
} else // end of if ()
if (content instanceof DTDElementReferenceContent || content instanceof DTDEntityReferenceContent) {
sb.append(((DTDRepeatableContent) content).unparseRepeatableContent());
} else // end of if ()
{
// handle DTDPCDataContent, DTDAnyContent and DTDEmptyContent here
sb.append(content.getContentName());
}
// end of else
sb.append(trailingChars);
updateEndOffset(content, sb.length());
}
Aggregations