Example - RCP Text Editor
Introduction
The RCP Text Editor Example shows how to create a text editor for an RCP application.
Features demonstrated by the example RCP text editor
- creating a simple text editor application along the lines of the eclipse.org RCP tutorial,
- implementation of a basic text editor based on
AbstractTextEditor
,
- implementation of a document provider based on
AbstractDocumentProvider
that operates on IPath
as editor input,
- adding the most common actions to the application menu and toolbar,
- adding a simple xml editor based on the eclipse example project, offering syntax highlighting.
Classes
package org.eclipse.ui.examples.rcp.texteditor
TextEditorApplication
- an application to be run, see the eclipse.org RCP tutorial for more details.
TextEditorPerspective
- a default perspective to be opened, see the eclipse.org RCP tutorial for more details.
TextEditorWorkbenchAdvisor
- configures the basic workbench behavior: top level window style, title and icon.
package org.eclipse.ui.examples.rcp.texteditor.actions
TextEditorActionBarAdvisor
- creates the actions typically seen in a text editor and sets up the menu and toolbar.
OpenFileAction
- action to open a file, which is not present as such in the eclipse IDE. The code is copied and modified from OpenExternalFileAction
.
package org.eclipse.ui.examples.rcp.texteditor.editors
SimpleEditor
- a simple text editor. All it does is setting the document provider and removing the smart insert mode.
SimpleDocumentProvider
- a simple document provider that takes IPath
as editor input elements. It can open and save to files pointed to by IPath
s. It also simplifies the read-only / state validation for basic usage without version control.
PathEditorInput
- an editor input implementing IPathEditorInput
.
package org.eclipse.ui.examples.rcp.texteditor.editors.xml
This package is copied as is from the example editor available from eclipse. The only thing that was changed are to let XMLEditor
and XMLDocumentProvider
inherit from SimpleEditor
and SimpleDocumentProvider
, respectively.
plugin.xml
The plugin.xml
manifest adds the application, the perspective, the two editors and the open action.