Class SearchAndReplace

Search and replace routines are undertaken by jEdit's SearchAndReplace class.

The following static methods allow you to set or get the parameters for a search. You can do this prior to or even without activating the search dialog.

DirectoryListSet

This represents a set of files taken from a directory. It can be extended recursively to include files in subdirectories. The constructor for this class has the following syntax:

class AllBufferSet

This class represents the set of all buffers currently open. The constructor for this class takes a file mask as a single parameter:

class CurrentBufferSet

This class represents a buffer set consisting of the current buffer only. The constructor has no parameters.

The actual tasks of searching and replacing, based on these parameters, are performed by the following methods. The return value of each indicates whether the operation succeeded.

The "HyperSearch" and "Keep dialog" features, as reflected in checkbox options in the search dialog, are not handled from within SearchAndReplace. If you wish to have these options set before the search dialog appears, make a prior call to either or both of the following:

jEdit.setBooleanProperty("search.hypersearch.toggle",true);
jEdit.setBooleanProperty("search.keepDialog.toggle",true);

If you are not using the dialog to undertake a search or replace, you may call any of the search and replace methods (including hyperSearch()) without concern for the value of these properties.

To create and display the search and replace dialog, first assign desired values to the search settings using the methods described above. Then create a new SearchDialog object using the following static method in the SearchDialog class:

The parameter searchIn can take the defined constant values CURRENT_BUFFER, ALL_BUFFERS or DIRECTORY, defined in the SearchDialog class. This parameter determines which file set radio button to preselect in the dialog box.