/** */ public IStructuredDocument getStructuredDocument() { IStructuredDocumentRegion first = getFirstStructuredDocumentRegion(); if (first == null) return null; return first.getParentDocument(); }
/** * these "deep" parenting is not normal, but just in case. */ private IStructuredDocument _getParentDocument() { // go up enough parents to get to document ITextRegionCollection parent = getParent(); while (!(parent instanceof IStructuredDocumentRegion)) { // would be an error not to be container, but // won't check for it now parent = ((ITextRegionContainer) parent).getParent(); } return ((IStructuredDocumentRegion) parent).getParentDocument(); }
public DocumentReader(final IStructuredDocumentRegion flatnode, final String change, final int requestStart, final int lengthToReplace, final int newTokenOffset) { this.parent = flatnode.getParentDocument(); this.startPhpRegion = flatnode.getStart() + getStart(); this.endPhpRegion = startPhpRegion + getLength(); this.changeLength = change.length(); this.index = startPhpRegion + newTokenOffset; this.change = change; this.requestStart = requestStart; this.lengthToReplace = lengthToReplace; }
static private void unlock(IStructuredDocumentRegion node) { if (node == null) { return; } IStructuredDocument doc = node.getParentDocument(); if (doc == null) { return; } doc.clearReadOnly(node.getStart(), node.getLength()); }
/** */ protected void replaceSource(IStructuredDocumentRegion flatNode, int offset, int length, String source) { if (flatNode == null) return; IStructuredDocument structuredDocument = flatNode.getParentDocument(); if (structuredDocument == null) return; if (source == null) source = new String(); int startOffset = flatNode.getStartOffset(); if (structuredDocument.containsReadOnly(startOffset + offset, length)) return; // We use 'structuredDocument' as the requester object just so this // and the other // format-related 'repalceText' (in replaceSource) can use the same // requester. // Otherwise, if requester is not identical, // the undo group gets "broken" into multiple pieces based // on the requesters being different. Technically, any unique, common // requester object would work. structuredDocument.replaceText(structuredDocument, startOffset + offset, length, source); }
static private void lock(IStructuredDocumentRegion node, boolean canInsertBefore, boolean canInsertAfter) { if (node == null) { return; } IStructuredDocument doc = node.getParentDocument(); if (doc == null) { return; } if (doc instanceof BasicStructuredDocument) { ((BasicStructuredDocument)doc).makeReadOnly(node.getStart(), node.getLength(), canInsertBefore, canInsertAfter); } else { doc.makeReadOnly(node.getStart(), node.getLength()); } }
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, this, changes, requestStart, lengthToReplace);
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, this, changes, requestStart, lengthToReplace);
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, this, changes, requestStart, lengthToReplace);
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, this, changes, requestStart, lengthToReplace);
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, this, changes, requestStart, lengthToReplace);
if (type != null && (type == DOMRegionContext.XML_TAG_NAME || type == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME || type == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)) IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE.getContext(((IStructuredDocumentRegion)containerRegion).getParentDocument(), containerRegion.getStartOffset() + region.getStart()); resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getDOMContextResolver(context); if (type == DOMRegionContext.XML_TAG_NAME)
result = new RegionChangedEvent(parent.getParentDocument(), requester, parent, region, changes, requestStart, lengthToReplace);
IStructuredDocument document = sdRegion.getParentDocument(); int lineIndex = document.getLineOfOffset(startFormat); int endLineIndex = document.getLineOfOffset(endFormat);
: flatnode.getParentDocument().get(requestStart, lengthToReplace); final int length = changes.length(); if (startQuoted(deletedText) || startQuoted(changes)) {
unlock(flatNode); } else { IStructuredDocument structuredDocument = flatNode.getParentDocument(); int offset, length; offset = flatNode.getStart();
Span span = getDataSpan(node); if (0 <= span.length) { IStructuredDocument structuredDocument = flatNode.getParentDocument(); int offset, length; offset = flatNode.getStart();