我想将GraphicalEditor放入Eclipse RCP项目的GridLayout中,以便在其下面添加其他文本字段。如何让Eclipse GEF GraphicalEditor在GridLayout中正常工作?
问题是:当我这样做时,尽管将其周围的窗体GridData对象设置为grabExcessiveHorizontal(Vertical)Space = true(应尽可能宽地扩展其网格单元格),但编辑器将无法再自动适应其窗口以及horizontal/verticalAlignment = SWT.FILL(应尽可能宽地填充其单元格中的编辑器)。编辑器将有一个固定的大小,并不会随着它的窗口扩展,我不想要。
我用从本教程GEF例如:
https://www.inf.ed.ac.uk/teaching/courses/ip/resources/GEF/GEF_Tutorial_2up.pdf
我修改了代码从教程试图设置在方法的createPartControl(复合父级)的布局以下列方式...
@Override
public void createPartControl(Composite parent){
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
Form form = toolkit.createForm(parent);
Composite body = form.getBody();
//FillLayout fillLayout = new FillLayout();
//fillLayout.marginHeight = 15;
//fillLayout.marginWidth = 15;
GridLayout formLayout = new GridLayout();
formLayout.marginHeight = 15;
formLayout.marginWidth = 15;
GridData formData = new GridData(SWT.FILL,SWT.FILL, true, true);
body.setLayout(formLayout);
body.setLayoutData(formData);
body.setBackground(new Color(parent.getDisplay(),255,0,0));
super.createPartControl(body);
}
...产生下述(i有色形式的身体问题的更好的可见性):
http://g10vz.de/files/graphicaleditorgridlayout.png
为什么编辑不符合表格?或者我对SWT GridLayout的行为期望有误?当使用FillLayout时,如注释掉的行所示,编辑器按照需要行事。
问候
的的GridData必须使用网格布局的** **孩子综合的设置
问候 - 想必他们在'super.createPartControl创建(体)' –