|
SWT LPEX v3.0.5 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface LpexDocumentListener can be implemented to listen to text changes and adjustments in the document. In general, the document-parser calls are sufficient for applications that use the LPEX widget, and this specialized listener is not needed. The performance overhead of creating this listener's notifications should be taken into consideration before using it. It is mainly intended for internal use inside the editor, and the definition of notifications may change in future releases.
The information provided applies to the entire text of the line, i.e., including the sequence numbers, if set. No notifications are sent for show elements (such as document parser error-message lines).
Certain editing operations may trigger several consecutive notifications for one change which has already been recorded in the text of an element. For example, one replaceText command may trigger notifications indicating the text replaced, the text inserted beyond the end of the original line, and a sequence-numbers text part change.
Create a listener object using this class, and then register it with a
document view using, for example, LpexView's addLpexDocumentListener()
method. When text changes occur in the currently-loaded document section,
the appropriate method in the listener object is invoked.
Example:
lpexView.addLpexDocumentListener(new LpexDocumentListener() { // document text change public void documentChanged(LpexView view, int type, int line, int position, int count) { handleDocumentChange(view, type, line, position, count); } }); |
LpexView.addLpexDocumentListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.removeLpexDocumentListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.addLpexDocumentAdjustListener(com.ibm.lpex.core.LpexDocumentListener)
,
LpexView.removeLpexDocumentAdjustListener(com.ibm.lpex.core.LpexDocumentListener)
Field Summary | |
---|---|
static int |
ELEMENT_INSERTED
This notification is sent when a text element is inserted in the document. |
static int |
ELEMENT_REMOVED
This notification is sent when a text element is deleted from the document. |
static int |
ELEMENT_REPLACED
This notification is sent when a text element is replaced in the document. |
static int |
END_CHANGES
This informational notification is sent to indicate the end of the series of non-overlapping changes. |
static int |
START_CHANGES
This informational notification is sent to indicate the start of a series of non-overlapping changes. |
static int |
TEXT_INSERTED
This notification is sent when text is inserted in a text element. |
static int |
TEXT_REMOVED
This notification is sent when text is deleted in a text element. |
static int |
TEXT_REPLACED
This notification is sent when text is replaced in a text element. |
Method Summary | |
---|---|
void |
documentChanged(LpexView lpexView,
int type,
int line,
int position,
int count)
This method is invoked when a text event occurs in the LPEX document. |
Field Detail |
public static final int TEXT_REMOVED
public static final int TEXT_REPLACED
public static final int TEXT_INSERTED
public static final int ELEMENT_REMOVED
public static final int ELEMENT_REPLACED
public static final int ELEMENT_INSERTED
public static final int START_CHANGES
public static final int END_CHANGES
Method Detail |
public void documentChanged(LpexView lpexView, int type, int line, int position, int count)
lpexView
- the view of the editor document that triggered the
notificationtype
- notification typeline
- document line affected (defined inside the document section
that is currently loaded in the editor), or
0 for informational notificationsposition
- first change position inside the line, or
0 for element and informational notificationscount
- character count of the change in the line, or
0 for element notifications, or
0 for informational notifications
|
SWT LPEX v3.0.5 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |