开发者

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:

  1. 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; ... }

  2. 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.

  3. In method createPages(), create an GraphEditorPage and add it

    private void initGraphPage() { graphPage = new GraphEditorPage(this); addPage(0, graphPage, "Diagram"); }

Hope this help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜