Supporting find and replace over multiple documents

With SimplyHTML more than one document can be open at the same time. The find and replace logic introduced in stage 11 offers a way to apply find and replace to all open documents optionally. The way to apply find and replace to multiple documents can be customized in addition to account for different purposes such as applying find and replace to a set of documents inside a kind of 'project' as delivered by a possible SimplyHTML plug-in.

FindReplaceListener and FindReplaceEvent

To support find and replace over multiple documents interface FindReplaceListener and class FindReplaceEvent are used. An instance of class FindReplaceListener can be passed as a parameter during construction of a FindReplaceDialog . Passing a FindReplaceListener signals FindReplaceDialog that find and replace is to be performed over more than one document. FindReplaceDialog fires FindReplaceEvents to the given FindReplaceListener to signal that it is through with searching a particular document and that another document is required to continue.

Feedback during a multiple document process

The object registered as FindReplaceListener has to give feedback to FindReplaceDialog during multiple document operations. Methods getFirstDocument and getNextDocument have to call either FindReplaceDialog.resumeOperation or FindReplaceDialog.terminateOperation at their end, depending on whether or not there are documents left to process.