Currently, we generate a default ActionListener for every SearchAction in the details pane:
| for (finalSearchActionaction : actions) { |
| finalJButtonbutton = newJButton(action.toString()); |
| button.addActionListener(ae -> { |
| action.run(); |
| if (action.closesSearch()) { |
| reset(); |
| } |
| }); |
Allowing for SearchActions to provide their own ActionListener would allow more flexibility, e.g. displaying a small popup menu (JPopupMenu) with additional (sub-)choices that wouldn't justify the creation of an own SearchAction for them.
This goes in the same direction as #4 to provide more flexibility to define search actions.
The problem with allowing with allowing ActionListener as a parameter would be that we introduce an awt dependency in a UI-agnostic SearchAction, so this would have to be abstracted somehow...
Currently, we generate a default
ActionListenerfor everySearchActionin the details pane:scijava-search/src/main/java/org/scijava/ui/swing/search/SwingSearchBar.java
Lines 514 to 521 in 14315f8
Allowing for
SearchActions to provide their ownActionListenerwould allow more flexibility, e.g. displaying a small popup menu (JPopupMenu) with additional (sub-)choices that wouldn't justify the creation of an ownSearchActionfor them.This goes in the same direction as #4 to provide more flexibility to define search actions.
The problem with allowing with allowing
ActionListeneras a parameter would be that we introduce an awt dependency in a UI-agnosticSearchAction, so this would have to be abstracted somehow...