views:

186

answers:

1

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.

+1  A: 

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);
thehiatus
Thanks, this might be what I need. Will be trying this today...hope I can check that green checkbox for you
PSU_Kardi
I ended up doing it a bit different by making a CellModifier that implements ICellModifierJust wish I could find something better than canEdit - like actually grey out the field
PSU_Kardi