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 226286

Summary: Find in Projects dialog: Split scope settings panel
Product: utilities Reporter: Jaroslav Havlin <jhavlin>
Component: SearchAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal CC: akrasny, apireviews, JPESKA, psomol
Priority: P3 Keywords: API, API_REVIEW_FAST
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Screenshot of modified Find in Projects dialog
Proposed Patch

Description Jaroslav Havlin 2013-02-18 16:18:31 UTC
Created attachment 131538 [details]
Screenshot of modified Find in Projects dialog

Currently, all controls related to search scope are shown under the "File name patterns" field. It might be better to split this panel and to show some controls near the "Scope" combo box (see attached screenshot).
Comment 1 Jaroslav Havlin 2013-02-18 16:27:08 UTC
Created attachment 131540 [details]
Proposed Patch
Comment 2 Jaroslav Havlin 2013-02-18 16:37:35 UTC
Please review the following changes in module api.search.
Thank you.

(Taken from apichanges.xml:)

Controls for specifying search scope options can now be split into two panels - one for scope options, and one for file name options.

Class ComponentUtils has new method adjustPanelsForOptions(JPanel, JPanel, boolean, FileNameController), that takes the two panels. It can be used instead of adjustPanelForOptions(JPanel, boolean, FileNameController), that puts all controls into a single panel.

Class ScopeOptionsController has new method getFileNameComponent() to get the panel with controls related to file name. (The panel related to search scope can
be get using getComponent()).
Comment 3 Andrew Krasny 2013-02-18 18:49:38 UTC
Jaroslav, 

if you have found a reason for this split, don't you think that someday you may find another reason to have 3 panels instead of two? And if it is a possible thing to happen, don't you want to have a list of panels or to have some SPI like searchPropertiesPanelsProvider that will be used to get all possible panels and use their registration 'position' as a way for arranging them in the final search dialog? 

=Andrew
Comment 4 Jaroslav Havlin 2013-02-19 09:00:11 UTC
(In reply to comment #3)
> ...don't you want to have a list of panels or to have some SPI
> like searchPropertiesPanelsProvider that will be used to get all possible
> panels and use their registration 'position' as a way for arranging them
> in the final search dialog?
I was considering more generic solution, but at the end I chose
the simpler API. The reasons were:

1) The purpose of the adjustPanel(s)ForOptions is to help create panel that
   looks  the same as the panel in the default search provider and that lets
   you set all options supported by SearchScopeOptions (so authors of custom 
   search providers can have UI consistent with default provider).

2) If some search provider needs custom layout (or subset) of controls for
   search scope options, it can compose custom panels, without
   ComponentUtils. (This can be more straightforward and not much more
   difficult than using panel providers.)

3) If we someday decide to have 3 panels, we would probably add new variant of
   adjustPanelsForOptions that takes 3 panels. The advantage is that
   clients that use only two panels will not be affected at all (which is
   mandatory requirement, I think). So, yes, another API change will be
   needed, but I hope it isn't a big problem.

I've also considered creating the UI change without API change (item 2, which is still viable solution), but that would partially break the purpose of the ComponentUtils API (item 1).

What do you think?
Thank you for you comments.
Comment 5 Andrew Krasny 2013-02-19 19:47:17 UTC
Jaroslav,

I see your point. Actually I'm pretty much sure that two panels should be enough and it is unlikely that 3rd parameter will be needed at some point... That's why I don't really insist on either solution. If you still OK with what you propose (after answering the question) then I'm OK with that as well ;)
Comment 6 Jaroslav Havlin 2013-02-26 15:42:35 UTC
(In reply to comment #5)
> I see your point. Actually I'm pretty much sure that two panels should be
> enough and it is unlikely that 3rd parameter will be needed at some point...
> That's why I don't really insist on either solution. If you still OK with what
> you propose (after answering the question) then I'm OK with that as well ;)
Thank you very much, Andrew. I'm still quite OK with the proposed solution.

So, if there are no objections, I'll integrate the patch tomorrow evening.
Thanks.
Comment 7 Jaroslav Havlin 2013-02-28 08:30:13 UTC
Integrated as http://hg.netbeans.org/core-main/rev/6b55bbd6cc2f
Thank you for reviewing.
Comment 8 Quality Engineering 2013-03-01 02:01:57 UTC
Integrated into 'main-golden', will be available in build *201302282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6b55bbd6cc2f
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #226286: Find in Projects dialog: Split scope settings panel