Bug 107904 - Find in files should also display directories matching the given names
Find in files should also display directories matching the given names
Status: NEW
Product: utilities
Classification: Unclassified
Component: Search
6.x
All All
: P2 (vote)
: TBD
Assigned To: Jaroslav Havlin
issues@utilities
: API, ARCH
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-22 23:07 UTC by Petr Jiricka
Modified: 2013-03-04 18:11 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 Petr Jiricka 2007-06-22 23:07:34 UTC
Build 1039 from deadlock, Mac OS X.

1. Mount a directory that contains subdirectories in the Favorites tab
2. Launch the Find dialog in this directory. Leave 'Containing Text' empty, and put the name of some subdirectory of the
mounted directory in 'File Name Patterns'

=> Search does not find the subdirectory. The expected result is that the subdirectory is found.
Comment 1 Petr Jiricka 2007-06-25 12:57:10 UTC
Too bad this was reclassified as an enhancement and set to 'future' (meaning it won't be done anytime soon). I was
hoping NetBeans could replace the search functionality in Total Commander (as I can't use Total Commander now after
switching to Mac), but unfortunately it's still far from usable.
Comment 2 Petr Jiricka 2010-10-08 09:12:07 UTC
I still think this is a (P3) defect, not an enhancement.
Comment 3 markiewb 2013-03-01 23:14:33 UTC
I had a short look.
At 
org.netbeans.api.search.provider.impl.SimpleSearchIterator.update() there is code like                 

if (file.isFolder()) {
      processFolder(file);
}

If you insert the check like
fileNameMatcher.pathMatches(file) to match the directory name to the given pattern, then it would not be possible to traverse the children if a directory with the given name is found.

@NB-Devs: Any ideas to solve the dilemma?
Comment 4 Jaroslav Havlin 2013-03-04 10:38:56 UTC
> @NB-Devs: Any ideas to solve the dilemma?
I think it could be solved. This change in SimpleSearchIterator should work (needs some tests before applying).

@@ -149,7 +149,11 @@
         do {
             if (childrenEnum.hasMoreElements()) {
                 FileObject file = childrenEnum.nextElement();
-                if (file.isFolder()) {
+                if (fileNameMatcher.pathMatches(file) && file.isFolder()) {
+                    processFolder(file);
+                    nextObject = file;
+                    break;
+                } else if (file.isFolder()) {
                     processFolder(file);
                 } else if (searchInArchives && isArchive(file)) {
                     listener.directoryEntered(file.getPath());

(Some other changes that enable working with folders in search results would be needed).

The main reason why I'm not very inclined to implementing this enhancement is that I don't find it very practical. We would need another check box "find folders", which would make the dialog more complicated.

Anyway, users that need to find files in a folder of specified name can check "File Path Regular expression" and enter file name pattern e.g. "/myFolder/".

So, the only thing the IDE currently cannot do is to find empty folder of specified name. 

I would rather keep this issue open. If there is a lot of votes some time in the future, we can consider implementing it and discuss the concrete implementation.

Thank you for looking into it, Benno. What do you think? Would you find this feature helpful? If so, what's your use case?
Comment 5 markiewb 2013-03-04 18:11:44 UTC
> Thank you for looking into it, Benno. What do you think? Would you find this
> feature helpful? If so, what's your use case?

@Jaroslav: For me it not yet useful. Leave it open and wait for votes. I've never tried to search for directories using the search dialog. I had the module open and watched for some open issue which could be solved easily. This seemed to be one, but it wasn't...


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