JFace TableViewer - Format cells depending on other cells
I have a JFace TableViewer. The values in one column should normally be unique, but there are cases where it makes sense that they are not (e.g. when a row was copied and not yet changed). However I want to alert the user of the dup开发者_高级运维licate values by highlighting the rows which contain duplicate values in that column. What's the best way to do this? The LabelProvider seems to only give me access to the current cell or at most the current row.
Thanks, Thomas
To detect duplicate across the whole table, I guess you got to have some kind of map or set containing all the cell's data. The way I did was to put such map in the view (TableViewer container) and then have label provider holding a link to that view (hence the map). So from within label provider, it is able to detect duplicate and respond accordingly.
精彩评论