Package org.eclipse.text.edits
Class MultiTextEdit
java.lang.Object
org.eclipse.text.edits.TextEdit
org.eclipse.text.edits.MultiTextEdit
- Direct Known Subclasses:
- MultiTextEditWithProgress
A multi-text edit can be used to aggregate several edits into
 one edit. The edit itself doesn't modify a document.
 
 Clients are allowed to implement subclasses of a multi-text
 edit.Subclasses must implement doCopy() to ensure
 the a copy of the right type is created. Not implementing
 doCopy() in subclasses will result in an assertion
 failure during copying.
- Since:
- 3.0
- 
Field SummaryFields inherited from class org.eclipse.text.edits.TextEditCREATE_UNDO, NONE, UPDATE_REGIONS
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreates a newMultiTextEdit.MultiTextEdit(int offset, int length) Creates a newMultiTextEditfor the given range.protectedMultiTextEdit(MultiTextEdit other) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaccept0(TextEditVisitor visitor) Accepts the given visitor on a type-specific visit of the current edit.protected booleanReturnstrueif an edit with length zero can cover another edit.protected voidChecks the edit's integrity.final booleanReturnstrueif the edit covers the given editother.protected TextEditdoCopy()Creates and returns a copy of this edit.final intReturns the length of the edit.final intReturns the offset of the edit.Methods inherited from class org.eclipse.text.edits.TextEditaccept, acceptChildren, addChild, addChildren, apply, apply, childDocumentUpdated, childRegionUpdated, copy, equals, getChildren, getChildrenSize, getCoverage, getExclusiveEnd, getInclusiveEnd, getParent, getRegion, getRoot, hasChildren, hashCode, isDeleted, moveTree, postProcessCopy, removeChild, removeChild, removeChildren, toString
- 
Constructor Details- 
MultiTextEditpublic MultiTextEdit()Creates a newMultiTextEdit. The range of the edit is determined by the range of its children. Adding this edit to a parent edit sets its range to the range covered by its children. If the edit doesn't have any children its offset is set to the parent's offset and its length is set to 0.
- 
MultiTextEditpublic MultiTextEdit(int offset, int length) Creates a newMultiTextEditfor the given range. Adding a child to this edit which isn't covered by the given range will result in an exception.- Parameters:
- offset- the edit's offset
- length- the edit's length.
- See Also:
 
- 
MultiTextEdit
 
- 
- 
Method Details- 
checkIntegrityChecks the edit's integrity.Note that this method should only be called by the edit framework and not by normal clients. This default implementation does nothing. Subclasses may override if needed. - Throws:
- MalformedTreeException- if the edit isn't in a valid state and can therefore not be executed
 
- 
getOffsetpublic final int getOffset()Description copied from class:TextEditReturns the offset of the edit. An offset is a 0-based character index. Returns-1if the edit is marked as deleted.
- 
getLengthpublic final int getLength()Description copied from class:TextEditReturns the length of the edit. Returns-1if the edit is marked as deleted.
- 
coversDescription copied from class:TextEditReturnstrueif the edit covers the given editother. It is up to the concrete text edit to decide if a edit of length zero can cover another edit.
- 
canZeroLengthCoverprotected boolean canZeroLengthCover()Description copied from class:TextEditReturnstrueif an edit with length zero can cover another edit. Returnsfalseotherwise.- Overrides:
- canZeroLengthCoverin class- TextEdit
- Returns:
- whether an edit of length zero can cover another edit
 
- 
doCopyDescription copied from class:TextEditCreates and returns a copy of this edit. The copy method should be implemented in a way so that the copy can executed without causing any harm to the original edit. Implementors of this method are responsible for creating deep or shallow copies of referenced object to fulfill this requirement.Implementers of this method should use the copy constructor This method should not be called from outside the framework. Please useEdit#Edit(Edit source) to initialize the edit part of the copy. Implementors aren't responsible to actually copy the children or to set the right parent.copyto create a copy of a edit tree.
- 
accept0Description copied from class:TextEditAccepts the given visitor on a type-specific visit of the current edit. This method must be implemented in all concrete text edits.General template for implementation on each concrete TextEdit class: 
 Note that the caller (boolean visitChildren= visitor.visit(this); if (visitChildren) { acceptChildren(visitor); }accept) takes care of invokingvisitor.preVisit(this)andvisitor.postVisit(this).
 
-