Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 202628 - Search with "grep -A and -B" like options
Search with "grep -A and -B" like options
Status: RESOLVED FIXED
Product: utilities
Classification: Unclassified
Component: Search
7.3
All All
: P3 (vote)
: 7.4
Assigned To: Jaroslav Havlin
issues@utilities
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-25 14:08 UTC by ecerichter
Modified: 2013-02-23 04:12 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ecerichter 2011-09-25 14:08:37 UTC
When I use grep (Linux, command line), I can specify –A n to show ‘n’ lines after the match; similary I can specify –B n to show ‘n’ lines before the match.
It’s possible to consider add this feature to the search feature of NetBeans, because when I’m searching for something in an annotation, the annotation itself is useless for me.

For example, if I search for “FetchType.EAGER” it brings me all occurrences of FechType.EAGER; then I have to open each file and search again for the term to discover where it’s.
If I can specify –A 1 or –A 3 (or have a option for “Show ‘n’ lines after match”, I’ll see (and be able to “double-click”) the line that have the real information I need.

Thanks,

Edson.
Comment 1 ecerichter 2012-11-15 17:47:09 UTC
A possible solution is to use the tooltip baloon to show a code block from few lines before and few lines after (configurable?). Having a default of at least 3 before and 3 after would help already.

Regards,

Edson
Comment 2 Jaroslav Havlin 2012-11-16 08:43:47 UTC
We'll discuss it for the next release. But it can be difficult, because some users might find the tooltip obtrusive.

Finding the optimal number of surrounding lines is not trivial. Why do you think 3 is appropriate?

Did you try navigating with Ctrl+Comma and Ctrl+Period in the editor. Then you can see the whole file. I usually use it when I need to see the context of matching lines.

Kind regards, and thanks for reporting.
Comment 3 ecerichter 2012-11-16 14:22:08 UTC
The tooltip already exists, and is completely useless: it indicates the line and column of the match. Would be much more useful if it shows the block of code surrounding the match.

Regarding the magic number 3, actually is based on my guess (and experience: 90% of time, I'm interested in one or two lines above and below the match).

Regards,

Edson
Comment 4 Jaroslav Havlin 2012-11-19 08:50:50 UTC
(In reply to comment #3)
> The tooltip already exists, and is completely useless: 
Probably, some users in forums claimed that it should be removed completely.

> Would be much more useful if it shows the block of code surrounding
> the match.
Yes, the question is whether it is better to have nothing, or even
bigger pop-up.

Thank you.
Comment 5 ecerichter 2012-11-19 13:26:51 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > The tooltip already exists, and is completely useless: 
> Probably, some users in forums claimed that it should be removed completely.

It can be easily solved by a "enabled/disabled" option, as well the number of shown lines "before" and "after".

> 
> > Would be much more useful if it shows the block of code surrounding
> > the match.
> Yes, the question is whether it is better to have nothing, or even
> bigger pop-up.

In my case, a bigger popup would save me a lot of opened editors (you can imagine I'm looking for CascadeType annotation in a project with 1000 persistent java classes, and having to open each one to check if they are related or not the what I'm looking for).

> 
> Thank you.
Comment 6 Jaroslav Havlin 2012-11-23 16:16:20 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > The tooltip already exists, and is completely useless: 
> Probably, some users in forums claimed that it should be removed completely.
http://hg.netbeans.org/core-main/rev/e738ab1e42f8
The tool tip was removed.

> In my case, a bigger popup would save me a lot of opened editors (you can
> imagine I'm looking for CascadeType annotation in a project with 1000
> persistent java classes, and having to open each one to check if they are
> related or not the what I'm looking for).
It might be added in the next release.
Comment 7 Quality Engineering 2012-11-24 13:08:57 UTC
Integrated into 'main-golden', will be available in build *201211240959* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e738ab1e42f8
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #202628: Removing useless tooltip from text detail node in Search Results window
Comment 8 Jaroslav Havlin 2013-02-19 16:00:12 UTC
(In reply to comment #1)
> A possible solution is to use the tooltip baloon to show a code block from few
> lines before and few lines after (configurable?). Having a default of at least
> 3 before and 3 after would help already.
I've implemented this solution.
http://hg.netbeans.org/core-main/rev/1dd7928c4418

It's not configurable (yet), I think 3 lines before and after should be sufficient.

Thank you very much for reporting and for your comments!
Comment 9 Quality Engineering 2013-02-23 04:12:14 UTC
Integrated into 'main-golden', will be available in build *201302222300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1dd7928c4418
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #202628: Search results - show surrounding lines in text detail  tooltip


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo