From d07a5e95186e4f898054b572cb8f52500397ed04 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Tue, 1 Aug 2017 13:10:29 -0400 Subject: [PATCH] Review fixes --- src/filesystem/impls/filer/ArchiveUtils.js | 24 ++++++---------------- src/project/FileViewController.js | 22 ++++++++------------ 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/filesystem/impls/filer/ArchiveUtils.js b/src/filesystem/impls/filer/ArchiveUtils.js index 49c491b0577..d0ac49f6c08 100644 --- a/src/filesystem/impls/filer/ArchiveUtils.js +++ b/src/filesystem/impls/filer/ArchiveUtils.js @@ -63,7 +63,6 @@ define(function (require, exports, module) { // zipfile can be a path (string) to a zipfile, or raw binary data. function unzip(zipfile, options, callback) { var projectPrefix = StartupState.project("zipFilenamePrefix").replace(/\/?$/, "/"); - var pathsToOpen = []; if(typeof options === 'function') { callback = options; @@ -110,13 +109,7 @@ define(function (require, exports, module) { var basedir = Path.dirname(path.absPath); function writeFile() { - FilerUtils - .writeFileAsBinary(path.absPath, path.data) - .done(function() { - pathsToOpen.push(path.absPath); - callback(); - }) - .fail(callback); + FilerUtils.writeFileAsBinary(path.absPath, path.data, callback); } if(path.isDirectory) { @@ -158,7 +151,8 @@ define(function (require, exports, module) { DefaultDialogs.DIALOG_ID_INFO, Strings.DND_SUCCESS_UNZIP_TITLE ).getPromise().then(function() { - callback(null, pathsToOpen); + // We don't bother sending a list of files to open for archives. + callback(null, []); }, callback); }); }); @@ -258,7 +252,6 @@ define(function (require, exports, module) { options = options || {}; callback = callback || function(){}; - var pathsToOpen = []; var untarWorker = new Worker("thirdparty/bitjs/bitjs-untar.min.js"); var root = options.root || StartupState.project("root"); var pending = null; @@ -276,13 +269,7 @@ define(function (require, exports, module) { return callback(err); } - FilerUtils - .writeFileAsBinary(path, new Buffer(data)) - .done(function() { - pathsToOpen.push(path.absPath); - callback(); - }) - .fail(callback); + FilerUtils.writeFileAsBinary(path, new Buffer(data), callback); }); } @@ -299,7 +286,8 @@ define(function (require, exports, module) { DefaultDialogs.DIALOG_ID_INFO, Strings.DND_SUCCESS_UNTAR_TITLE ).getPromise().then(function() { - callback(null, pathsToOpen); + // We don't bother sending a list of files to open for archives. + callback(null, []); }, callback); }); } diff --git a/src/project/FileViewController.js b/src/project/FileViewController.js index 1cc852a7781..ece4f353b6d 100644 --- a/src/project/FileViewController.js +++ b/src/project/FileViewController.js @@ -76,7 +76,7 @@ define(function (require, exports, module) { */ EventDispatcher.on_duringInit(MainViewManager, "workingSetAdd", function (event, addedFile) { // XXXBramble: always keep focus on the Project Manager vs. Working Set View - _fileSelectionFocus = WORKING_SET_VIEW; + _fileSelectionFocus = PROJECT_MANAGER; exports.trigger("documentSelectionFocusChange"); }); /** @@ -87,11 +87,11 @@ define(function (require, exports, module) { if (!_curDocChangedDueToMe) { // The the cause of the doc change was not openAndSelectDocument, so pick the best fileSelectionFocus perfTimerName = PerfUtils.markStart("FileViewController._oncurrentFileChange():\t" + (file ? (file.fullPath) : "(no open file)")); - - // XXXBramble: always keep focus on the Project Manager vs. Working Set View - _fileSelectionFocus = PROJECT_MANAGER; } + // XXXBramble: always keep focus on the Project Manager vs. Working Set View + _fileSelectionFocus = PROJECT_MANAGER; + exports.trigger("documentSelectionFocusChange"); if (!_curDocChangedDueToMe) { @@ -125,13 +125,9 @@ define(function (require, exports, module) { console.error("Bad parameter passed to FileViewController.setFileViewFocus"); return; } - // XXXBramble: always keep focus on the Project Manager vs. Working Set View - fileSelectionFocus = PROJECT_MANAGER; - - if (_fileSelectionFocus !== fileSelectionFocus) { - _fileSelectionFocus = fileSelectionFocus; - exports.trigger("fileViewFocusChange"); - } + // XXXBramble: always keep focus on the Project Manager vs. Working Set View + _fileSelectionFocus = PROJECT_MANAGER; + exports.trigger("fileViewFocusChange"); } /** @@ -169,8 +165,8 @@ define(function (require, exports, module) { // and checked in the currentFileChange handler _curDocChangedDueToMe = true; - _fileSelectionFocus = fileSelectionFocus; - + // XXXBramble: always keep focus on the Project Manager vs. Working Set View + _fileSelectionFocus = PROJECT_MANAGER; paneId = (paneId || _getDerivedPaneContext() || MainViewManager.ACTIVE_PANE);