src/project/FileViewController.js
function openAndSelectDocument(fullPath, fileSelectionFocus, paneId) {
        var result,
            curDocChangedDueToMe = _curDocChangedDueToMe;

        function _getDerivedPaneContext() {

            function _secondPaneContext() {
                return (window.event.ctrlKey || window.event.metaKey) && window.event.altKey ? MainViewManager.SECOND_PANE : null;
            }

            function _firstPaneContext() {
                return (window.event.ctrlKey || window.event.metaKey) ? MainViewManager.FIRST_PANE : null;
            }

            return window.event && (_secondPaneContext() || _firstPaneContext());
        }

        if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) {
            console.error("Bad parameter passed to FileViewController.openAndSelectDocument");
            return;
        }

        // Opening files are asynchronous and we want to know when this function caused a file
        // to open so that _fileSelectionFocus is set appropriatly. _curDocChangedDueToMe is set here
        // and checked in the currentFileChange handler
        _curDocChangedDueToMe = true;

        _fileSelectionFocus = fileSelectionFocus;


        paneId = (paneId || _getDerivedPaneContext() || MainViewManager.ACTIVE_PANE);

        // If fullPath corresonds to the current doc being viewed then opening the file won't
        // trigger a currentFileChange event, so we need to trigger a documentSelectionFocusChange
        // in this case to signify the selection focus has changed even though the current document has not.
        var currentPath = MainViewManager.getCurrentlyViewedPath(paneId);
        if (currentPath === fullPath) {
            _activatePane(paneId);
            result = (new $.Deferred()).resolve().promise();
        } else {
            result = CommandManager.execute(Commands.FILE_OPEN, {fullPath: fullPath,
                                                                 paneId: paneId});
        }

        // clear after notification is done
        result.always(function () {
            _curDocChangedDueToMe = curDocChangedDueToMe;
        });

        return result;
    }
function openAndSelectDocument(fullPath, fileSelectionFocus, paneId) {
        var result,
            curDocChangedDueToMe = _curDocChangedDueToMe;

        function _getDerivedPaneContext() {

            function _secondPaneContext() {
                return (window.event.ctrlKey || window.event.metaKey) && window.event.altKey ? MainViewManager.SECOND_PANE : null;
            }

            function _firstPaneContext() {
                return (window.event.ctrlKey || window.event.metaKey) ? MainViewManager.FIRST_PANE : null;
            }

            return window.event && (_secondPaneContext() || _firstPaneContext());
        }

        if (fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW) {
            console.error("Bad parameter passed to FileViewController.openAndSelectDocument");
            return;
        }

        // Opening files are asynchronous and we want to know when this function caused a file
        // to open so that _fileSelectionFocus is set appropriatly. _curDocChangedDueToMe is set here
        // and checked in the currentFileChange handler
        _curDocChangedDueToMe = true;

        _fileSelectionFocus = fileSelectionFocus;


        paneId = (paneId || _getDerivedPaneContext() || MainViewManager.ACTIVE_PANE);

        // If fullPath corresonds to the current doc being viewed then opening the file won't
        // trigger a currentFileChange event, so we need to trigger a documentSelectionFocusChange
        // in this case to signify the selection focus has changed even though the current document has not.
        var currentPath = MainViewManager.getCurrentlyViewedPath(paneId);
        if (currentPath === fullPath) {
            _activatePane(paneId);
            result = (new $.Deferred()).resolve().promise();
        } else {
            result = CommandManager.execute(Commands.FILE_OPEN, {fullPath: fullPath,
                                                                 paneId: paneId});
        }

        // clear after notification is done
        result.always(function () {
            _curDocChangedDueToMe = curDocChangedDueToMe;
        });

        return result;
    }
function openAndSelectDocument ( fullPath , fileSelectionFocus , paneId ) { var result , curDocChangedDueToMe = _curDocChangedDueToMe ; function _getDerivedPaneContext ( ) { function _secondPaneContext ( ) { return ( window . event . ctrlKey || window . event . metaKey ) && window . event . altKey ? MainViewManager . SECOND_PANE : null ; } function _firstPaneContext ( ) { return ( window . event . ctrlKey || window . event . metaKey ) ? MainViewManager . FIRST_PANE : null ; } return window . event && ( _secondPaneContext ( ) || _firstPaneContext ( ) ) ; } if ( fileSelectionFocus !== PROJECT_MANAGER && fileSelectionFocus !== WORKING_SET_VIEW ) { console . error ( "Bad parameter passed to FileViewController.openAndSelectDocument" ) ; return ; } // Opening files are asynchronous and we want to know when this function caused a file // to open so that _fileSelectionFocus is set appropriatly. _curDocChangedDueToMe is set here // and checked in the currentFileChange handler _curDocChangedDueToMe = true ; _fileSelectionFocus = fileSelectionFocus ; paneId = ( paneId || _getDerivedPaneContext ( ) || MainViewManager . ACTIVE_PANE ) ; // If fullPath corresonds to the current doc being viewed then opening the file won't // trigger a currentFileChange event, so we need to trigger a documentSelectionFocusChange // in this case to signify the selection focus has changed even though the current document has not. var currentPath = MainViewManager . getCurrentlyViewedPath ( paneId ) ; if ( currentPath === fullPath ) { _activatePane ( paneId ) ; result = ( new $ . Deferred ( ) ) . resolve ( ) . promise ( ) ; } else { result = CommandManager . execute ( Commands . FILE_OPEN , { fullPath : fullPath , paneId : paneId } ) ; } // clear after notification is done result . always ( function ( ) { _curDocChangedDueToMe = curDocChangedDueToMe ; } ) ; return result ; }
Opens a document if it's not open and selects the file in the UI corresponding to
fileSelectionFocus
@param {!fullPath} fullPath - full path of the document to open
@param {string} fileSelectionFocus - (WORKING_SET_VIEW || PROJECT_MANAGER)
@param {string} paneId - pane in which to open the document
@return {$.Promise}
Opens a document if it s not open and selects the file in the UI corresponding to fileSelectionFocus