When you click the toolbar button, the current line (or, if multiple lines are selected, the last line of the current selection) is sent to Google—if the default browser isn't open, it is opened, then the selection is sent to it, and Google returns the search results.
You too can play with this module (if you're using a post-5.0 development build, available from the download page on www.netbeans.org). Go to my Update Center, which is at the location below (see previous blog entries if you don't know how to register my Update Center):
There, in my Update Center, select the brand new Text API Sample:
After installation, you will have a new sample, in the usual place:
After doing the above you will, in addition to installing the Google search extension, be able look at the sources and extend my plug-in module with additional line-manipulation functionality. (You'll notice I've reproduced Sandip's framework in this module, so that extending it is very easy—extend AbstractLineAction and then add your new line operation to the LineOperations class.)