我现在想的是直接在tableviewer上直接编辑
继承EditingSupport TableViewerColumn col = createTableViewerColumn(titles[0], bounds[0], 0); col.setEditingSupport(new RevisionEditingSupport(viewer)); public class QuantityEditingSupport extends EditingSupport { private final TableViewer viewer; public QuantityEditingSupport(TableViewer viewer) { super(viewer); this.viewer = viewer; } @Override protected CellEditor getCellEditor(Object element) { return new TextCellEditor(viewer.getTable()); } @Override protected boolean canEdit(Object element) { return true; } @Override protected Object getValue(Object element) { return ((Indent) element).getQuantity(); } @Override protected void setValue(Object element, Object value) { ((Indent) element).setQuantity(Integer.parseInt(value.toString())); viewer.refresh(); } } 为什么不能编辑表格啊,这一列是int类型,但是String类型列可以编辑,谢谢 |