Package org.eclipse.jface.text
Class TextEvent
java.lang.Object
org.eclipse.jface.text.TextEvent
This event is sent to implementers of
ITextListener
. It represents a change applied
to text viewer. The change is specified as a replace command using offset,
length, inserted text, and replaced text. The text viewer issues a text event
after the viewer has been changed either in response to a change of the
viewer's document or when the viewer's visual content has been changed. In
the first case, the text event also carries the original document event.
Depending on the viewer's presentation mode, the text event coordinates are
different from the document event's coordinates.
An empty text event usually indicates a change of the viewer's redraw state.
Clients other than text viewer's don't create instances of this class.
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
TextEvent
(int offset, int length, String text, String replacedText, DocumentEvent event, boolean viewerRedrawState) Creates a newTextEvent
based on the specification. -
Method Summary
Modifier and TypeMethodDescriptionReturns the corresponding document event that caused the viewer changeint
Returns the length of the event.int
Returns the offset of the event.Returns the text replaced by this event.getText()
Returns the text of the event.boolean
Returns the viewer's redraw state.
-
Constructor Details
-
TextEvent
protected TextEvent(int offset, int length, String text, String replacedText, DocumentEvent event, boolean viewerRedrawState) Creates a newTextEvent
based on the specification.- Parameters:
offset
- the offsetlength
- the lengthtext
- the inserted textreplacedText
- the replaced textevent
- the associated document event ornull
if noneviewerRedrawState
- the redraw state of the viewer
-
-
Method Details
-
getOffset
public int getOffset()Returns the offset of the event.- Returns:
- the offset of the event
-
getLength
public int getLength()Returns the length of the event.- Returns:
- the length of the event
-
getText
Returns the text of the event.- Returns:
- the text of the event
-
getReplacedText
Returns the text replaced by this event.- Returns:
- the text replaced by this event
-
getDocumentEvent
Returns the corresponding document event that caused the viewer change- Returns:
- the corresponding document event,
null
if a visual change only
-
getViewerRedrawState
public boolean getViewerRedrawState()Returns the viewer's redraw state.- Returns:
true
if the viewer's redraw state istrue
- Since:
- 2.0
-