scijava / scijava-search

Search framework for SciJava applications :mag:
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

Allow SearchActions (i.e. buttons) to be present but disabled for certain search results #4

Open imagejan opened 6 years ago

imagejan commented 6 years ago

Currently, the SearchActionFactory#supports method is used to decide if a SearchAction is to be included in a result's actions:

https://github.com/scijava/scijava-search/blob/6105bdd562ae8e36d4170143e5d654a38b757639/src/main/java/org/scijava/search/SearchService.java#L61-L70

... and a button is added for each supported action:

https://github.com/scijava/scijava-search/blob/6105bdd562ae8e36d4170143e5d654a38b757639/src/main/java/org/scijava/ui/swing/search/SwingSearchBar.java#L514-L534


It would be nice to have the possibility to always include a button for a certain result type (e.g. ModuleSearchResult) but to disable it (i.e. show it greyed-out) according to the fulfillment of some additional requirements (e.g. if a specific module doesn't support a given input type).

IMHO, indicating that a certain action is available in principle, but not for the currently highlighted item, would allow for a more consistent user experience.