Can `dialog` really be something other than `instanceof FindInFilesDialog`? This check doesn't seem necessary, although might want to check `if (dialog)`.