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 200020 - Patch for: Manipulate search results (delete items), better export options
Summary: Patch for: Manipulate search results (delete items), better export options
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX, PATCH_AVAILABLE
: 175308 219899 (view as bug list)
Depends on:
Blocks: 33418
  Show dependency tree
 
Reported: 2011-07-10 19:27 UTC by dnlvrmr
Modified: 2016-09-18 13:57 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch (24.67 KB, patch)
2012-12-09 12:43 UTC, markiewb
Details | Diff
Patch in action (86.13 KB, image/png)
2012-12-09 12:48 UTC, markiewb
Details
Proposed Patch v2 (22.90 KB, patch)
2012-12-14 10:49 UTC, Jaroslav Havlin
Details | Diff
Proposed Patch v3 (24.76 KB, patch)
2012-12-14 16:17 UTC, Jaroslav Havlin
Details | Diff
Proposed patch v4 - removing of Matches supportes (22.43 KB, application/octet-stream)
2012-12-16 15:48 UTC, markiewb
Details
Proposed Patch v5 (25.12 KB, patch)
2012-12-17 16:40 UTC, Jaroslav Havlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dnlvrmr 2011-07-10 19:27:09 UTC

    
Comment 1 dnlvrmr 2011-07-10 19:35:20 UTC
Some initial thoughts:
It would be nice to be able to manipulate the results in the "Search Results" screen after getting loads and loads of results, after not being able to limit the results any more by changing the search parameters, even not with very smart regexps. Imagine looking for '...'.

I would like to propose the following changes to make it easier to create an overview of the occurances that I need:
- add the number of matches for this file behind the filename;
- be able to delete (by using [del]) a single result that is not a desired result;
- be able to delete a file-result that is not desired;
- be able to delete a group of files, which were selected by using [click]-[ctrl|shift]-[click] or by holding shift and pressing the [up|down] button;
- a new button at the left to export the search result to csv, or just normal text, and/or make the [ctrl]-[c]/copy function behave nicer than:
org.netbeans.modules.search.MatchingObject@eadce4[autoload.php]
org.netbeans.modules.search.MatchingObject@10eb73[functions.inc.php]


Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
System: Windows XP version 5.1 running on x86; Cp1252; nl_NL (nb)
Comment 2 markiewb 2012-09-28 22:09:11 UTC
*** Bug 175308 has been marked as a duplicate of this bug. ***
Comment 3 Jaroslav Havlin 2012-10-11 11:59:08 UTC
*** Bug 219899 has been marked as a duplicate of this bug. ***
Comment 4 markiewb 2012-12-09 12:43:46 UTC
Created attachment 129103 [details]
Proposed patch

I like to propose a patch for removing nodes from the view and thus allowing to filter out the uninteresting matches.

* works in directory and list mode
* works for directories and files
* does not work for the nodes below the files 

When the user presses DEL, the backend object of the current node is taken and removed from the model. Then the nodes will be refreshed. This includes searching for directory nodes, which have no children, they will be removed too. 

@NetBeans-Devs: Please review the patch. I know that is feature freeze for 7.3, but there will be a version after 7.3 *g* The code is a bit ugly, especially the node refreshing stuff. I could not get it running in another way. But it works! Perhaps you can show/guide me to a better solution.
Comment 5 markiewb 2012-12-09 12:48:42 UTC
Created attachment 129105 [details]
Patch in action
Comment 6 markiewb 2012-12-09 13:04:07 UTC
Only some comments to the other RFEs in this issue:

(In reply to comment #1)
> Some initial thoughts:
> It would be nice to be able to manipulate the results in the "Search Results"
> screen after getting loads and loads of results, after not being able to limit
> the results any more by changing the search parameters, even not with very
> smart regexps. Imagine looking for '...'.

You want to filter the filtered results, is that correct?
 
> - add the number of matches for this file behind the filename;

Already there. You have to set the column visible and move the column next to the filename column.

> - a new button at the left to export the search result to csv, or just normal
> text, and/or make the [ctrl]-[c]/copy function behave nicer than:
> org.netbeans.modules.search.MatchingObject@eadce4[autoload.php]
> org.netbeans.modules.search.MatchingObject@10eb73[functions.inc.php]

I could not generate outputs like 'org.netbeans.modules.search.MatchingObject@eadce4[autoload.php]'. Please describe steps for reproduction.
Comment 7 dnlvrmr 2012-12-09 15:59:10 UTC
Thanks for working on it! Let's see if the patch is accepted. See below my responses to your questions.

(In reply to comment #6)
> Only some comments to the other RFEs in this issue:
> 
> (In reply to comment #1)
> > Some initial thoughts:
> > It would be nice to be able to manipulate the results in the "Search Results"
> > screen after getting loads and loads of results, after not being able to limit
> > the results any more by changing the search parameters, even not with very
> > smart regexps. Imagine looking for '...'.
> 
> You want to filter the filtered results, is that correct?

Yep. So your patch in action does show the idea.

> 
> > - add the number of matches for this file behind the filename;
> 
> Already there. You have to set the column visible and move the column next to
> the filename column.

I am not sure anymore if this possibility was already there in 7.0. In 7.2.1 it is, yes. So - this part of the request is resolved.

> 
> > - a new button at the left to export the search result to csv, or just normal
> > text, and/or make the [ctrl]-[c]/copy function behave nicer than:
> > org.netbeans.modules.search.MatchingObject@eadce4[autoload.php]
> > org.netbeans.modules.search.MatchingObject@10eb73[functions.inc.php]
> 
> I could not generate outputs like
> 'org.netbeans.modules.search.MatchingObject@eadce4[autoload.php]'. Please
> describe steps for reproduction.

This was the result in 7.0. I checked just now in 7.2.1, where it is working nice, it is copying what you see. So - this part of the request is resolved too.
Comment 8 dnlvrmr 2012-12-09 16:18:49 UTC
(In reply to comment #4)
> I like to propose a patch for removing nodes from the view and thus allowing to
> filter out the uninteresting matches.
> 
> * works in directory and list mode
> * works for directories and files
> * does not work for the nodes below the files

Nice!

But I would like to be able to remove a single match (a node below a file) too.
Comment 9 Jaroslav Havlin 2012-12-10 09:00:49 UTC
(In reply to comment #4)
> @NetBeans-Devs: Please review the patch. I know that is feature freeze for 7.3,
> but there will be a version after 7.3 *g* The code is a bit ugly, especially
> the node refreshing stuff. I could not get it running in another way. But it
> works! Perhaps you can show/guide me to a better solution.
Thank you very much, Benno, great job! I'll review it soon.
This enhancement was planned for the next version after 7.3, but you were pretty fast :-)
OK, we will see whether enhancements are allowed for some of 7.3.x version.
Comment 10 markiewb 2012-12-10 19:54:46 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > I like to propose a patch for removing nodes from the view and thus allowing to
> > filter out the uninteresting matches.
> > 
> > * works in directory and list mode
> > * works for directories and files
> > * does not work for the nodes below the files
> 
> Nice!
> 
> But I would like to be able to remove a single match (a node below a file) too.

Me too, but i first i want to wait for the review. I think the current implementation could be easier, so the NB-Devs could help. I do not know the API by heart.
Comment 11 Jaroslav Havlin 2012-12-14 10:49:32 UTC
Created attachment 129370 [details]
Proposed Patch v2

Markiewb's patch updated for current sources + some formal changes (formatting,
logging, suppressing warnings).
I'm going to review the actual implementation, too.
Comment 12 Jaroslav Havlin 2012-12-14 16:17:20 UTC
Created attachment 129386 [details]
Proposed Patch v3

I've reviewed the patch and modified it a bit.
I think that it is better to let every MatchingObject and FolderTreeItem inform its nodes that it was removed. Notifying ResultModel about deletion of some folder also works fine, but it can be slower to detect which files are under this folder.

I've also fixed updating of number of selected items, which applies only to Replace in Projects...

DeleteAction in Search Results has display name "Hide" (users could think that the files are going to be removed from disk), but this should be discussed in a UI review.

Before integrating the fix into the release, we should also have some unit test for the new feature.

Benno, can you please review the changes? If you find something wrong, please let me know.

> > But I would like to be able to remove a single match (a node below 
> > a file) too.
> Me too, but i first i want to wait for the review. I think the current
> implementation could be easier, so the NB-Devs could help. I do not know 
> the API by heart.
It would be great if you implement this, too.
Thank you!
Comment 13 markiewb 2012-12-16 15:48:13 UTC
Created attachment 129425 [details]
Proposed patch v4 - removing of Matches supportes

(In reply to comment #12)
> Before integrating the fix into the release, we should also have some unit test for the new feature.

Yes, we should because there is much indirection because of using events. The sync of model and tree is not straight forward.
 
> Benno, can you please review the changes? If you find something wrong, please
> let me know.
* In org.netbeans.modules.search.ui.ResultsOutlineSupport.FolderTreeItem.remove():void there was some code to prevent a ConcurrentModifcationException. This collided with my changes. Removing folders did not work. I solved it by using a copy of the children (ResultOutlineSupport:561). 
* i had to move firePropertyChange code into org.netbeans.modules.search.MatchingObject.cleanup():void so that the tree gets updated correctly when removing the all the textDetails of a matchingObjectNode

> > > But I would like to be able to remove a single match (a node below 
> > > a file) too.
> It would be great if you implement this, too.
> Thank you!
Removing of Matches is now supported.

Short recap:
-------------
Working:
* hide directories (FolderTreeItem/-Node)
* hide files (MatchingObject)
* [NEW] hide matches (TextDetail)
* hiding parents also hides its children
* empty parents are hidden automatically (recursive)

Missing:
* unit tests 
* after "hiding" a node the focus a node should be focused (ACTUAL: no focus, had to press UP/DOWN to get the focus)
Comment 14 Jaroslav Havlin 2012-12-17 16:40:56 UTC
Created attachment 129468 [details]
Proposed Patch v5

(In reply to comment #13)
> Created attachment 129425 [details]
> Proposed patch v4 - removing of Matches supportes
Thanks for implementing it.

> * In org.netbeans.modules.search.ui.ResultsOutlineSupport.
> FolderTreeItem.remove():void there was some code to prevent a 
> ConcurrentModifcationException. This collided with my changes. Removing 
> folders did not work. I solved it by using a copy of the children 
> (ResultOutlineSupport:561). 
OK, nice.

> * I had to move firePropertyChange code into
> org.netbeans.modules.search.MatchingObject.cleanup():void so that the 
> tree gets updated correctly when removing the all the textDetails of a 
> matchingObjectNode.
No problem. Seems to work well.

Changes in v5:

In patch v4, the Nodes listened to changed in ResultModel. So, all MatchingObjectNodes were notified if one MatchingObject was removed, and all of them tried to update their children. It should be enough if a node listens only to the MatchingObject that it represents.

Added updating of cached matchesCount value in MatchingObject.

Thank you for your help.
Comment 15 Jaroslav Havlin 2013-01-29 10:27:46 UTC
The patch was integrated as http://hg.netbeans.org/core-main/rev/1006567f0772

> Missing:
> * unit tests
Some test added

> * after "hiding" a node the focus a node should be focused (ACTUAL: no focus,
> had to press UP/DOWN to get the focus)
Comment 16 Quality Engineering 2013-01-30 03:40:21 UTC
Integrated into 'main-golden', will be available in build *201301300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1006567f0772
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #200020: Manipulate search results (delete items)
Comment 17 markiewb 2013-02-04 07:41:00 UTC
(In reply to comment #16)
> Integrated into 'main-golden', will be available in build *201301300001* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> Changeset: http://hg.netbeans.org/main-golden/rev/1006567f0772
> User: Jaroslav Havlin <jhavlin@netbeans.org>
> Log: #200020: Manipulate search results (delete items)

@Jaroslav: Which version is the current nightly build? Does it mean it is integrated for 7.3.1 or 7.4.x or even 8.0.x?
Comment 18 Jaroslav Havlin 2013-02-04 09:28:28 UTC
(In reply to comment #17)
> @Jaroslav: Which version is the current nightly build? Does it mean it is
> integrated for 7.3.1 or 7.4.x or even 8.0.x?
It'll be integrated in the next (nearest) major version after 7.3. (I'm not sure how it will be numbered).
It won't be probably integrated in 7.3.1, as these versions usually contain only fixes, not new features.
Comment 19 markiewb 2013-02-04 12:43:28 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > @Jaroslav: Which version is the current nightly build? Does it mean it is
> > integrated for 7.3.1 or 7.4.x or even 8.0.x?
> It'll be integrated in the next (nearest) major version after 7.3. (I'm not
> sure how it will be numbered).
> It won't be probably integrated in 7.3.1, as these versions usually contain
> only fixes, not new features.

Thanks for the info. I asked because i wondered why http://netbeans.org/bugzilla/show_bug.cgi?id=123773 (which is available in main-golden) is resolved for 7.3 and not for dev...
Comment 20 markiewb 2013-03-03 22:27:52 UTC
(In reply to comment #16)
> Integrated into 'main-golden', will be available in build *201301300001* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> Changeset: http://hg.netbeans.org/main-golden/rev/1006567f0772
> User: Jaroslav Havlin <jhavlin@netbeans.org>
> Log: #200020: Manipulate search results (delete items)

@Jaroslav: Code is committed and works in the nightly builds. Are you still working on this issue? Can this issue be closed as resolved fixed?
Comment 21 Jaroslav Havlin 2013-03-04 10:53:41 UTC
> @Jaroslav: Code is committed and works in the nightly builds. Are you still
> working on this issue? Can this issue be closed as resolved fixed?

There is one missing thing:
> * after "hiding" a node the focus a node should be focused (ACTUAL: no focus,
> had to press UP/DOWN to get the focus)

I keep the the issue open so that it's not forgotten.
(It seems that it's an issue in OutlineView. Maybe separate bug should be created and this issue closed. I'll discuss it with OutlineView owner.)
Comment 22 Jaroslav Havlin 2013-03-04 13:17:40 UTC
> (It seems that it's an issue in OutlineView. Maybe separate bug should be
> created and this issue closed. I'll discuss it with OutlineView owner.)
Created bug 226980.

> Can this issue be closed as resolved fixed?
Yes. Closing. Thank you, Benno.