src/search/FindInFilesUI.js
function searchAndShowResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
        return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise)
            .done(function (zeroFilesToken) {
                // Done searching all files: show results
                if (FindInFiles.searchModel.hasResults()) {
                    _resultsView.open();

                    if (_findBar) {
                        _findBar.enable(true);
                        _findBar.focus();
                    }

                } else {
                    _resultsView.close();

                    if (_findBar) {
                        var showMessage = false;
                        _findBar.enable(true);
                        if (zeroFilesToken === FindInFiles.ZERO_FILES_TO_SEARCH) {
                            _findBar.showError(StringUtils.format(Strings.FIND_IN_FILES_ZERO_FILES,
                                FindUtils.labelForScope(FindInFiles.searchModel.scope)), true);
                        } else {
                            showMessage = true;
                        }
                        _findBar.showNoResults(true, showMessage);
                    }
                }

                StatusBar.hideBusyIndicator();
            })
            .fail(function (err) {
                console.log("find in files failed: ", err);
                StatusBar.hideBusyIndicator();
            });
    }
function searchAndShowResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
        return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise)
            .done(function (zeroFilesToken) {
                // Done searching all files: show results
                if (FindInFiles.searchModel.hasResults()) {
                    _resultsView.open();

                    if (_findBar) {
                        _findBar.enable(true);
                        _findBar.focus();
                    }

                } else {
                    _resultsView.close();

                    if (_findBar) {
                        var showMessage = false;
                        _findBar.enable(true);
                        if (zeroFilesToken === FindInFiles.ZERO_FILES_TO_SEARCH) {
                            _findBar.showError(StringUtils.format(Strings.FIND_IN_FILES_ZERO_FILES,
                                FindUtils.labelForScope(FindInFiles.searchModel.scope)), true);
                        } else {
                            showMessage = true;
                        }
                        _findBar.showNoResults(true, showMessage);
                    }
                }

                StatusBar.hideBusyIndicator();
            })
            .fail(function (err) {
                console.log("find in files failed: ", err);
                StatusBar.hideBusyIndicator();
            });
    }
function searchAndShowResults ( queryInfo , scope , filter , replaceText , candidateFilesPromise ) { return FindInFiles . doSearchInScope ( queryInfo , scope , filter , replaceText , candidateFilesPromise ) . done ( function ( zeroFilesToken ) { // Done searching all files: show results if ( FindInFiles . searchModel . hasResults ( ) ) { _resultsView . open ( ) ; if ( _findBar ) { _findBar . enable ( true ) ; _findBar . focus ( ) ; } } else { _resultsView . close ( ) ; if ( _findBar ) { var showMessage = false ; _findBar . enable ( true ) ; if ( zeroFilesToken === FindInFiles . ZERO_FILES_TO_SEARCH ) { _findBar . showError ( StringUtils . format ( Strings . FIND_IN_FILES_ZERO_FILES , FindUtils . labelForScope ( FindInFiles . searchModel . scope ) ) , true ) ; } else { showMessage = true ; } _findBar . showNoResults ( true , showMessage ) ; } } StatusBar . hideBusyIndicator ( ) ; } ) . fail ( function ( err ) { console . log ( "find in files failed: " , err ) ; StatusBar . hideBusyIndicator ( ) ; } ) ; }
Does a search in the given scope with the given filter. Shows the result list once the search is complete.
@param {{query: string, caseSensitive: boolean, isRegexp: boolean}} queryInfo Query info object
@param {?Entry} scope Project file/subfolder to search within; else searches whole project.
@param {?string} filter A "compiled" filter as returned by FileFilters.compile(), or null for no filter
@param {?string} replaceText If this is a replacement, the text to replace matches with.
@param {?$.Promise} candidateFilesPromise If specified, a promise that should resolve with the same set of files that
getCandidateFiles(scope) would return.
@return {$.Promise} A promise that's resolved with the search results or rejected when the find competes.
Does a search in the given scope with the given filter . Shows the result list once the search is complete .