public class MultiTextEdit extends TextEdit
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.
CREATE_UNDO, NONE, UPDATE_REGIONS
Modifier | Constructor and Description |
---|---|
|
MultiTextEdit()
Creates a new
MultiTextEdit . |
|
MultiTextEdit(int offset,
int length)
Creates a new MultiTextEdit for the given
range.
|
protected |
MultiTextEdit(MultiTextEdit other) |
Modifier and Type | Method and Description |
---|---|
protected void |
accept0(TextEditVisitor visitor)
Accepts the given visitor on a type-specific visit of the current edit.
|
protected boolean |
canZeroLengthCover()
Returns
true if an edit with length zero can cover
another edit. |
protected void |
checkIntegrity()
Checks the edit's integrity.
|
boolean |
covers(TextEdit other)
Returns
true if the edit covers the given edit
other . |
protected TextEdit |
doCopy()
Creates and returns a copy of this edit.
|
int |
getLength()
Returns the length of the edit.
|
int |
getOffset()
Returns the offset of the edit.
|
accept, 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
public MultiTextEdit()
MultiTextEdit
. 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.public MultiTextEdit(int offset, int length)
offset
- the edit's offsetlength
- the edit's length.TextEdit.addChild(TextEdit)
,
TextEdit.addChildren(TextEdit[])
protected MultiTextEdit(MultiTextEdit other)
protected void checkIntegrity() throws MalformedTreeException
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.
MalformedTreeException
- if the edit isn't in a valid state
and can therefore not be executedpublic final int getOffset()
-1
if the edit
is marked as deleted.public final int getLength()
-1
if the edit is marked as deleted.public final boolean covers(TextEdit other)
true
if the edit covers the given edit
other
. It is up to the concrete text edit to
decide if a edit of length zero can cover another edit.protected boolean canZeroLengthCover()
TextEdit
true
if an edit with length zero can cover
another edit. Returns false
otherwise.canZeroLengthCover
in class TextEdit
protected TextEdit doCopy()
TextEdit
Implementers of this method should use the copy constructor
This method should not be called from outside the framework.
Please use
Edit#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.
copy
to create a copy of a edit tree.
doCopy
in class TextEdit
TextEdit.copy()
,
TextEdit.postProcessCopy(TextEditCopier)
,
TextEditCopier
protected void accept0(TextEditVisitor visitor)
TextEdit
General template for implementation on each concrete TextEdit class:
boolean visitChildren= visitor.visit(this);
if (visitChildren) {
acceptChildren(visitor);
}
Note that the caller (accept
) takes care of invoking
visitor.preVisit(this)
and visitor.postVisit(this)
.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.