how to add a GEF editor to my multiplePage Editor? (eclipse RCP)
I would like to add a GraphicalEditor to a multipage editor. However, when I simply call
addPage(new MyEditor())开发者_StackOverflow社区;
inside addPages(), I have an error since. Since my GEF editor extends GraphicalEditor, it cannot extend also FormPage. So, I made it implement IFormPage. But, I still get errors, actually it says that the editor that I'm using for the multipage editor cannot be cast to the one that corresponds to the my graphical editor.
So, finally How can we add a GEF editor to the multipage editor?
Any hint please to solve that?
These are steps that I have done to add gef editor to multipage editor successfully:
Extend org.eclipse.ui.part.EditorPart that have org.eclipse.gef.ui.parts.ScrollingGraphicalViewer as a member.
public class GraphEditorPage extends EditorPart { private SPEEditor editor; private ScrollingGraphicalViewer viewer; ... }
In method
createPartControl
you need to layout the editor part, in my case, I did it with a SashForm as parent component, after that, create controls for you graphical viewer on parent component.In method
createPages()
, create an GraphEditorPage and add itprivate void initGraphPage() { graphPage = new GraphEditorPage(this); addPage(0, graphPage, "Diagram"); }
Hope this help!
精彩评论