Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2037 from adobe/jasonsanjose/closeall
Browse files Browse the repository at this point in the history
add close all menu item and keyboard shortcut Cmd+Shift+W
  • Loading branch information
redmunds committed Nov 2, 2012
2 parents a3178e9 + c6fc48d commit 8206b35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.FILE_OPEN, "Ctrl-O");
menu.addMenuItem(Commands.FILE_OPEN_FOLDER);
menu.addMenuItem(Commands.FILE_CLOSE, "Ctrl-W");
menu.addMenuItem(Commands.FILE_CLOSE_ALL, "Ctrl-Shift-W");
menu.addMenuDivider();
menu.addMenuItem(Commands.FILE_SAVE, "Ctrl-S");
menu.addMenuItem(Commands.FILE_SAVE_ALL, "Ctrl-Alt-S");
Expand Down
7 changes: 4 additions & 3 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ define(function (require, exports, module) {
* @return {$.Promise} a promise that is resolved when all files are closed
*/
function handleFileCloseAll(commandData) {
var result = new $.Deferred();
var result = new $.Deferred(),
promptOnly = commandData && commandData.promptOnly;

var unsavedDocs = [];
DocumentManager.getWorkingSet().forEach(function (file) {
Expand All @@ -627,7 +628,7 @@ define(function (require, exports, module) {

} else if (unsavedDocs.length === 1) {
// Only one unsaved file: show the usual single-file-close confirmation UI
var fileCloseArgs = { file: unsavedDocs[0].file, promptOnly: commandData.promptOnly };
var fileCloseArgs = { file: unsavedDocs[0].file, promptOnly: promptOnly };

handleFileClose(fileCloseArgs).done(function () {
// still need to close any other, non-unsaved documents
Expand Down Expand Up @@ -673,7 +674,7 @@ define(function (require, exports, module) {
// NOTE: this still happens before any done() handlers added by our caller, because jQ
// guarantees that handlers run in the order they are added.
result.done(function () {
if (!commandData || !commandData.promptOnly) {
if (!promptOnly) {
DocumentManager.closeAll();
}
});
Expand Down

0 comments on commit 8206b35

Please sign in to comment.