Example - Multi-page Editor

Introduction

The  Multi Page Editor Example adds an editor for files with the .mpe extension. It shows how to create an editor that uses multiple pages by defining both an editor and a page contributor that can add entries to an action bar.

Running the example

To start using the Multi-page Editor Example, create a new file with .mpe extension.  Select the file, bring up the popup menu, select the Open With menu and from the sub-menu select the Multi Page Editor Example menu item. You can then select the different editors by selecting the different tabs.

Creating a new mpe file

Create a new file with file extension .mpe.  From the File menu, select New and then select Other... from the sub-menu.  Click on Simple in the wizard, then select
File in the list on the left.  Click on Next to supply the file name (make sure the extension is .mpe) and the folder in which the file should be contained.
 

Details

The  Multi Page Editor Example demonstrates how to create an multi page editor with a custom page contributor.

The Multi Page Editor Example is constructed with two extensions - a document contributor (MultiPageContributor) and an editor (MultiPageEditor). The document contributor is a subclass of org.eclipse.ui.part.MultiPageEditorActionBarContributor and defines the actions that are added to an editor when the setActivePage method is called. The editor is an org.eclipse.ui.part.MultiPageEditorPart that creates 3 pages whose activation is handled by the pageChange method that in turn sends setActivePage to the contributor. These two classes do not refer to each other directly - the contributor for the editor is set using the contributorClass tag in the plugin.xml