This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 141777 - Java Search
Summary: Java Search
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker with 1 vote (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-26 16:31 UTC by qbeukes
Modified: 2016-03-25 13:28 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qbeukes 2008-07-26 16:31:55 UTC
This feature is invaluable. It's gold. It's platinum. It's one of the features I probably benefit from the most, and
saves me TONS of time. Since I first discovered it, I don't know how I could ever live without it.

It's one of the reasons I don't use netbeans.

However, netbeans has a fantastically high quality when it comes to their modules, ex. JSF, servers, EJB, UML, etc.

To get an idea of how Java Search works, have a look at Eclipse. Open a project, select a method (place the cursor on
it), goto the search menu/dialog and select Java search.

This allows you to search the project/workspace for the specific item you selected. An example would be selecting the
variable in the class "com.mydomain.shopping.Cart" called "Set items". Then you can select to find all references to
this variable, or only cases where it is being assigned/read from.

Or if you find a variable which is an instance of the Cart class. You select the "Cart" and search for all places where
Cart variables are defined. etc.

You can either type the item you're looking for, or when opening the dialog the text field is initialized to whatever
the cursor was placed over/highlighted.

It's extremely useful. I use it tons of times, and I'm sure others do as well. At first it didn't seem useful to me, as
I was used to searching for text. But once you start using it, you notice that the precision over normal text search is
amazing.

Also, the speed at which Eclipse searches through a project is amazing as it uses Lucene to do the indexing. So only
implementing such a search wouldn't really be enough, as I can find what I'm looking for in a second/two.
Comment 1 Vladimir Voskresensky 2008-07-27 06:58:47 UTC
What is not enough in "Find Usages" feature of NetBeans? (Alt+F7 on any element in editor or find it in context menu)
Comment 2 qbeukes 2008-07-28 12:14:19 UTC
I know of Usages, but it technically doesn't count, as it searches for... Usages. It's not a "Java Search".

Let me list some of the features:
1. You can type your own values
2. Search For:
- Type
- Package
- Field
- Method
- Constructor
3. Limit To
- Declarations
- Implementors
- References
- All occurrences
- Read accesses
- Write accesses 

You can also search in library sources, and even the JRE libraries.

Example:
I want a list of all "getters" in my project.
-> I enter *.get* as the text, I select "Methods" as the type, and "Declarations" as my limit.

Example 2:
Or I have a class with a public variable which I access directory (instance.varName). I am doing something wicket and
weird, and want to convert all write accesses to a setter. So I select it, press Ctrl-H, and search for all
assignments/write accesses. Then I can just press the "next" button to highlight every change, and change appropriately.
Optimized for maximum developer output/performance.

Example 3:
I want to find all declarations of any 2 argument setters that have a String as their first argument.
Search for: *.set*(String, *)
Select type: Methods
Limit to: Declarations

Limited to only the imagination.... The only things I've wanted to do with the Eclipse one so far that I couldn't is:
1. Search for - (i) variables or (ii) methods 
accessed or referenced - (x) outside or (y) inside 
their own - (a) class or (b) package.

2. Use regular expressions in the search criteria. The wildcards can get limited. I once wanted to do the example 3
search above, but I wanted to the 2nd argument to be either "int|Integer|long|Long". I couldn't so I ended up having to
go through many many extra methods that have strings/doubles/etc as their second arguments.