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 239768 - Scope that searches in source folders of open projects, not in project roots
Summary: Scope that searches in source folders of open projects, not in project roots
Status: NEW
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 7.4
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jaroslav Havlin
Depends on:
Reported: 2013-12-24 18:24 UTC by NukemBy
Modified: 2014-01-31 13:08 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Plugin with the new search scope - Sources (ZIP) (8.83 KB, application/3dr)
2014-01-30 12:54 UTC, Jaroslav Havlin
Plugin with the new search scope - NBM (31.05 KB, application/octet-stream)
2014-01-30 12:56 UTC, Jaroslav Havlin

Note You need to log in before you can comment on or make changes to this bug.
Description NukemBy 2013-12-24 18:24:39 UTC
It looks like NetBeans subdirectories not listed in POM.xml. E.g. I have following file/folder structure:

    .. project files ...
    .. autogenerated files
    .. some dumb staff needed to be placed into this folder, which does not contain real source files

When I try to search for something in my projects (Edit -> Find -> Scope: Open Project) I expect to look only in folders defined as source folder in POM.xml which are listed below, but i also get matches from xxx folder. Note XXX is not listed in Projects window, i.e. MAVEN directories are already handled correcty somewhere:


Comment 1 Milos Kleint 2013-12-30 05:47:21 UTC
I'm not sure how this is  influenced by the project type. reassigning for evaluation
Comment 2 NukemBy 2013-12-30 09:17:34 UTC
I suspect each project type in Netbeans has its own logic regarding location of the source files. For MAVEN projects source/resource folders are defined explicitly in POM.xml. This MAY NOT be the case for other project types and therefore this bug may not apply to other project types.
Comment 3 Tomas Zezula 2014-01-06 10:26:17 UTC
Edit -> Find is not a part of jump to module.
Comment 4 Jaroslav Havlin 2014-01-06 12:45:18 UTC
> Netbeans scans files in subdirectories not listed in POM.xml
Yes, but this is intentional. It recursively scans the project directory.
Changing this behavior would affect users that have some important data in non-source directories.

I would suggest:
1) Use find usages (if you are searching for some method, class, etc. occurrences).
2) Add the xxx folder to ignored folders (Find in Projects -> Use Ignore List -> Edit -> Add Folder)

Would it work for you?
Comment 5 NukemBy 2014-01-09 09:18:22 UTC
It may be my personal attitude, not applicable to most of other users, but - no, I do not think this will 'normally' work for me. The reasons are ...

1. When I select scope="Open Projects" or "Current Project" I do expect to search in the files really "included" into project. If I would like to search for just files, I would choose "Browse ... " and select the folder I need to scan.

Getting matches from files located in some 'temp' folders under project root is a bit misleading and heaving 'temp' (let's call them - non source) folders is rather normal case in multi-module MAVEN project - in that case sub-projects are put into sub-folders under parent MAVEN project and finally root project will cause scanning of everything under it ... what causes another problem ...

2. ... performance ... See this bug for details: This actually negatively affects performance and user experience in many areas - searching, goto file, goto symbol.
Comment 6 Jaroslav Havlin 2014-01-30 12:54:12 UTC
Created attachment 144585 [details]
Plugin with the new search scope - Sources (ZIP)
Comment 7 Jaroslav Havlin 2014-01-30 12:56:12 UTC
Created attachment 144586 [details]
Plugin with the new search scope - NBM
Comment 8 Jaroslav Havlin 2014-01-30 13:08:38 UTC
OK, I understand the problem, however I think it's quite a minor case.

I still think that the current behavior shouldn't be changed. Better solution would be adding a new search scope that searches only in source and resource folders of open projects.

I'm not sure it should be in the standard distribution, but it can be easily implemented as a plugin (and published in plugin portal).

I've just attached a prototype implementation of such plugin. Please test it and let me know whether it works fine for you. Thank you.
Comment 9 NukemBy 2014-01-30 15:12:50 UTC
Yes, having additional pre-configured 'search scope' does solve the problem for this bug. I'll check how provided plugin works later when have time.

Meanwhile ... may you notice some relevance between this issues and performance problems described in this bug
Comment 10 Jaroslav Havlin 2014-01-31 13:08:18 UTC
(In reply to NukemBy from comment #9)
> Meanwhile ... may you notice some relevance between this issues and
> performance problems described in this bug
The cause of the problem is probably the same, but Search in Projects and Go to File are quite different, independent modules.