So here it is without any changes (better late then never):
Recently I had to find a way to embed GMF into a multipage editor. I had the experience with GMF, but I didn't know how to create a multipage editor, however, it went pretty easy and straightforward. For this short tutorial I will use the multipage editor example described here and the GMF MindMap example (you can check out the source code from the CVS). What we want to achieve it to embed the GMF editor into the first page of the exemplary multipage editor. If you follow the steps below you should get the desired result.
- In org.eclipse.ui.examples.multipageeditor project find MultiPageEditorExample class and copy it to the org.eclipse.gmf.examples.mindmap.diagram.part package of org.eclipse.gmf.examples.mindmap.diagram project. There will be some error, but we will take care of them later on.
- In MultiPageEditorExample you will find field private TextEditor editor; change it's type to MindmapDiagramEditor which is the class of GMF editor. Also in the method MultiPageEditorExample#createPage0 change the constructor call for the field editor.
- Let's look now at the errors - they are mostly connected to MessageUtil class, which we simply don't have in our GMF project, however, we need some strings to pass them to the methods - we can put there any string we find appropriate (and later of course we can externalise those strings).
- Now there should be only one error left. To get rid of it we can just comment out the method MultiPageEditorExample#sortWords and every call of this method.
- For this moment we shouldn't see any errors in out diagram project. Now we have to change the editor class that is defined in the plugin.xml of org.eclipse.gmf.examples.mindmap.diagram project. Open the file, go to the Extensions tab, go to org.eclipse.ui.editors and there you should find one entry with the editor definition. Change the class attribute to point to our multipage editor (class MultiPageEditorExample).
- Here it is! You should see the editor semillar to the one on the screenshot below:
I know that this is the dirty way, but if you need to do this fast, or you don't know how to start then I guess this can be a good starting point.