src/view/MainViewManager.js
function addToWorkingSet(paneId, file, index, force) {
        // look for the file to have already been added to another pane
        var pane = _getPane(paneId);
        if (!pane) {
            throw new Error("invalid pane id: " + paneId);
        }

        var result = pane.reorderItem(file, index, force),
            entry = _makeMRUListEntry(file, pane.id);


        // handles the case of save as so that the file remains in the
        //  the same location in the working set as the file that was renamed
        if (result === pane.ITEM_FOUND_NEEDS_SORT) {
            console.warn("pane.reorderItem returned pane.ITEM_FOUND_NEEDS_SORT which shouldn't happen " + file);
            exports.trigger("workingSetSort", pane.id);
        } else if (result === pane.ITEM_NOT_FOUND) {
            index = pane.addToViewList(file, index);

            if (_findFileInMRUList(pane.id, file) === -1) {
                // Add to or update the position in MRU
                if (pane.getCurrentlyViewedFile() === file) {
                    _mruList.unshift(entry);
                } else {
                    _mruList.push(entry);
                }
            }

            exports.trigger("workingSetAdd", file, index, pane.id);
        }
    }
function addToWorkingSet(paneId, file, index, force) {
        // look for the file to have already been added to another pane
        var pane = _getPane(paneId);
        if (!pane) {
            throw new Error("invalid pane id: " + paneId);
        }

        var result = pane.reorderItem(file, index, force),
            entry = _makeMRUListEntry(file, pane.id);


        // handles the case of save as so that the file remains in the
        //  the same location in the working set as the file that was renamed
        if (result === pane.ITEM_FOUND_NEEDS_SORT) {
            console.warn("pane.reorderItem returned pane.ITEM_FOUND_NEEDS_SORT which shouldn't happen " + file);
            exports.trigger("workingSetSort", pane.id);
        } else if (result === pane.ITEM_NOT_FOUND) {
            index = pane.addToViewList(file, index);

            if (_findFileInMRUList(pane.id, file) === -1) {
                // Add to or update the position in MRU
                if (pane.getCurrentlyViewedFile() === file) {
                    _mruList.unshift(entry);
                } else {
                    _mruList.push(entry);
                }
            }

            exports.trigger("workingSetAdd", file, index, pane.id);
        }
    }
function addToWorkingSet ( paneId , file , index , force ) { // look for the file to have already been added to another pane var pane = _getPane ( paneId ) ; if ( ! pane ) { throw new Error ( "invalid pane id: " + paneId ) ; } var result = pane . reorderItem ( file , index , force ) , entry = _makeMRUListEntry ( file , pane . id ) ; // handles the case of save as so that the file remains in the //  the same location in the working set as the file that was renamed if ( result === pane . ITEM_FOUND_NEEDS_SORT ) { console . warn ( "pane.reorderItem returned pane.ITEM_FOUND_NEEDS_SORT which shouldn't happen " + file ) ; exports . trigger ( "workingSetSort" , pane . id ) ; } else if ( result === pane . ITEM_NOT_FOUND ) { index = pane . addToViewList ( file , index ) ; if ( _findFileInMRUList ( pane . id , file ) === - 1 ) { // Add to or update the position in MRU if ( pane . getCurrentlyViewedFile ( ) === file ) { _mruList . unshift ( entry ) ; } else { _mruList . push ( entry ) ; } } exports . trigger ( "workingSetAdd" , file , index , pane . id ) ; } }
Adds the given file to the end of the workingset, if it is not already there.
This API does not create a view of the file, it just adds it to the working set
Views of files in the working set are persisted and are not destroyed until the user
closes the file using FILE_CLOSE; Views are created using FILE_OPEN and, when opened, are
made the current view. If a File is already opened then the file is just made current
and its view is shown.
@param {!string} paneId - The id of the pane in which to add the file object to or ACTIVE_PANE
@param {!File} file - The File object to add to the workingset
@param {number=} index - Position to add to list (defaults to last); -1 is ignored
@param {boolean=} forceRedraw - If true, a workingset change notification is always sent
(useful if suppressRedraw was used with removeView() earlier)
Adds the given file to the end of the workingset if it is not already there . This API does not create a view of the file it just adds it to the working set Views of files in the working set are persisted and are not destroyed until the user closes the file using FILE_CLOSE ; Views are created using FILE_OPEN and when opened are made the current view . If a File is already opened then the file is just made current and its view is shown .