Hidden NetBeans Feature: Search In Editor Selection

Probably this is obvious to many people, but when I first discovered it I was quite (pleasantly) surprised. When you select a section of code in an editor, you can search within that particular selection:

Here I selected a paragraph (which could have been anything, e.g., a block of code in the Java editor or a subset of words within a paragraph), then pressed Ctrl-F (which is "Find"), which puts my cursor in the small Find area in the bottom left of the screenshot above. Then I type "if", since that's the word I want to find and now, only within the selected text (e.g., not the "if" in the next paragraph above, since that paragraph wasn't selected), all the instances of the word "if" are found and then I can toggle forwards and backwards with F3/Shift-F3.

And all within whatever was selected when Ctrl-F was pressed. Then you can do a replace of all found items, i.e., only within a particular selection.

Tried and failed to do the same thing in IntelliJ IDEA Community Edition 10.5, while in Eclipse Indigo a Find/Replace dialog pops up with the "Scope" automatically set to "Selected Lines". So, in that respect, Eclipse appears to be better than IntelliJ IDEA, though I still prefer not having to use a dialog, which is what NetBeans supports, i.e., the Find/Search bar is integrated into the editor itself, as can be seen from the screenshot above.

Comments:

I agree that the Find feature is better in NetBeans than the competition. Of course, NetBeans is the best Java IDE out there so that's to be expected! :-)

Thanks for the tip!

Posted by guest on January 18, 2012 at 10:45 AM PST #

This is normal behavior in Eclipse since its beginnings.
And having worked a long time with both, Eclipse and NetBeans, the statement that NetBeans is best is so wrong, at least under Windows. Very slow, memory hungry, uncomfortable, bad SVN client...
I'm wondering atm. how I can get back the search dialog instead of the search bar in NB 7.1, which always focuses in the "replace" and not in the "search" section on CTRL+F.

Posted by guest on January 30, 2012 at 03:39 AM PST #

Are you using NetBeans IDE 7.1?

Posted by Geertjan on January 30, 2012 at 06:57 AM PST #

This appears to be broken in 7.1.1

Posted by guest on April 03, 2012 at 09:06 AM PDT #

I agree with guest. I can't get this to work in v. 7.1.1.

Posted by Ian Hunter on April 30, 2012 at 04:56 PM PDT #

Can you describe the steps you're taking? It's working fine for me.

Posted by Geertjan on April 30, 2012 at 05:29 PM PDT #

Works also fine for me at

Product Version: NetBeans IDE 7.1 (Build 201112071828)
Product Version: NetBeans IDE 7.1.2 (Build 201204101705)

Other details:
Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM 20.5-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)

Posted by guest on May 03, 2012 at 11:43 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today