From c9ca76b918149d9023772c7fde9fffe443b4e7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Malbr=C3=A1n?= Date: Sat, 9 Mar 2013 20:16:19 -0300 Subject: [PATCH 1/5] Improving the Dialog API --- src/LiveDevelopment/LiveDevelopment.js | 2 +- src/LiveDevelopment/main.js | 2 +- src/document/DocumentCommandHandlers.js | 6 +- .../htmlContent/sampleHTMLFragment.html | 24 +-- .../samples/LocalizationExample/main.js | 8 +- src/file/FileUtils.js | 2 +- src/htmlContent/dialog-template.html | 14 ++ src/htmlContent/main-view.html | 62 ------ src/preferences/PreferencesDialogs.js | 2 +- src/project/FileIndexManager.js | 77 ++++---- src/project/FileSyncManager.js | 4 +- src/project/ProjectManager.js | 2 +- src/styles/brackets_patterns_override.less | 10 + src/utils/UpdateNotification.js | 2 +- src/widgets/Dialogs.js | 180 +++++++++++------- src/widgets/default-dialogs.json | 82 ++++++++ 16 files changed, 269 insertions(+), 210 deletions(-) create mode 100644 src/htmlContent/dialog-template.html create mode 100644 src/widgets/default-dialogs.json diff --git a/src/LiveDevelopment/LiveDevelopment.js b/src/LiveDevelopment/LiveDevelopment.js index 07eb68ebe07..25bc70e2258 100644 --- a/src/LiveDevelopment/LiveDevelopment.js +++ b/src/LiveDevelopment/LiveDevelopment.js @@ -529,7 +529,7 @@ define(function LiveDevelopment(require, exports, module) { Dialogs.DIALOG_ID_LIVE_DEVELOPMENT, Strings.LIVE_DEVELOPMENT_RELAUNCH_TITLE, Strings.LIVE_DEVELOPMENT_ERROR_MESSAGE - ).done(function (id) { + ).getPromise().done(function (id) { if (id === Dialogs.DIALOG_BTN_OK) { // User has chosen to reload Chrome, quit the running instance _setStatus(STATUS_INACTIVE); diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index d10939d7cf4..aa6c712ceda 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -126,7 +126,7 @@ define(function main(require, exports, module) { Dialogs.DIALOG_ID_INFO, Strings.LIVE_DEVELOPMENT_INFO_TITLE, Strings.LIVE_DEVELOPMENT_INFO_MESSAGE - ).done(function (id) { + ).getPromise().done(function (id) { LiveDevelopment.open(); }); } else { diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index 9cfb87fd866..02a0c849cfd 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -375,7 +375,7 @@ define(function (require, exports, module) { StringUtils.htmlEscape(path), FileUtils.getFileErrorString(name) ) - ); + ).getPromise(); } /** Note: if there is an error, the promise is not rejected until the user has dimissed the dialog */ @@ -562,7 +562,7 @@ define(function (require, exports, module) { Dialogs.DIALOG_ID_SAVE_CLOSE, Strings.SAVE_CLOSE_TITLE, StringUtils.format(Strings.SAVE_CLOSE_MESSAGE, StringUtils.htmlEscape(filename)) - ).done(function (id) { + ).getPromise().done(function (id) { if (id === Dialogs.DIALOG_BTN_CANCEL) { result.reject(); } else if (id === Dialogs.DIALOG_BTN_OK) { @@ -654,7 +654,7 @@ define(function (require, exports, module) { Dialogs.DIALOG_ID_SAVE_CLOSE, Strings.SAVE_CLOSE_TITLE, message - ).done(function (id) { + ).getPromise().done(function (id) { if (id === Dialogs.DIALOG_BTN_CANCEL) { result.reject(); } else if (id === Dialogs.DIALOG_BTN_OK) { diff --git a/src/extensions/samples/LocalizationExample/htmlContent/sampleHTMLFragment.html b/src/extensions/samples/LocalizationExample/htmlContent/sampleHTMLFragment.html index 10a35c2ef88..9cde6a38eb5 100644 --- a/src/extensions/samples/LocalizationExample/htmlContent/sampleHTMLFragment.html +++ b/src/extensions/samples/LocalizationExample/htmlContent/sampleHTMLFragment.html @@ -1,26 +1,4 @@ - - -