Geertjan's Blog

  • January 28, 2006

Further Search Facilities for NetBeans IDE 5.0

Geertjan Wielenga
Product Manager
In Send Text from the Editor to Google, I wrote about an extension to Ludo's Google Toolbar that lets you send lines of text to Google, straight from the Source Editor (i.e., no typing needed in the textfield in the toolbar). I've taken it a step further—now the user can select a search engine (Google, WebCrawler, Altavista, and DogPile):

When the user clicks the button in the toolbar, the default browser is opened, the selected search engine is found, and the current line in the Source Editor is sent to it. Eventually the NetBeans Progress API should be incorporated, but, until then, the following dialog box is displayed instead:

One thing I'm going to need to learn (probably from one of Sandip's great modules) is how to select a single word, instead of a line, from the Source Editor. And then I'll add a second button to the toolbar—the user won't only be able to select search engines but also whether the current word or the current line should be sent to the browser.

Join the discussion

Comments ( 7 )
  • Ludo Saturday, January 28, 2006
    Feel free to update the source code under contrib area of netbeans...
    Next step if to add google suggest output in NetBeans IDE Source Editor code completion area :-)
    Also, I just tried BlogEd tool, and it would be nice to have this simple html wysiwyg editor inside NetBeans...
  • Sandip Saturday, January 28, 2006
    I think when working in the source editor it is likely that the person wants to see the JavaDoc (or it equivalent for the language) for the symbol under the cursor. Therefore the integration with one those JavaDoc web sites will be very useful. In case of JavaEditor the semantic meaning/info (i.e. is it a Type, Field, Method declartion, Method call etc. etc.) of the symbol is available. That way even better integration could be achieved. For example:
    • Goto JavaDoc
    • Goto Specifications if it is one of the W3C, apache, sourceforge or JSR classes
    • java.net or JGuru faq/faq related to the symbol

    The possibilities are endless.

    The internet becomes the extension of the IDE.

    Good work Ludo and Geertjan.

  • Geertjan Sunday, January 29, 2006
    Ludo, this plug-in module is not meant to replace yours! It's different to yours -- I can see plenty of reasons why I would want to type my search string in a textfield. Therefore, I don't want to change your plug-in modules source code at all... it's fine the way it is. By the way, what is "google suggest output"?

    Sandip, that's a good idea. But what about the NetBeans APIs? I think the on-line NetBeans API JavaDoc could be used for that right? So, if my cursor is on "CallableSystemAction", then this page would be called up. Doing this for the NetBeans APIs seems more useful than for non-NetBeans APIs (at least, for the first version of this). Of course, when a user has installed NetBeans API JavaDoc, then the relevant JavaDoc is shown in the IDE, using standard JavaDoc keyboard shortcut, so maybe this would be superfluous.
  • guest Sunday, January 29, 2006
    Now a new great module of Sandip is out: MarkOccurrences. From his Listener.java:
    It seems to be the methods getFirstNonWhiteBwd and getFirstNonWhiteFw in combination with
    BaseDocument baseDoc = (BaseDocument) ed.getDocument();
    int offset = ed.getCaret().getDot();
    that lets you select a single word in the document.
    I am expecting impatiently now the update to your module :-)
  • Ramón Ramos Sunday, January 29, 2006 It was me.
  • sandip Sunday, January 29, 2006
    Yes. Of course for NetBeans API JavaDoc the JavaDoc keyboard shortcut makes perfect sense which should bring up the page you suggest.

    Google Suggest is an AJAX based Google search whereby Google Suggest box tells you the terms the search terms as you type your search criterion ala code completion in IDE. Check it out:


  • Ramón Ramos Sunday, January 29, 2006
    Sorry but I am moved. Even better in order to select the current word is the following method:
    org.netbeans.editor.Utilities.getWord(BaseDocument doc, int offset)
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.