Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Adding Listener to the TextEditor of Eclipse

Adnan,

Depending on what you want to do, you might be interested in model changes
(i.e. changes of the text presented in the text editor) and presentation
changes (i.e. changes of the cursor position, selection, mouse pointer
selection, color changes, etc.).

Internally, Eclipse text editors work on documents (IDocument). Documents
are generated based on the editors' input elements. Responsible for this
generation is a document provider (IDocumentProvider). Each text editor has
a reference to one. If you want to access an editor's document, you can ask
the document provider for the document of the input element of the editor.
Documents support document listeners. The listeners are notified about all
textual changes applied to the document.

For presentation changes you need to register the appropriate listeners
with the text widget the editor uses in its implementation. You get access
to it in subclasses by asking the editor's source viewer for its text
widget.

Kai



Back to the top