Opened 17 months ago
Last modified 17 months ago
#21464 new enhancement
Dynamically display hints for new search keywords/functions added by plugins in search dialogue
Reported by: | Woazboat | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | search, plugin, ui | Cc: |
Description
Currently the list of hints for search syntax and keywords in the search dialogue is hardcoded and limited to the core functionality. For better discoverability of new search functionality added by plugins, the search dialogue should also (dynamically) display hints for search keywords and functions that were added by plugins (e.g. utilsplugin2 adds new search functionality).
Attachments (1)
Change History (8)
Changed 17 months ago by
Attachment: | josm_search_dialog_extended_poc.png added |
---|
comment:1 Changed 17 months ago by
Code for quick and dirty proof of concept can be found here: https://github.com/Woazboat/josm/commit/79406922fa1b9afa3a5ad85b2946ec6230e4afc0
(obviously needs a lot of refinement)
comment:2 Changed 17 months ago by
To be able to do this properly, plugins would need to provide descriptions (and examples) for new keywords/functions. It would also require differentiating between pure keyword only functions (like e.g. closed
, modified
, ...) and keyword + parameter functions (like e.g. role:stop
, user:anonymous
, ...) to be able to display them properly in a dynamic way (with or without the :
)
comment:3 Changed 17 months ago by
Bonus points if keywords can be assigned to categories that are then used to thematically group and display them together.
comment:4 Changed 17 months ago by
A little bit of feedback:
Instead of making the .*MatchFactoryMap
fields public, it would be better to do something like this:
public boolean addMatchFactory(String key, MatchFactory matchFactory) { if (matchFactory instanceof SimpleMatchFactory) { return this.simpleMatchFactoryMap.put(key, (SimpleMatchFactory) matchFactory); } return false; } public boolean removeMatchFactory(String key, Class<? extends MatchFactory> clazz) { if (SimpleMatchFactory.class.isAssignableFrom(clazz)) { return this.simpleMatchFactoryMap.remove(key); } return false; }
This has the advantage of not exposing specific fields, which means we can change them if something better comes along. Without breaking <x> plugin.
comment:5 Changed 17 months ago by
Yes, making the fields public was just for the quick and dirty proof of concept, the real implementation should use some proper interfaces. I unfortunately don't have the time for it right now, but might come back to this at some point.
comment:7 Changed 17 months ago by
Keywords: | search plugin ui added |
---|
(Ugly) proof of concept for dynamic keyword hints in search dialog