A search bar for ImageJ



There is a way in SearchAction to set this behavior for each button, e.g. “Help” does not close the search results after execution. To do the same for the “Run” button, this line needs to look like this:

return new DefaultSearchAction("Run", false, //

Since the CommandFinder is doing the same, I don’t think it’s a big deal to change that?


With the Command Finder, it is configurable. I am heavily biased toward pressing L every time and typing what I want (because I type quickly), so that’s how I made the new search bar behave. However, to accommodate the other workflow, we could add a toggle to the Search options that would globally override the behavior such that all actions keep the search results pane open, and only when you press Esc or click the X does it go away. @oburri Does that sound good?


Sounds great to me! Thanks for the update and suggestion!


Shame that it closes after ‘run’. I always keep the command finder open. That is most useful.


I am back from vacation, now revisiting this issue. Before I code something, a quick question for those who like the search results window to remain open (@oburri @gabriel + anyone): do you want that pressing the enter key also keeps the window open? Or would it suffice for clicking the Run button to leave it open?

If it is sufficient for clicking the button to leave it open, then I propose a simpler solution here: pressing enter performs the default action and closes the window, whereas clicking any button on the right keeps it open. Then we can deprecate the action-specific closesSearch flag.

If you want pressing enter to leave it open, then I can indeed add the option to the Search options dialog box. But we could nonetheless remove the closesSearch action flag… is there ever a case where you wouldn’t want clicking an action button to leave the window open?


Maybe having an option to leave it open after clicking a command or pressing Enter (and which gets remembered) would do it for me. If there is overwhelming support to do it otherwise that is fine.


I’d vote for: clicking the buttons keeps the results open; behavior of enter should be configurable with the default “keep results open” (to be somewhat consistent with how the Command Finder behaves).

And thanks everyone for working on this awesome feature!


Seeing as Enter triggers the “run” command, I would definitely vote for the search window remaining open upon Enter.
Splitting the clicking / Enter behaviour doesn’t make much difference (sense) to me at this point.

Also, welcome back


I guess I disagree on that point but that’s really personal preference: if I am using enter I usually know what I want to do, while I am usually in exploration mode when I use the mouse.


Personally, I can’t think of a situation where I would want the search results window to close.

And I know this might conflict with the simpler programming solution, but I think it would make sense if pressing Enter had the same behavior as clicking Run, especially since Run is the highlighted button.

Thanks again for adding this feature. It is already saving time and effort for me and my users. :slight_smile:


First of all, thanks for this amazing feature!

I noticed that the macro recorder do not record when the search bar “run” button is used. Is that easily fixable ? (The same commands are well recorded when executed from ImageJ menu)



I noticed that as well. I also noticed that double-clicking a result does not perform the default action. I’ll work on fixing all of this.


Awesome job all (esp @haesleinhuepf). I noticed that the new search does not add the run command to the recent commands menu (hit ‘9’). I often use these two in concert. Is there something obvious I’m missing?



I uploaded ImageJ 2.0.0-rc-65 just now, which includes the following search bar improvements:

  • Result entries under Commands are now rendered and ordered more nicely, thanks to @frauzufall (see above).
  • When more entries exist than are being displayed, a counter is shown, thanks to @frauzufall (see above).
  • SciJava modules are now macro recordable—and accessible from recent commands—in more scenarios, including when they are run via the search results dialog.
  • The Search Bar options now have a “Close search results when performing default action” toggle, which is on by default, but when disabled keeps the Run action from closing the search results.
  • Double clicking a search result now runs the default action.
  • Under the hood, search action plugins are no longer able to demand that the search results be closed when they are executed (i.e.: the SearchAction#closesSearch method is now deprecated and ignored).

I believe this addresses all of the outstanding concerns above. Please start a new thread with any additional concerns, bugs, feature requests, etc.