【发布时间】:2015-02-21 04:31:16
【问题描述】:
我目前正在开发一个显示 DOT-Graphs 的 Eclipse 插件。为此,我使用了this 插件。但是,我不知道如何实际显示我构建的图表。我想将它作为编辑器显示在 Eclipse 窗口的中间。
为了完成这项工作,我创建了一个自定义编辑器类,它需要在其 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?
}
【问题讨论】:
-
我认为您会遇到问题,因为 DotGraphView 被设计为位于
IViewSite中。它会调用getViewSite(),如果您将它嵌入到编辑器中,这将是一个问题。您可以提供自己的IViewSite实现以传递给它的init()方法并将大多数调用委托给您的IEditorSite,但不知道您是否会遇到任何进一步的问题。 -
如何使用普通视图实现这一点?发布答案,我会接受。
标签: eclipse-plugin swt dot zest