Text editors and platform text
The platform text facility is used to implement the default text editor for
the workbench. The interface for text editing is defined in
ITextEditor
as a text specific extension of
IEditorPart.
The implementation of
ITextEditor
in the platform is structured in layers.
AbstractTextEditor
is the core class of the framework for extending the editor to support source code style
editing of text. This framework is defined in
org.eclipse.ui.texteditor.
The concrete implementation class
TextEditor
defines the behavior for the standard platform text editor. It is
defined in the package
org.eclipse.ui.editors.text
.
The text editor framework provides a model-independent editor that
supports the following features:
- presentation and user modification of text
- standard text editing operations such as cut/copy/paste, find/replace
- support for context and pulldown menus
- visual presentation of text annotations in rulers or as squigglies in the
text
- automatic update of annotations as the user edits text
- presentation of additional information such as line numbers
- syntax highlighting
- content assist
- text outlining pages that show the hierarchical structure of the text
- context sensitive behavior
- hover support over rulers and text
- key binding contexts
- preference handling
We will explore how these features can be implemented in an editor by
studying the org.eclipse.ui.examples.javaeditor
example. This example shows how complex features like text coloring, hover help, and
automatic indenting can be implemented.
In discussing these features we will be moving between the abstract
framework, the platform editor
TextEditor,
and the example's subclass, JavaEditor.