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.
Find dialog makes some assumption on project logical view that is true only for Java projects. Find looks at the first level of nodes in a project's logical view and traverses only nodes associated with disk files. This may work for Java projects but if the first level nodes are for instance logical folders like in our Make Projects, this heurheurist fails. Need a way to specify to find what files should be search in a project.
It is possible to define how a given node should be searched. To do so, just add a SearchInfo object to the node's lookup. Introduction to the SearchAPI and use-cases is available at http://www.netbeans.org/download/dev/javadoc/org-openidex-util/index.html Does the SearchAPI (specifically interfaces SearchInfo and FileObjectFilter and factory class SearchInfoFactory) fulfil your needs?
Since I consider the reporter's claim invalid and the reporter did not object against my reply for almost a month, I close this bug report as INVALID. Feel free to reopen if you actually need some change in the Search API.
Cannnot fully speak for the reporter, but adding SearchInfo into the projects node helps only for the Find... action. There is another action "Find in Projects...", which takes SourceGroup(s) of all opened projects and searches recursively the roots of these SourceGroups, without paying attention to "SourceGroup.contain". I think this is not correct behaviour. I can provide you a SourceGroup based SearchInfo that can be used to fix the "Find in Projects..." action. Maybe a completely different approach can be taken after the actions redesign, but I am not sure what is the status of the redesign.
Accepted. It will be fixed in the version after 5.0.
Then please send waiver request. Thanks.
Well, I do no think this is a P2...
Raising to p2. We would like this fixed and backported to 5.5.1.
The core of this issue is that action Find in Projects does not respect lookup of the projects' root nodes. So I plan to fix this issue simply by passing the projects' root nodes to the Find action so that their lookup can be taken into account. Unfortunately, it is not possible to get the root nodes displayed in the Projects view - one can only ask for new copies. So the Find in Projects action will create a new copy of each project's root node and use these copies for grabbing information used for searching. This should work but it might increase memory consumption - this is still to be determined.
I implemented the described changed and ... it does not work. The problem is that most projects' nodes' lookups do not contain the SearchInfo until the project's root node is added to the Projects view in the IDE. I do not have any alternative idea, yet.
"most projects' nodes' lookups do not contain the SearchInfo until the project's root node is added to the Projects view in the IDE" - really? why? Anyway I think it would be better for F.i.P. to continue to use SourceGroup but to pay attention to SG.contains(). (Which, BTW, will be even more important with issue #49026.)
Please note that not all projects are 'root' based. Native projects don't have a source root and don't use SourceGroups. We do create a SearchInfo object (when the node is displayed!) and sticks it into the lookup and it works well with Find. Find in Project is the action that doesn't work for us and looking for a solution that supports something like SearchInfo.
My new idea is to get SearchInfo from the project itself (i.e. not from its root node) and if the project's lookup does not contain SearchInfo, fallback to the current implementation, i.e. to the search over SearchGroups. Let me know if this is an acceptable way of solving this issue. If so, I will implement and integrate the described change as soon as possible.
yes, I think this solution would work.
I just integrated the change described in my previous post. I integrated this in two phases because I forgot to update the copyright period in the first commit. Modified files: utilities/src/org/netbeans/modules/search/SearchPerformer.java (1.40/1.41) utilities/project/src/org/netbeans/modules/search/project/ ProjectsSearchAction.java (1.10/1.11) Diffs: http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/SearchPerformer.java?r1=1.39&r2=1.41&diff_format=u http://utilities.netbeans.org/source/browse/utilities/project/src/org/netbeans/modules/search/project/ProjectsSearchAction.java?r1=1.9&r2=1.11&diff_format=u
Great. Please not this is one of the fixes we would like backported to 5.5.1.
The patch seems OK.
This is an API change. It needs to be documented, in SearchInfo and also in Project.getLookup().
Created attachment 37317 [details] diff of apichanges.xml - describes the API change
I increased specification version of the Utilities module (1.22 -> 1.23). Modified file: utilities/manifest.mf (1.64) Diff: http://utilities.netbeans.org/source/browse/utilities/manifest.mf?r1=1.63&r2=1.64&diff_format=u
Y01 Please try to use hyperlinks to classes you talk about - SourceGroups, Project, etc. Also make a note in Project's own JavaDoc: http://www.netbeans.org/download/dev/javadoc/org-netbeans-modules-projectapi/org/netbeans/api/project/Project.html#getLookup() Y02 Is there a test to verify that this contract works for ever? It should be, otherwise random commits can break this contract in future.
Created attachment 37339 [details] diff of apichanges.xml - updated
Created attachment 37340 [details] diff of Javadoc for Project.getLookup()
Created attachment 37341 [details] diff of Javadoc for SearchInfo
Better, thanks.
I just committed the documentation and also a test of the Find in Projects action. Added and modified files: openidex/manifest.mf (1.39) openidex/api/apichanges.xml (1.7) openidex/src/org/openidex/search/SearchInfo.java (1.8) projects/projectapi/src/org/netbeans/api/project/Project.java (1.16) utilities/project/src/org/netbeans/modules/search/project/ ProjectsSearchAction.java (1.12) utilities/project/test/unit/src/org/netbeans/modules/search/project/ ProjectsSearchActionTest.java (1.1 - new) Diffs: http://openidex.netbeans.org/source/browse/openidex/manifest.mf?r1=1.38&r2=1.39&diff_format=u http://openidex.netbeans.org/source/browse/openidex/api/apichanges.xml?r1=1.6&r2=1.7&diff_format=u http://openidex.netbeans.org/source/browse/openidex/src/org/openidex/search/SearchInfo.java?r1=1.7&r2=1.8&diff_format=u http://projects.netbeans.org/source/browse/projects/projectapi/src/org/netbeans/api/project/Project.java?r1=1.15&r2=1.16&diff_format=u http://utilities.netbeans.org/source/browse/utilities/project/src/org/netbeans/modules/search/project/ProjectsSearchAction.java?r1=1.11&r2=1.12&diff_format=u http://utilities.netbeans.org/source/browse/utilities/project/test/unit/src/org/netbeans/modules/search/project/ProjectsSearchActionTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup
The fix has been backported to 551, correct? Shouldn't it be marked with the Whiteboard keyword '551_HR_FIX' then?
I think you just need to set TM=5.5.1 if it has already been backported, but I'm not sure. If it has been backported, was there a commit log somewhere?
I just checked the 551 sources and it doesn't look like it has been backported yet. But that's the plan, correct?
> I just checked the 551 sources and it doesn't look like it has been > backported yet. But that's the plan, correct? Definitely. I talked to mpetras before the weekend and he was starting preparations of 551 integration. This will be integrated soon.
Very good. Thanks.
I backported the functionality and tests to the 'release551' branch. Modified and added files: utilities/manifest.mf (1.59.12.1.2.3.6.1) utilities/src/org/netbeans/modules/search/SearchPerformer.java (1.37.46.1.22.1) utilities/project/manifest.mf (1.5.12.1.2.3.6.2) utilities/project/src/org/netbeans/modules/search/project/: ProjectsSearchAction.java (1.7.46.1.22.1) utilities/project/nbproject/project.properties (1.1.84.1.22.2) utilities/project/test/unit/src/org/netbeans/modules/search/project/: MockProject.java (1.1.2.1 - new on branch) MockProjectFactory.java (1.1.2.1 - new on branch) OpenProjectCLITest.java (1.1.6.2) ProjectsSearchActionTest.java (1.1.2.1 - new on b.) utilities/project/test/unit/src/META-INF/services/: org.netbeans.spi.project.ProjectFactory (1.1.2.2)
Additional commit to branch 'release551': openidex/manifest.mf (1.35.12.1.2.3.6.1)