Hi,
I added filters (i.e. a class that extends ViewerFilter) to both a TableViewer and a CheckboxTreeViewer and it works OK. Now I need to get the elements that are displayed after the filter was applied. But I was surprised I couldn't find any method for this in viewer (while you have methods to get selected elements or checked elements).
Finally I could do it by calling viewer.getTable().getItems()
or viewer.getTree().getItems()
and then calling getData method for each item.
Something like this for example with a TableViewer :
List<Rejet> rejets = new ArrayList<Rejet>();
for (TableItem item : viewer().getTable().getItems()) {
rejets.add((Rejet) item.getData());
}
It works but I don't find this very pretty ... And it can turn complex when you need to iterate on a tree for example to get all elements ! Is it the only way to do this ? Or did I miss something ?
Regards,
Olivier
[Updated on: Wed, 10 March 2010 16:47]
Report message to a moderator