Search code examples
eclipsejfacetableviewer

Refresh only one column/cell from a SWT / JFace TableViewer


I currently have a big table (aprox 1000 rows) and about 20 columns. Out of the 20 columns I need one to be refreshed once every 2-3 seconds ( holds elapsed time from the object creation ) , i have tried this by refreshing the whole table every 3 seconds but because of so many rows it is a big performance penalty this whole table refresh.

Anyone seen a way to refresh only one cell / one column in JFace tableviewer ?? I need that one elapsed time column refresh and that's it.

Any help is greatly appreciated.

Thanks Mircea


Solution

  • I see TableViewer didn't expect to refresh just one cell in a row.

    AbstractTableViewer
    protected void doUpdateItem(Widget widget, Object element, boolean fullMap)
    

    you need to override the above method. Current implementation refreshes the entire row ( basically invokes LabelProvider on each cell)

    you can follow the same implementation but invoke update on specific ViewerCell