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 219457

Summary: Missing a way to select appropriate panel content on search
Product: platform Reporter: Martin Entlicher <mentlicher>
Component: Options&SettingsAssignee: Theofanis Oikonomou <theofanis>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, jlahoda, marfous, mjanicek, mkristofic, ovrabec, sdedic
Priority: P3 Keywords: API_REVIEW_FAST
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: new api and usage
new api and usage

Description Martin Entlicher 2012-10-03 14:29:04 UTC
We can set various keywords for panels in Options. But many panels can change their components according to various selections. E.g. Versioning panel in Miscellaneous when you select various versioning systems, or Java Debugger in Java when you select various categories.

But I do not see a way to select the appropriate content as a response to the searched keyword. This results in a state that the user is not able to see what they search for.
Comment 1 Theofanis Oikonomou 2012-10-12 10:16:43 UTC
Created attachment 125840 [details]
new api and usage

This is the new api. I introduced a new method in OptionsPanelController that is called whenever a search yields a successful result. 

By default nothing happens. This is the most common case. In some case though like keymaps, java debugger, versioning, etc some special action needs to be performed. 

I have included some dummy usage for the above stated panels just to show how it should work. The usage part will not be committed, I will leave the actual implementation to each owner, who will also update the dependency to options.api and increase the spec version of their module.

I guess that some special action should also happen (or would make sense) in most of the panels of F&C and Editor categories.

I am planning to integrate next Thursday. Please comment. Thank you.
Comment 2 Ondrej Vrabec 2012-10-16 09:39:22 UTC
OV1: currently the method handleSuccessfulSearch accepts only one parameter - the string a user typed into the search field - but would it be possible to add also a parameter with the list of matched keywords? What my concern is that we will duplicate your search logic in keywords once again in our code - i.e. transforming the strings to lowercase, search for substrings in our keywords etc. Would it make sense to add List<String> matchedKeywoards to the method? Because you already know them and it would at least prevent from copy&paste of your keywords searching.
Comment 3 Theofanis Oikonomou 2012-10-16 11:34:52 UTC
Created attachment 126004 [details]
new api and usage

[OV1] good point. I updated the patch and usage. Now, you know the words the user used as search text and the list of keywords that triggered options panel to activate your panel.

Thank you
Comment 4 Jan Lahoda 2012-10-18 08:35:50 UTC
Sorry for arriving late.

JL01: there are options panels, that do not have set of keywords that could be statically written to one file. For example Editor/Hints contains subpanels, provided by many modules (even external ones) - there is no way to write all keywords for all the panels into one file during build. There is a small UI question: should the "global" options search replace the search in Editor/Hints? (I.e. when one types "null" into the global search, should the Editor/Hints panel remain active and filter the languages and their hints to show only those that contain null?) I think it should, and then there must be a way to provide keywords for individual language/technology panels of Editor/Hints. I see two possibilities:
1. add something like:
    public boolean handleSearch(String searchText) {
    }
into OptionsPanelController, which would return true if the given panel contains the given keywords (and could do additional work if appropriate). The advantage is that it might be possible to do this without forcing changes to the individual Editor/Hints clients (at the cost of actually instantiating all the Editor/Hints subpanels).
2. instead of reading one file with keywords, allow reading all files from a directory. Requires non-trivial changes to Editor/Hints clients to provide the correct functionality, but might work as well.
Comment 5 Theofanis Oikonomou 2012-10-18 09:28:39 UTC
(In reply to comment #4)
> Sorry for arriving late.
> 
> JL01: there are options panels, that do not have set of keywords that could be
> statically written to one file. For example Editor/Hints contains subpanels,
> provided by many modules (even external ones) - there is no way to write all
> keywords for all the panels into one file during build. There is a small UI

this is not needed. each panel can use the @Keywords annotation or can directly inject the required stuff in a layer.xml file. I believe that this should work. Fixed in core main: http://hg.netbeans.org/core-main/rev/182bf53affe0

Thank you all for your comments
Comment 6 Quality Engineering 2012-10-19 13:38:40 UTC
Integrated into 'main-golden', will be available in build *201210191216* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/182bf53affe0
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #219457 - Missing a way to select appropriate panel content on search