A typical stumbling block for newbies to Lookup goes like this: you've created a Result object and then set a LookupListener on that object. Now you're listening to the context (of the application or of a specific window) and then... nothing happens!
You then find yourself adding the line in bold below:@Overridepublic void componentOpened() { result = Utilities.actionsGlobalContext().lookupResult(Cust omer.class); result.addLookupListener(this); resultChanged(new LookupEvent(result));}
That line in bold is for the opening of the window. At that point, there's no change in the Lookup yet. So you manually call the resultChanged method, passing in 'null' or, more elegantly, a new LookupEvent with the current Result object.
However, in 6.9, a nice enhancement was added:
http://hg.netbeans.org/main-golden/rev/d032dfa7b3cf
In other words, adding the LookupListener is all you need to do. No need to call the resultChanged anymore. I tried that today, during the training with the students in Burkina Faso... and code that would not have worked in 6.8 (i.e., code without the last line in the method above), now works perfectly in 6.9.
Should make a big difference for newbies working with Lookup in the NetBeans Platform.
In other news. The training in Burkina Faso was a success for everyone involved. Patrick Honoré Ouoba, Hyacinthe Bosso Tingueri, Emmanuel Zimian Paregueba Ouedraogo, Oumar Abdou Nassur Konombo, Constantin Drabo, and Fatimazahra Hakkou are the latest NetBeans Platform Certified Associates. We're 'meeting' (Skype, plus WebEx) again in a month, to port one of their applications to the NetBeans Platform together.


Read More about [Enhanced Change Notifications for Lookup in NetBeans Platform 6.9...