From 9f985c7631f2e6073645986242b2282b90eb16a1 Mon Sep 17 00:00:00 2001 From: Glenn Ruehle Date: Fri, 12 Jul 2013 17:18:43 -0700 Subject: [PATCH 1/2] Skip dropped files that are already open. --- src/utils/DragAndDrop.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index 3fedc0733fa..0f5de71beaf 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -33,6 +33,7 @@ define(function (require, exports, module) { Commands = require("command/Commands"), Dialogs = require("widgets/Dialogs"), DefaultDialogs = require("widgets/DefaultDialogs"), + DocumentManager = require("document/DocumentManager"), FileUtils = require("file/FileUtils"), ProjectManager = require("project/ProjectManager"), Strings = require("strings"), @@ -73,12 +74,22 @@ define(function (require, exports, module) { function openDroppedFiles(files) { var errorFiles = []; - return Async.doInParallel(files, function (file) { + return Async.doInParallel(files, function (file, idx) { var result = new $.Deferred(); // Only open files brackets.fs.stat(file, function (err, stat) { if (!err && stat.isFile()) { + // If the file is already open, and this isn't the last + // file in the list, return. If this *is* the last file, + // always open it so it gets selected. + if (idx < files.count - 1) { + if (DocumentManager.findInWorkingSet(file) !== -1) { + result.resolve(); + return; + } + } + CommandManager.execute(Commands.FILE_ADD_TO_WORKING_SET, {fullPath: file, silent: true}) .done(function () { From 01008ef7afb38b6552b3396eaed63736c2ab50bf Mon Sep 17 00:00:00 2001 From: Glenn Ruehle Date: Mon, 15 Jul 2013 13:49:44 -0700 Subject: [PATCH 2/2] It's length, not count. --- src/utils/DragAndDrop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index 0f5de71beaf..9de126cecf4 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -83,7 +83,7 @@ define(function (require, exports, module) { // If the file is already open, and this isn't the last // file in the list, return. If this *is* the last file, // always open it so it gets selected. - if (idx < files.count - 1) { + if (idx < files.length - 1) { if (DocumentManager.findInWorkingSet(file) !== -1) { result.resolve(); return;