13.3. Customizing an Editor
You’ve created a new plug-in using a PDE wizard, and you want to customize the editor.
Customize the editor’s
If you followed the discussion over the previous two recipes, you
already have in hand a good template for a plug-in with an editor,
and customizing that template is easy. The editor is supported by two
MultiPageEditorContributor.java. The toolbar and
menu support is in
MultiPageEditorContributor.java, and the actual
Java support for the editor is in
In this example, we’ll take a look at the code for
MultiPageEditor.java and modify it. As it
stands, this code displays three pages: the text in the document
created by the plug-in’s wizard, a page that enables
you to select the display font, and a page that displays the words in
the document in sorted order. We don’t need all that
in our example; we’ll just make use of the first
page, which displays the text in the document in a text editor.
To display the text in the first page of the editor, the code uses an
editor. After creating that object, you can
addPage method to add the
new page to the editor. Here’s how it works; the
code starts by creating a new
MultiPageEditor class extends
MultiPageEditorPart, which uses an SWT tab control
to display multiple editor pages).
public class MultiPageEditor extends ...