I was particularly interested in Ramón's plug-in module because, sometime ago, I worked on something very similar, see Further Search Facilities for NetBeans IDE 5.0 for details. In that plug-in module, I was able to select a search egnine from a drop-down list and then send the current line to the selected search engine. At the time, I wanted to also be able to send a word—i.e., not just a line—but didn't know how to do that. In the meantime, I've learnt from Ramón's plug-in module and, as a result, have been able to extend my own (the screenshot below not only shows the user interface added by the plug-in module, but also the code that makes the word selected possible):
I basically used Ramón's code verbatim, just as I found it in his source code. However, the code used here seems pretty different to what is prescribed in the FAQ: How do I get the element under the caret?. I actually wanted to use that code, because it seemed 'prescribed' while I wondered about Ramón's code and didn't really know which was 'better', but the problem was that I would then have ended up with conflicting import statements. The code in the FAQ has this line:
Element el = resource.getElementByOffset(offset);
That line requires org.netbeans.jmi.javamodel.Element, while earlier in the code I had made use of javax.swing.text.Element. Since I couldn't use both of these packages in the same class (and didn't want to create a new one), I used Ramón's solution instead. And it works.
Next, I'm going to take a look at Ramón's addition to the Options window. It's pretty cool—if you don't like the selection of search engines that the plug-in module provides, you can simply add additional ones. Thanks a lot Ramón—your plug-in module provides exactly the kind of source code I've been needing to understand the NetBeans APIs better and to extend my own plug-in module further!