user1205079
user1205079

Reputation: 405

Adding none editable new row to SWT/jface table

Is there an option to make one row in swt table not editable after adding it ,(and the other rows still editable)

I am adding new row in this way.

Table table = tableViewer.getTable();
tableViewer.add(rowElement);
table.setTopIndex(table.getItemCount());
table.select(table.getItemCount() - 1);

Thanks.

Upvotes: 0

Views: 1317

Answers (1)

Baz
Baz

Reputation: 36884

I guess you are using your TableViewer with an EditingSupport (if not, read this).

The EditingSupport has a method canEdit(Object object). You can use the following to prevent editing of a given cell:

@Override
protected boolean canEdit(Object element) {
    YourObject obj = (YourObject)element;
    if(IT_IS_THE_ELEMENT_YOU_SEEK)
        return false;
    else
        return true;
}

Upvotes: 2

Related Questions