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

Commit 56ab3e9

Browse files
committed
Add deprecation code
1 parent d298003 commit 56ab3e9

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

src/command/Commands.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ define(function (require, exports, module) {
8585
exports.TOGGLE_CLOSE_BRACKETS = "edit.autoCloseBrackets"; // EditorOptionHandlers.js _getToggler()
8686
exports.SHOW_CODE_HINTS = "edit.showCodeHints"; // CodeHintManager.js _startNewSession()
8787

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+
88100
// FIND
89101
exports.CMD_FIND = "cmd.find"; // FindReplace.js _launchFind()
90102
exports.CMD_FIND_IN_FILES = "cmd.findInFiles"; // FindInFiles.js _doFindInFiles()

src/command/Menus.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ define(function (require, exports, module) {
3737
StringUtils = require("utils/StringUtils"),
3838
CommandManager = require("command/CommandManager"),
3939
PopUpManager = require("widgets/PopUpManager"),
40-
ViewUtils = require("utils/ViewUtils");
40+
ViewUtils = require("utils/ViewUtils"),
41+
DeprecationWarning = require("utils/DeprecationWarning");
4142

4243
/**
4344
* Brackets Application Menu Constants
@@ -91,6 +92,10 @@ define(function (require, exports, module) {
9192
EDIT_CODE_HINTS_COMMANDS: {sectionMarker: Commands.SHOW_CODE_HINTS},
9293
EDIT_TOGGLE_OPTIONS: {sectionMarker: Commands.TOGGLE_CLOSE_BRACKETS},
9394

95+
// DEPRECATED: Old Edit menu sections redirected to existing Edit menu section
96+
EDIT_FIND_COMMANDS: {sectionMarker: Commands.TOGGLE_CLOSE_BRACKETS},
97+
EDIT_REPLACE_COMMANDS: {sectionMarker: Commands.TOGGLE_CLOSE_BRACKETS},
98+
9499
FIND_FIND_COMMANDS: {sectionMarker: Commands.CMD_FIND},
95100
FIND_FIND_IN_COMMANDS: {sectionMarker: Commands.CMD_FIND_IN_FILES},
96101
FIND_REPLACE_COMMANDS: {sectionMarker: Commands.CMD_REPLACE},
@@ -362,7 +367,7 @@ define(function (require, exports, module) {
362367
*/
363368
Menu.prototype._getRelativeMenuItem = function (relativeID, position) {
364369
var $relativeElement;
365-
370+
366371
if (relativeID) {
367372
if (position === FIRST_IN_SECTION || position === LAST_IN_SECTION) {
368373
if (!relativeID.hasOwnProperty("sectionMarker")) {
@@ -550,7 +555,15 @@ define(function (require, exports, module) {
550555
menuItem,
551556
name,
552557
commandID;
553-
558+
559+
if (relativeID === MenuSection.EDIT_FIND_COMMANDS) {
560+
DeprecationWarning.deprecationWarning("Add " + command + " Command to the Find Menu instead of the Edit Menu.", true);
561+
DeprecationWarning.deprecationWarning("Use MenuSection.FIND_FIND_COMMANDS instead of MenuSection.EDIT_FIND_COMMANDS.", true);
562+
} else if (relativeID === MenuSection.EDIT_REPLACE_COMMANDS) {
563+
DeprecationWarning.deprecationWarning("Add " + command + "Command to the Find Menu instead of the Edit Menu.", true);
564+
DeprecationWarning.deprecationWarning("Use MenuSection.FIND_REPLACE_COMMANDS instead of MenuSection.EDIT_REPLACE_COMMANDS.", true);
565+
}
566+
554567
if (!command) {
555568
console.error("addMenuItem(): missing required parameters: command");
556569
return null;

0 commit comments

Comments
 (0)