Wednesday 25 July 2012

Refreshing content provider of FilteredItemsSelectionDialog

I have written a dialog extending filtered items selection dialog of eclipse. This dialog has few check boxes int the view menu. I wanted to display the content depending on the condition specified in the view menu.
When I actually started doing what I wanted I didn't have a clue how to do it.
Like any other wannabe coder I asked Mr Google if he could help me in doing what I wanted, and to my utter astonishment Mr Google said: Dude  I ain't gotta clue either.
How ever I did ultimately figure it out thanks to a colleague.  I have decided now that i ll let the world know how to do it, so that the next time somebody asks Mr Google, he does have a proper answer.

First of all you have to extend the ViewerFilter class, call it MyViewerFilter and over ride the method select() to suit our need.

Second: In the run() method of action call addListFilter(filter); where filter is an object of the typeMyViewerFilter than call scheduleRefresh();



Doing That will update the content provider with every click on the check box.







No comments:

Post a Comment