Modify

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)

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

Download all attachments as: .zip

Change History (8)

Changed 17 months ago by Woazboat

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

comment:1 Changed 17 months ago by Woazboat

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 Woazboat

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 Woazboat

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 taylor.smock

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 Woazboat

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 Changed 17 months ago by Woazboat

Related to #7230 and #7178

comment:7 Changed 17 months ago by Woazboat

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.
to The owner will be changed from team to the specified user.
The owner will change to Woazboat
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.