private String getValueSource(ElementImpl ownerElement) { if (this.valueSource != null) return this.valueSource; // DW: 4/16/2003 due to change in structuredDocument ... we need a // flatnode to // get at region values. For now I'll assume this is always the first // flatnode .. may need to make smarter later (e.g. to search for // the flatnode that this.valueRegion belongs to. if (this.valueRegion != null) return StructuredDocumentRegionUtil.getAttrValue(ownerElement.getStructuredDocumentRegion(), this.valueRegion); return new String(); }
/** * getFirstStructuredDocumentRegion method * */ public IStructuredDocumentRegion getFirstStructuredDocumentRegion() { return StructuredDocumentRegionUtil.getFirstStructuredDocumentRegion(getStructuredDocumentRegion()); }
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_CDATA_CLOSE); } }
ITextRegion region = StructuredDocumentRegionUtil.getFirstRegion(flatNode); if (region != null) { String regionType = region.getType(); if (regionType == DOMRegionContext.XML_ENTITY_REFERENCE || regionType == DOMRegionContext.XML_CHAR_REFERENCE) { String name = StructuredDocumentRegionUtil.getEntityRefName(flatNode, region); if (name != null) { DocumentImpl document = (DocumentImpl) getOwnerDocument();
/** * getFirstStructuredDocumentRegion method * */ public IStructuredDocumentRegion getFirstStructuredDocumentRegion() { return StructuredDocumentRegionUtil.getStructuredDocumentRegion(this.flatNode); }
/** * replaceRegions method * * @param newRegions * java.util.Vector * @param oldRegions * java.util.Vector */ void replaceRegions(IStructuredDocumentRegion flatNode, ITextRegionList newRegions, ITextRegionList oldRegions) { if (flatNode == null) return; if (this.model.getDocument() == null) return; this.context = new XMLModelContext(this.model.getDocument()); // optimize typical cases String regionType = StructuredDocumentRegionUtil.getFirstRegionType(flatNode); if (regionType == DOMRegionContext.XML_TAG_OPEN) { changeStartTag(flatNode, newRegions, oldRegions); } else if (regionType == DOMRegionContext.XML_END_TAG_OPEN) { changeEndTag(flatNode, newRegions, oldRegions); } else { changeStructuredDocumentRegion(flatNode); } }
/** * getLastStructuredDocumentRegion method * */ public IStructuredDocumentRegion getLastStructuredDocumentRegion() { return StructuredDocumentRegionUtil.getLastStructuredDocumentRegion(getStructuredDocumentRegion()); }
if (flatNode == null) return null; ITextRegion region = StructuredDocumentRegionUtil.getLastRegion(flatNode); if (region == null || region.getType() != DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) return null;
if (regionType == DOMRegionContext.XML_ENTITY_REFERENCE || regionType == DOMRegionContext.XML_CHAR_REFERENCE) { if (name == null) name = StructuredDocumentRegionUtil.getEntityRefName(flatNode, region);
/** * getLastStructuredDocumentRegion method * */ public IStructuredDocumentRegion getLastStructuredDocumentRegion() { return StructuredDocumentRegionUtil.getStructuredDocumentRegion(this.flatNode); }
/** */ private boolean isInvalid(IStructuredDocumentRegion flatNode) { if (flatNode == null) return false; if (flatNode instanceof StructuredDocumentRegionContainer) { StructuredDocumentRegionContainer container = (StructuredDocumentRegionContainer) flatNode; int count = container.getStructuredDocumentRegionCount(); for (int i = 0; i < count; i++) { IStructuredDocumentRegion content = container.getStructuredDocumentRegion(i); if (isInvalid(content)) return true; } return false; } if (flatNode instanceof StructuredDocumentRegionProxy) { StructuredDocumentRegionProxy proxy = (StructuredDocumentRegionProxy) flatNode; return isInvalid(proxy.getStructuredDocumentRegion()); } String regionType = StructuredDocumentRegionUtil.getFirstRegionType(flatNode); if (regionType != DOMRegionContext.XML_CONTENT && isNotNestedContent(regionType) && regionType != DOMRegionContext.XML_ENTITY_REFERENCE && regionType != DOMRegionContext.XML_CHAR_REFERENCE && regionType != DOMRegionContext.BLOCK_TEXT && regionType != DOMRegionContext.WHITE_SPACE) { return true; } return false; }
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_PI_CLOSE); }
/** * getLastStructuredDocumentRegion method * */ public IStructuredDocumentRegion getLastStructuredDocumentRegion() { if (this.endStructuredDocumentRegion != null) return StructuredDocumentRegionUtil.getStructuredDocumentRegion(this.endStructuredDocumentRegion); return StructuredDocumentRegionUtil.getStructuredDocumentRegion(getStructuredDocumentRegion()); }
if (!element.hasStartTag() || StructuredDocumentRegionUtil.getFirstRegionType(flatNode) != DOMRegionContext.XML_END_TAG_OPEN) { String tagName = element.getTagName(); if (tagName == null || !tagName.equals(newTagName)) {
/** */ public String getValueSource() { if (this.valueSource != null) return this.valueSource; // DW: 4/16/2003 due to change in structuredDocument ... we need a // flatnode to // get at region values. For now I'll assume this is always the first // flatnode .. may need to make smarter later (e.g. to search for // the flatnode that this.valueRegion belongs to. // DW: 4/30/2003 For some reason, this method is getting called a lot // Not sure if its a threading problem, or a fundamental error // elsewhere. // It needs more investigation, but in the use cases I've seen, // doesn't // seem to hurt to simply return null in those cases. I saw this null // case, // when tryint go format an XML file. if (this.ownerElement == null) return null; IStructuredDocumentRegion ownerRegion = this.ownerElement.getFirstStructuredDocumentRegion(); if (ownerRegion == null) return null; if (this.valueRegion != null) return StructuredDocumentRegionUtil.getAttrValue(ownerRegion, this.valueRegion); return new String(); }
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_DOCTYPE_DECLARATION_CLOSE || regionType == DOMRegionContext.XML_DECLARATION_CLOSE); }
/** * getFirstStructuredDocumentRegion method * */ public IStructuredDocumentRegion getFirstStructuredDocumentRegion() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode != null) return StructuredDocumentRegionUtil.getStructuredDocumentRegion(flatNode); return StructuredDocumentRegionUtil.getStructuredDocumentRegion(this.endStructuredDocumentRegion); }
String regionType = StructuredDocumentRegionUtil.getFirstRegionType(flatNode); if (regionType == DOMRegionContext.XML_TAG_OPEN) { insertStartTag(flatNode);
publicId = StructuredDocumentRegionUtil.getAttrValue(flatNode, region); systemId = StructuredDocumentRegionUtil.getAttrValue(flatNode, region);
/** */ public boolean isClosed() { IStructuredDocumentRegion flatNode = getStructuredDocumentRegion(); if (flatNode == null) return true; // will be generated String regionType = StructuredDocumentRegionUtil.getLastRegionType(flatNode); return (regionType == DOMRegionContext.XML_COMMENT_CLOSE || isNestedCommentClose(regionType)); }