我有一个 Eclipse RCP 应用程序,想要在TableViewerusing ColumnWeigthDataas中使用动态列大小ColumnLayoutData。问题是,每当我布局表格时,父表单(ScrolledForm在示例代码中)都会增加几个像素。
要重现,您可以运行该示例并打开/关闭该部分几次。每次关闭时,该部分都会变得更宽。
为什么会这样?我怎样才能让它停止?
package com.test;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
public class TestShell extends Shell {
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
private final Table table;
public static void main(final String args[]) {
try {
final Display display = Display.getDefault();
final …Run Code Online (Sandbox Code Playgroud)