|
org.netbeans.modules.editor.lib2/1 1.43.1 10 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.spi.editor.typinghooks.TypedTextInterceptor.Context
org.netbeans.spi.editor.typinghooks.TypedTextInterceptor.MutableContext
public static final class TypedTextInterceptor.MutableContext
This context class allows to modify the insertion text and the caret position
after the text is inserted into a document. Apart from that it provides exactly the same
information as its superclass Context
.
Method Summary | |
---|---|
String |
getText()
Gets the insertion text. |
void |
setText(String text,
int caretPosition)
Sets the insertion text and adjusted caret position. |
Methods inherited from class org.netbeans.spi.editor.typinghooks.TypedTextInterceptor.Context |
---|
getComponent, getDocument, getOffset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public String getText()
TypedTextInterceptor.Context
It is guaranteed that the text will have length equal to 1 for contexts
that are passed to beforeInsert
and insert
methods. In these methods getText
returns exactly what
a user typed in the editor.
In the afterInsert
method the text returned from getText
method can have any length and will correspond to either the originally typed
text or to text supplied by one of the interceptors participating in
the key typed event processing.
getText
in class TypedTextInterceptor.Context
public void setText(String text, int caretPosition)
There is no restriction on the new text
set by this method, except that it must not be null
. It can
be of any length (including an empty string) and can even span multiple lines.
It is important to remember that the adjusted caret position is
relative to the new text. Therefore valid values for the caretPosition
parameter are <0, text.getLength()>
! The adjusted position
is not a document offset.
text
- The new text that will be inserted to a document.caretPosition
- The adjusted caret position inside the new text.
This position is relative to the new text. Valid values for this parameter
are <0, text.getLength()>
.
|
org.netbeans.modules.editor.lib2/1 1.43.1 10 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |