code: function openNewFile() {
                  var fileOpenPromise;
  
                  if (FileViewController.getFileSelectionFocus() === FileViewController.PROJECT_MANAGER) {
                      // If selection is in the tree, leave workingset unchanged - even if orig file is in the list
                      fileOpenPromise = FileViewController
                          .openAndSelectDocument(path, FileViewController.PROJECT_MANAGER);
                  } else {
                      // If selection is in workingset, replace orig item in place with the new file
                      var info = MainViewManager.findInAllWorkingSets(doc.file.fullPath).shift();
  
                      // Remove old file from workingset; no redraw yet since there's a pause before the new file is opened
                      MainViewManager._removeView(info.paneId, doc.file, true);
  
                      // Add new file to workingset, and ensure we now redraw (even if index hasn't changed)
                      fileOpenPromise = handleFileAddToWorkingSetAndOpen({fullPath: path, paneId: info.paneId, index: info.index, forceRedraw: true});
                  }
  
                  // always configure editor after file is opened
                  fileOpenPromise.always(function () {
                      _configureEditorAndResolve();
                  });
              }
docs: Replace old document with new one in open editor & workingset