Embedding the StructuredTextEditor in a MultiPageEditor

by Phil Avery, IBM

Table Of Contents
  1. Requirements
  2. Getting Started
  3. Adding a Structured Text Editor page
  4. Test your page
  5. Other Tutorials

Required Plug-ins

Additional Required Plug-ins (other than from the example):

Use the new PDE plug-in project wizard to create a project: File > New > Project > Plug in project

I named the project "org.eclipse.wst.sse.examples.multipage"

Select the multipage editor example.

specify "xml" extension
Use the defaults for everything else

add prerequisite plug-ins to the META-INF/MANIFEST.MF file:

Adding the Structured Source Editor page

Open MultiPageEditor.java (the following changes based on XMLMultiPageEditorPart)
Replace the TextEditor type for field "editor" with a StructuredTextEditor type.

Override the createSite() method. Add this to MultiPageEditor.java:

 * @see org.eclipse.ui.part.MultiPageEditorPart#createSite(org.eclipse.ui.IEditorPart)
protected IEditorSite createSite(IEditorPart page) {
	IEditorSite site = null;
	if (page == editor) {
		site = new MultiPageEditorSite(this, page) {
			public String getId() {
				// Sets this ID so nested editor is configured for XML source
				return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
	else {
		site = super.createSite(page);
	return site;

Test your page

Create a new XML file. Add content to the file. You should get highlighting, content assist, source validation, etc...

You now have a basic multi-page editor with a Structured Text Editor source page!