在子复合中嵌入热情图

时间:2012-01-28 18:10:19

标签: eclipse zest

我在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中设置配置的方法以及更改父组件的方法。有可能这样做吗?

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:0)

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