如何使用Eclipse Nebula Grid在Eclipse插件中创建用户输入字段?

问题描述 投票:0回答:1

我只是想创建一个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
  }

这段代码产生了这个:

enter image description here

如您所见,我可以手动设置单元格中的文本,但我希望用户能够编辑它。

java eclipse eclipse-plugin nebula
1个回答
1
投票

在Eclipse Nebula Grid中,GridEditor用于可编辑细胞。

code snippet gives an example of how to use the GridEditor

© www.soinside.com 2019 - 2024. All rights reserved.