开发者

JFace TableViewer - Format cells depending on other cells

开发者 https://www.devze.com 2022-12-15 04:08 出处:网络
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 w

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消