|
28 | 28 | define(function (require, exports, module) { |
29 | 29 | "use strict"; |
30 | 30 |
|
| 31 | + var DeprecationWarning = require("utils/DeprecationWarning"); |
| 32 | + |
| 33 | + /** |
| 34 | + * @private |
| 35 | + * Create a deprecation warning and action for updated Command constants |
| 36 | + * @param {!string} oldConstant |
| 37 | + * @param {!string} newConstant |
| 38 | + */ |
| 39 | + function _deprecateCommand(oldConstant, newConstant) { |
| 40 | + var warning = "Use Commands." + newConstant + " instead of Commands." + oldConstant + ".", |
| 41 | + newValue = exports[newConstant]; |
| 42 | + |
| 43 | + Object.defineProperty(exports, oldConstant, { |
| 44 | + get: function () { |
| 45 | + DeprecationWarning.deprecationWarning(warning, true); |
| 46 | + return newValue; |
| 47 | + } |
| 48 | + }); |
| 49 | + } |
| 50 | + |
31 | 51 | /** |
32 | 52 | * List of constants for global command IDs. |
33 | 53 | */ |
@@ -85,18 +105,6 @@ define(function (require, exports, module) { |
85 | 105 | exports.TOGGLE_CLOSE_BRACKETS = "edit.autoCloseBrackets"; // EditorOptionHandlers.js _getToggler() |
86 | 106 | exports.SHOW_CODE_HINTS = "edit.showCodeHints"; // CodeHintManager.js _startNewSession() |
87 | 107 |
|
88 | | - // DEPRECATED: Redirect Edit commands that were moved from the Edit Menu to the Find Menu |
89 | | - exports.EDIT_FIND = "cmd.find"; // FindReplace.js _launchFind() |
90 | | - exports.EDIT_FIND_IN_FILES = "cmd.findInFiles"; // FindInFiles.js _doFindInFiles() |
91 | | - exports.EDIT_FIND_IN_SELECTED = "cmd.findInSelected"; // FindInFiles.js _doFindInSubtree() |
92 | | - exports.EDIT_FIND_IN_SUBTREE = "cmd.findInSubtree"; // FindInFiles.js _doFindInSubtree() |
93 | | - exports.EDIT_FIND_NEXT = "cmd.findNext"; // FindReplace.js _findNext() |
94 | | - exports.EDIT_FIND_PREVIOUS = "cmd.findPrevious"; // FindReplace.js _findPrevious() |
95 | | - exports.EDIT_FIND_ALL_AND_SELECT = "cmd.findAllAndSelect"; // FindReplace.js _findAllAndSelect() |
96 | | - exports.EDIT_ADD_NEXT_MATCH = "cmd.addNextMatch"; // FindReplace.js _expandAndAddNextToSelection() |
97 | | - exports.EDIT_SKIP_CURRENT_MATCH = "cmd.skipCurrentMatch"; // FindReplace.js _skipCurrentMatch() |
98 | | - exports.EDIT_REPLACE = "cmd.replace"; // FindReplace.js _replace() |
99 | | - |
100 | 108 | // FIND |
101 | 109 | exports.CMD_FIND = "cmd.find"; // FindReplace.js _launchFind() |
102 | 110 | exports.CMD_FIND_IN_FILES = "cmd.findInFiles"; // FindInFiles.js _doFindInFiles() |
@@ -161,5 +169,16 @@ define(function (require, exports, module) { |
161 | 169 | // File shell callbacks - string must MATCH string in native code (appshell/command_callbacks.h) |
162 | 170 | exports.APP_ABORT_QUIT = "app.abort_quit"; // DocumentCommandHandlers.js handleAbortQuit() |
163 | 171 | exports.APP_BEFORE_MENUPOPUP = "app.before_menupopup"; // DocumentCommandHandlers.js handleBeforeMenuPopup() |
| 172 | + |
| 173 | + // DEPRECATED: Edit commands that were moved from the Edit Menu to the Find Menu |
| 174 | + _deprecateCommand("EDIT_FIND", "CMD_FIND"); |
| 175 | + _deprecateCommand("EDIT_FIND_IN_SELECTED", "CMD_FIND_IN_SELECTED"); |
| 176 | + _deprecateCommand("EDIT_FIND_IN_SUBTREE", "CMD_FIND_IN_SUBTREE"); |
| 177 | + _deprecateCommand("EDIT_FIND_NEXT", "CMD_FIND_NEXT"); |
| 178 | + _deprecateCommand("EDIT_FIND_PREVIOUS", "CMD_FIND_PREVIOUS"); |
| 179 | + _deprecateCommand("EDIT_FIND_ALL_AND_SELECT", "CMD_FIND_ALL_AND_SELECT"); |
| 180 | + _deprecateCommand("EDIT_ADD_NEXT_MATCH", "CMD_ADD_NEXT_MATCH"); |
| 181 | + _deprecateCommand("EDIT_SKIP_CURRENT_MATCH", "CMD_SKIP_CURRENT_MATCH"); |
| 182 | + _deprecateCommand("EDIT_REPLACE", "CMD_REPLACE"); |
164 | 183 | }); |
165 | 184 |
|
0 commit comments