Finding the right format for users to edit and view your Eclipse plugin’s data can be tricky. Eclipse provides many different types of editors for modification of its resources. Some examples of these are the Java, Text, JSP, XML, Ant editor etc. It also provides tabbed editors like the Plug In Manifest Editor which can have multiple sub editors as tabs in one editor. A simple example template to extend the tabbed editor when creating a new plug-in, is provided in Eclipse by default. For our project we needed to add a compare editor and a GEF editor as sub editors. This post should help you become more familiar with creating custom tabbed editors in Eclipse.
Editor Input
The example provided in Eclipse uses the same EditorInput for all the sub editors. This allows the same information (from the EditorInput) to be displayed and edited differently in each sub-editor. This works fine when all the editors are closely related and a single EditorInput can take care of all the resources in different tabs. If this is not the case, for any particular editor you can provide a customized EditorInput class which implements the IEditorInput interface.
Adding a GEF editor to the MultiPageEditor is not the hard part. You can simply add a GEF editor in one of the createPage methods in the MultiPageEditor. The interesting part is getting GEF to interact correctly with the UI and user commands. Below are some issues and fixes commonly seen while working with GEF in MultiPageEditors.
Selection Event issues
When embedding a GEF editor the first issue you will face is that the selections will not work properly. This is due to the fact that the selection listeners for the GEF editor are not correctly notified of events because it is nested inside the MultiPageEditor. You can do the following to fix this issue.