/** */ public int getStart() { int flatNodeOffset = 0; if (this.flatNode != null) flatNodeOffset = this.flatNode.getStart(); return flatNodeOffset + this.offset; }
public int getEnd() { int flatNodeOffset = 0; if (this.flatNode != null) flatNodeOffset = this.flatNode.getStart(); return flatNodeOffset + this.offset + this.length; }
/** * */ void expandRemovedRangeBegin(IStructuredDocumentRegion flatNode) { if (flatNode == null) { return; } int newBegin = flatNode.getStart(); // fOldStart == fNewStart, right?? if (fRemovedRangeBegin < 0 || newBegin < fRemovedRangeBegin) { fRemovedRangeBegin = newBegin; } }
/** */ StructuredDocumentRegionProxy(int offset, int length, IStructuredDocumentRegion flatNode) { super(); this.offset = offset; this.length = length; this.flatNode = flatNode; if (this.flatNode != null) this.offset -= this.flatNode.getStart(); }
int getOffset() { int flatNodeOffset = 0; if (this.flatNode != null) flatNodeOffset = this.flatNode.getStart(); return flatNodeOffset + this.offset; }
/** */ void setOffset(int offset) { this.offset = offset; if (this.flatNode != null) this.offset -= this.flatNode.getStart(); }
/** * only for insertion.. */ static boolean isInterruption(CSSStructuredDocumentRegionContainer target, IStructuredDocumentRegion flatNode) { if (target == null || flatNode == null) { return false; } int start = flatNode.getStart(); IStructuredDocumentRegion firstNode = target.getFirstStructuredDocumentRegion(); IStructuredDocumentRegion lastNode = target.getLastStructuredDocumentRegion(); if (firstNode != null && firstNode.getStart() < start && lastNode != null && start < lastNode.getStart()) { return true; } return false; }
/** * getEndStartOffset method * * @return int */ public int getEndStartOffset() { if (this.endStructuredDocumentRegion != null) return this.endStructuredDocumentRegion.getStart(); return super.getEndOffset(); }
/** */ public int getStart() { IStructuredDocumentRegion first = getFirstStructuredDocumentRegion(); if (first == null) return 0; return first.getStart(); }
/** * @return int */ public int getStartOffset() { IStructuredDocumentRegion flatNode = getFirstStructuredDocumentRegion(); if (flatNode != null) return flatNode.getStart(); return -1; }
/** * If needed, modify last flat node */ static void expandStructuredDocumentRegionContainer(CSSStructuredDocumentRegionContainer target, IStructuredDocumentRegion flatNode) { if (target == null || flatNode == null) { return; } IStructuredDocumentRegion lastNode = target.getLastStructuredDocumentRegion(); if (lastNode == flatNode) { return; } if (lastNode == null || lastNode.getStart() < flatNode.getStart()) { target.setLastStructuredDocumentRegion(flatNode); } }
private ReparseRange getUpdateRangeForDelimiter(int start, int end) { if (dirtyStart != null && dirtyStart.getStart() < start) { start = dirtyStart.getStart(); } IStructuredDocumentRegion docRegion = fStructuredDocument.getRegionAtCharacterOffset(start); if (docRegion == null) { return null; } if (docRegion.getType() == CSSRegionContexts.CSS_DELIMITER) { IStructuredDocumentRegion prevRegion = docRegion.getPrevious(); if (prevRegion != null) { return new ReparseRange(prevRegion.getStart(), end); } } return null; }
protected void setStructuredDocumentRegionElementName(IDOMModel model, IStructuredDocumentRegion flatNode, String oldName, String newName) { if (flatNode != null) { String string = flatNode.getText(); int index = string.indexOf(oldName); if (index != -1) { index += flatNode.getStart(); model.getStructuredDocument().replaceText(this, index, oldName.length(), newName); } } } }
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 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()); } }
/** * getStartOffset method * * @return int */ public int getStartOffset() { if (getStartStructuredDocumentRegion() == null && this.endStructuredDocumentRegion != null && !hasChildNodes()) { return this.endStructuredDocumentRegion.getStart(); } return super.getStartOffset(); }
static private void unlock(IStructuredDocumentRegion node) { if (node == null) { return; } IStructuredDocument doc = node.getParentDocument(); if (doc == null) { return; } doc.clearReadOnly(node.getStart(), node.getLength()); }
void replaceRegions(IStructuredDocumentRegion flatNode, ITextRegionList newRegions, ITextRegionList oldRegions) { // future_TODO: optimize NodeImpl root = (NodeImpl) this.model.getDocument(); this.parentNode = root; this.nextNode = (NodeImpl) root.getFirstChild(); removeGapStructuredDocumentRegion(flatNode); insertGapStructuredDocumentRegionBefore(flatNode.getStart()); changeStructuredDocumentRegion(flatNode); insertGapStructuredDocumentRegionAfter(flatNode.getEnd()); }
void changeRegion(IStructuredDocumentRegion flatNode, ITextRegion region) { // future_TODO: optimize NodeImpl root = (NodeImpl) this.model.getDocument(); this.parentNode = root; this.nextNode = (NodeImpl) root.getFirstChild(); removeGapStructuredDocumentRegion(flatNode); insertGapStructuredDocumentRegionBefore(flatNode.getStart()); changeStructuredDocumentRegion(flatNode); insertGapStructuredDocumentRegionAfter(flatNode.getEnd()); }