Thursday 26 July 2012

Bragging

In this Post I ll brag about the the first question I answered on StackOverFlow.com. The best part is that my answer got accepted too.  Well The question was as follows:

I have been following the tutorial here. In the advanced tutorial ResourceSelectionHistory stores the selected items and the retrieves it when the dialog is relaunched. I wanted the ResourceSelectionHistory to store objects and not just strings, is there i way to do that. I also want the items to open in the editor when the user clicks on them. When I click on an item in the actual populated list it opens, but not when I click on the part showing history.

The person here wants to IMemento to tell him what type of object was stored in the History. As the person who first answered the question said that these classes are very restrictive. and they expect you to do only what they want you do do.

I have figured out a way that could be used to do what the questioner want: Follow along.....

You can store strings, integers and Boolean to IMemento. You can cleverly utilize them to reveal the type of object. For example you can use element.putInteger("objType", 1); if your object is of say type A and element.putInteger("objType", 2); if its of type B. Hope that helps.

ge33ek

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.







Tuesday 24 July 2012

Blast off................
Here I am starting my blog. This is the first entry of my blog. Nothing much to say now, but hold your breaths firmly as a tsunami of posts are about to come.

C yah!

ge33ek.