Question

Anyone know if it's possible to enable/disable individual JFace TextCellEditor fields.

For instance if I have a table with 5 columns, I want the last cell to be empty unless field #4 is filled in.

Was it helpful?

Solution

If you're using the EditingSupport class, you can set canEdit to return true.

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top