In the next release of RSTA, the “mark all” API will be moved into SearchEngine, so that it is a one-stop shop for everything related to search. Further, these methods will return a new SearchResult object, containing more uniform, detailed information on the result of the operation.

The find() and replace() methods will now check context.getMarkAll(), and if it returns true, they will automatically perform a “mark all” operation along with the find/replace requested. This is very useful because often, people want to visually see what other matches are nearby the one actually found and selected.

The search-related components in RSTAUI have been updated as well. Besides the existing Find and Replace dialogs, there are now two new components – FindToolBar and ReplaceToolBar. When wrapped in a CollapsibleSectionPanel, these tool bars can provide a search UI integrated into an application’s main window, as opposed to the standard approach of modal dialogs. This is the trendy new way of doing things. In addition, these components use an animation to “slide” in and out of the UI, breathing a little bit of life into a Swing application.

Below is an example of setting up a window where Ctrl+F and Ctrl+H will bring up a FindToolBar and ReplaceToolBar, respectively:

Ctrl+F/Ctrl+H toggles between them, and Escape hides the currently visible one, if any. If “Mark All” is enabled, all matches are selected in the editor as you type, which is a very nice feature. The “mark all” event waits for a short time after you stop typing before it fires (defaulting to 200 ms). That way, it doesn’t perform a mark-all operation for each letter you type if you type really quickly.

Just like the older Find and Replace dialogs, the Find and Replace tool bars will offer code completion for regular expressions:

Regex assistance

This code is already pushed to GitHub; all I have left to do is some more testing. I also plan on improving the performance of “mark all;” it’s slower than the “mark occurrences” support in RSTA and there’s no reason for that. And since these new components make it so easy and handy to have “mark all” enabled all the time, I figured I’d go ahead and knock that out sooner rather than later.