任何人都知道是否可以启用/禁用单个Jface TextCelleditor字段。

例如,如果我有一个带有5列的表,我希望最后一个单元格为空,除非填充字段#4。

有帮助吗?

解决方案

如果您使用的是editingsupport类,则可以设置 canEdit 返回真。

TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); 

EditingSupport editingSupport = new EditingSupport(viewer) 
{
    ... implement abstract methods ...

    protected boolean canEdit(Object element)
    {
        return (/* criteria to determine if this column is editable*/)
    } 
}; 

column.setEditingSupport(editingSupport);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top