【问题标题】:How to create user input field in Eclipse plugin using Eclipse Nebula Grid?如何使用 Eclipse Nebula Grid 在 Eclipse 插件中创建用户输入字段?
【发布时间】:2019-07-14 11:54:20
【问题描述】:

我只是想创建一个网格插件,可以让用户编辑每个单元格。我找到了 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
  }

这段代码产生了这个:

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

【问题讨论】:

    标签: java eclipse eclipse-plugin nebula


    【解决方案1】:

    在 Eclipse Nebula Grid 中,GridEditor 用于可编辑单元格。

    这个code snippet gives an example of how to use the GridEditor

    【讨论】:

      猜你喜欢
      • 2014-06-07
      • 1970-01-01
      • 1970-01-01
      • 2015-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多