Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to get filtered elements in a viewer ?
How to get filtered elements in a viewer ? [message #519971] Wed, 10 March 2010 16:46
Olivier Thierry is currently offline Olivier ThierryFriend
Messages: 11
Registered: January 2010
Location: Nantes, France
Junior Member

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
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 ?



[Updated on: Wed, 10 March 2010 16:47]

Report message to a moderator

Previous Topic:Jface unit tests
Next Topic:Lazy Loading in JFace
Goto Forum:

Current Time: Mon Oct 05 08:50:57 GMT 2015

Powered by FUDForum. Page generated in 0.02315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software