Modify

Opened 3 years ago

Last modified 3 years 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)

josm_search_dialog_extended_poc.png (134.1 KB ) - added by Woazboat 3 years ago.
(Ugly) proof of concept for dynamic keyword hints in search dialog

Download all attachments as: .zip

Change History (8)

by Woazboat, 3 years ago

(Ugly) proof of concept for dynamic keyword hints in search dialog

comment:1 by Woazboat, 3 years ago

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 by Woazboat, 3 years ago

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 by Woazboat, 3 years ago

Bonus points if keywords can be assigned to categories that are then used to thematically group and display them together.

comment:4 by taylor.smock, 3 years ago

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 by Woazboat, 3 years ago

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:6 by Woazboat, 3 years ago

Related to #7230 and #7178

comment:7 by Woazboat, 3 years ago

Keywords: search plugin ui added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to Woazboat.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.