0

我在 Eclipse 中有一个 ViewPart,我想添加多个组合,每个热图一个(可以由用户选择性地查看或隐藏)以及控件、标签和组合框。我一直在使用 mxgraph 来做这件事,但是 mxgraph 与 eclipse ViewPart 不完全兼容,所以我想切换到 Zest。

我试图创建一个热情图并将其添加到嵌入式复合材料中:

m_swtAwtComponent1 = new Composite(m_parentComposite, SWT.EMBEDDED);
m_swtAwtComponent1.setLayoutData(grid);
viewer = new GraphViewer(m_swtAwtComponent1, SWT.NONE);

但这不起作用。

此外,我希望在 zest Graph 或 GraphViewer 上“喜欢”一种方法,该方法允许我在 GridLayout 中设置配置以及更改父组件的方法。是否有可能做到这一点?

4

2 回答 2

0

这篇文章http://lowcoupling.com/post/58916245720/integrating-zest-with-xtext提供了关于如何创建描绘 Zest Graph 的 Eclipse 视图的详细解释和代码。在http://lowcoupling.com/post/58705347913/defining-a-work-breakdown-structure-through-the-wbs中有一个如何使用它的示例。

于 2013-08-22T09:51:14.407 回答
0

无法更改父组件 - 这是 SWT 决定。

但是,如果我正确理解您的任务,您可以创建一个SWT SashForm,并将其用作 Zest 图形及其对应的带有 Combos 的 Composite 的容器。SashForm 也有一个 API 来将其 Sashes 之一设置为唯一可见的组件(使用 setMaximizedControl 方法)。

因此,您需要以下内容(未在编辑器中检查,仅显示基本思想:

SashForm form = new SashForm(parent, SWT.HORIZONTAL);
viewer = new GraphViewer(form, SWT.NONE);
//Note that no layout is set here!
Composite controls = new Composite(form, SWT.NONE);
//TODO load your control widgets inside this composite
form.setWeights(new int[]{2,1}); //Making the graph use more area then the widgets
于 2012-06-09T11:34:01.473 回答