我只是想创建一个Grid插件,可以让每个单元格由用户编辑。我找到了Eclipse Nebula,它看起来非常接近我想做的事情,除了我无法找到一种让细胞可编辑的方法。到目前为止,我有这样简单的事情:
public class SampleView2 extends ViewPart {
public SampleView2() {
}
public void createPartControl(Composite parent) {
// create Grid
Grid grid = new Grid(parent,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
grid.setHeaderVisible(true);
// create column
GridColumn col = new GridColumn(grid, 0);
col.setText("First Column");
col.setWidth(140);
// write text in row
GridItem item = new GridItem(grid, 0);
item.setText("This is my first cell"); // <--- I want the user to be able to edit this
}
这段代码产生了这个:
如您所见,我可以手动设置单元格中的文本,但我希望用户能够编辑它。
在Eclipse Nebula Grid中,GridEditor
用于可编辑细胞。
这code snippet gives an example of how to use the GridEditor
。