在eclipse中显示ViewPart

时间:2015-02-18 17:12:32

标签: eclipse-plugin swt dot zest

我目前正在开发一个显示DOT-Graphs的eclipse插件。为此,我使用了this插件。但是,我不知道如何实际显示我构建的图形。我想将它作为编辑器显示在eclipse窗口的中间。

为了完成这项工作,我创建了一个自定义的Editor类,它需要在其createPartControl(Composite)代码中使用一些代码才能使用插件提供的DotGraphView。

问题是,我该如何显示这个DotGraphView? 我的编辑器的代码如下所示:

@Override
public void createPartControl(Composite container) {
    DotImport importer = new DotImport(TEST_GRAPH);
    Graph graph = importer.newGraphInstance();
    DotGraphView dotGraphView = new DotGraphView();
    dotGraphView.setGraph(graph);

    // add dotGraphView as a child to container and display it
    // What todo here?
}

1 个答案:

答案 0 :(得分:0)

要在您自己的自定义视图中使用图表,请查看ZestFxUiView的超级类DotGraphView的实现。您可以将ZestFxUiView子类化,并使用图形对象调用setGraph