Sunday January 22, 2006
Send Text from the Editor to Google
One reason why I've been eagerly awaiting Sandip's plug-in module for line tools is that I wanted to explore the sources. When Ludo first blogged about his Google toolbar for NetBeans IDE, I thought: "Hmmm. I wonder if it would be possible to do the search straight from the editor, rather than from a textfield in the toolbar." But, unfortunately, I didn't know enough about the editor to work out how to do it. Then, recently, Sandip made the sources of his line tools available in Contrib (they're also downloadable from his blog, by the way). And so now I've been able to marry Ludo's work with Sandip's. Check out the new "Send Line to Google" toolbar button below:
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):
http://blogs.sun.com/roller/resources/geertjan/updates_geertjan.xml
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.)
Jan 22 2006, 06:54:29 AM PST Permalink


