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

Fix #2902: Externalize debug menu as an extension #2942

Merged
merged 9 commits into from
Feb 26, 2013
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/brackets.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"app_title" : "Brackets",
"app_name_about" : "Brackets",
"about_icon" : "styles/images/brackets_icon.svg",
"show_debug_menu" : true,
"enable_jslint" : true,
"update_info_url" : "http://dev.brackets.io/updates/stable/",
"how_to_use_url" : "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
Expand Down
1 change: 0 additions & 1 deletion src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ define(function (require, exports, module) {
require("document/ChangedDocumentTracker");
require("editor/EditorCommandHandlers");
require("view/ViewCommandHandlers");
require("debug/DebugCommandHandlers");
require("help/HelpCommandHandlers");
require("search/FindInFiles");
require("search/FindReplace");
Expand Down
20 changes: 0 additions & 20 deletions src/command/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ define(function (require, exports, module) {
EDIT_MENU : "edit-menu",
VIEW_MENU : "view-menu",
NAVIGATE_MENU : "navigate-menu",
DEBUG_MENU : "debug-menu", // Note: not present in some configurations of Brackets (getMenu() will return null)
HELP_MENU : "help-menu"
};

Expand Down Expand Up @@ -1074,25 +1073,6 @@ define(function (require, exports, module) {
menu.addMenuItem(Commands.QUICK_EDIT_PREV_MATCH);
menu.addMenuItem(Commands.QUICK_EDIT_NEXT_MATCH);

/*
* Debug menu
*/
if (brackets.config.show_debug_menu) {
menu = addMenu(Strings.DEBUG_MENU, AppMenuBar.DEBUG_MENU);
menu.addMenuItem(Commands.DEBUG_SHOW_DEVELOPER_TOOLS);
menu.addMenuItem(Commands.DEBUG_REFRESH_WINDOW);
menu.addMenuItem(Commands.DEBUG_NEW_BRACKETS_WINDOW);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_SWITCH_LANGUAGE);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_RUN_UNIT_TESTS);
menu.addMenuItem(Commands.DEBUG_SHOW_PERF_DATA);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_ENABLE_NODE_DEBUGGER);
menu.addMenuItem(Commands.DEBUG_LOG_NODE_STATE);
menu.addMenuItem(Commands.DEBUG_RESTART_NODE);
}

/*
* Help menu
*/
Expand Down
1 change: 0 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"app_title": "Brackets",
"app_name_about": "Brackets",
"about_icon": "styles/images/brackets_icon.svg",
"show_debug_menu": true,
"enable_jslint": true,
"update_info_url": "http://dev.brackets.io/updates/stable/",
"how_to_use_url": "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",
Expand Down
4 changes: 2 additions & 2 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,6 @@ define(function (require, exports, module) {
CommandManager.register(Strings.CMD_QUIT, Commands.FILE_QUIT, handleFileQuit);
}

CommandManager.register(Strings.CMD_REFRESH_WINDOW, Commands.DEBUG_REFRESH_WINDOW, handleFileReload)
.setEnabled(brackets.config.show_debug_menu);
CommandManager.register(Strings.CMD_ABORT_QUIT, Commands.APP_ABORT_QUIT, _handleAbortQuit);

CommandManager.register(Strings.CMD_NEXT_DOC, Commands.NAVIGATE_NEXT_DOC, handleGoNextDoc);
Expand All @@ -911,5 +909,7 @@ define(function (require, exports, module) {
// Listen for changes that require updating the editor titlebar
$(DocumentManager).on("dirtyFlagChange", handleDirtyChange);
$(DocumentManager).on("currentDocumentChange fileNameChange", updateDocumentTitle);

exports.handleFileReload = handleFileReload;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a cleaner way to do this would be to refactor _handleWindowGoingAway to some other module like Global.js and move handleFileReload to the debug extension.

});

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
define(function (require, exports, module) {
"use strict";

var NodeConnection = require("utils/NodeConnection");
var NodeConnection = brackets.getModule("utils/NodeConnection");

/**
* @private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@
define(function (require, exports, module) {
"use strict";

var Commands = require("command/Commands"),
CommandManager = require("command/CommandManager"),
Editor = require("editor/Editor").Editor,
FileUtils = require("file/FileUtils"),
Strings = require("strings"),
PerfUtils = require("utils/PerfUtils"),
NativeApp = require("utils/NativeApp"),
NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
NodeDebugUtils = require("debug/NodeDebugUtils");
var Commands = brackets.getModule("command/Commands"),
CommandManager = brackets.getModule("command/CommandManager"),
DocumentCommandHandlers = brackets.getModule("document/DocumentCommandHandlers"),
Editor = brackets.getModule("editor/Editor").Editor,
FileUtils = brackets.getModule("file/FileUtils"),
Menus = brackets.getModule("command/Menus"),
Strings = brackets.getModule("strings"),
PerfUtils = brackets.getModule("utils/PerfUtils"),
NativeApp = brackets.getModule("utils/NativeApp"),
NativeFileSystem = brackets.getModule("file/NativeFileSystem").NativeFileSystem,
NodeDebugUtils = require("NodeDebugUtils");

/** @const {string} Brackets Application Menu Constant */
var DEBUG_MENU = "debug-menu";


function handleShowDeveloperTools(commandData) {
brackets.app.showDeveloperTools();
Expand Down Expand Up @@ -259,11 +265,13 @@ define(function (require, exports, module) {
);
}


/* Register all the command handlers */

// Show Developer Tools (optionally enabled)
CommandManager.register(Strings.CMD_SHOW_DEV_TOOLS, Commands.DEBUG_SHOW_DEVELOPER_TOOLS, handleShowDeveloperTools)
.setEnabled(!!brackets.app.showDeveloperTools && brackets.config.show_debug_menu);
.setEnabled(!!brackets.app.showDeveloperTools);
CommandManager.register(Strings.CMD_REFRESH_WINDOW, Commands.DEBUG_REFRESH_WINDOW, DocumentCommandHandlers.handleFileReload);
CommandManager.register(Strings.CMD_NEW_BRACKETS_WINDOW, Commands.DEBUG_NEW_BRACKETS_WINDOW, _handleNewBracketsWindow);

// Start with the "Run Tests" item disabled. It will be enabled later if the test file can be found.
Expand All @@ -275,12 +283,31 @@ define(function (require, exports, module) {


// Node-related Commands
CommandManager.register(Strings.CMD_ENABLE_NODE_DEBUGGER, Commands.DEBUG_ENABLE_NODE_DEBUGGER, NodeDebugUtils.enableDebugger);
CommandManager.register(Strings.CMD_LOG_NODE_STATE, Commands.DEBUG_LOG_NODE_STATE, NodeDebugUtils.logNodeState);
CommandManager.register(Strings.CMD_RESTART_NODE, Commands.DEBUG_RESTART_NODE, NodeDebugUtils.restartNode);
CommandManager.register(Strings.CMD_ENABLE_NODE_DEBUGGER, Commands.DEBUG_ENABLE_NODE_DEBUGGER, NodeDebugUtils.enableDebugger);
CommandManager.register(Strings.CMD_LOG_NODE_STATE, Commands.DEBUG_LOG_NODE_STATE, NodeDebugUtils.logNodeState);
CommandManager.register(Strings.CMD_RESTART_NODE, Commands.DEBUG_RESTART_NODE, NodeDebugUtils.restartNode);

_enableRunTestsMenuItem();


/*
* Debug menu
*/
var menu = Menus.addMenu(Strings.DEBUG_MENU, DEBUG_MENU, Menus.BEFORE, Menus.AppMenuBar.HELP_MENU);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to refactor the 2 debug keyboard shortcuts out of src/base-config/keyboard.json into this extension.

menu.addMenuItem(Commands.DEBUG_SHOW_DEVELOPER_TOOLS);
menu.addMenuItem(Commands.DEBUG_REFRESH_WINDOW);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the KeyBindingManager calls above and pass keybindings to addMenuItem for both:

menu.addMenuItem(Commands. DEBUG_SHOW_DEVELOPER_TOOLS, KeyboardPrefs.showDeveloperTools);
menu.addMenuItem(Commands.DEBUG_REFRESH_WINDOW, KeyboardPrefs.refreshWindow);

menu.addMenuItem(Commands.DEBUG_NEW_BRACKETS_WINDOW);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_SWITCH_LANGUAGE);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_RUN_UNIT_TESTS);
menu.addMenuItem(Commands.DEBUG_SHOW_PERF_DATA);
menu.addMenuDivider();
menu.addMenuItem(Commands.DEBUG_ENABLE_NODE_DEBUGGER);
menu.addMenuItem(Commands.DEBUG_LOG_NODE_STATE);
menu.addMenuItem(Commands.DEBUG_RESTART_NODE);


// exposed for convenience, but not official API
exports._runUnitTests = _runUnitTests;
});
10 changes: 4 additions & 6 deletions test/perf/OpenFile-perf-files/brackets-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -36815,7 +36815,7 @@ define('editor/EditorCommandHandlers',['require','exports','module','command/Com
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this file. This is only for performance testing and we need this snapshot to stay intact. Thanks!

/*global define, $, brackets, window */

define('debug/DebugCommandHandlers',['require','exports','module','command/Commands','command/CommandManager','editor/Editor','strings','utils/PerfUtils','utils/NativeApp','file/NativeFileSystem','file/FileUtils','utils/UpdateNotification'],function (require, exports, module) {
define(['require','exports','module','command/Commands','command/CommandManager','editor/Editor','strings','utils/PerfUtils','utils/NativeApp','file/NativeFileSystem','file/FileUtils','utils/UpdateNotification'],function (require, exports, module) {


var Commands = require("command/Commands"),
Expand Down Expand Up @@ -37941,7 +37941,7 @@ require.config({
* htmlContentLoadComplete - sent when the HTML DOM is fully loaded. Modules should not touch
* or modify DOM elements before this event is sent.
*/
define('brackets',['require','exports','module','widgets/bootstrap-dropdown','widgets/bootstrap-modal','thirdparty/path-utils/path-utils.min','thirdparty/smart-auto-complete/jquery.smart_autocomplete','LiveDevelopment/main','project/ProjectManager','document/DocumentManager','editor/EditorManager','editor/CSSInlineEditor','language/JSUtils','project/WorkingSetView','document/DocumentCommandHandlers','project/FileViewController','project/FileSyncManager','command/KeyBindingManager','command/Commands','command/CommandManager','utils/BuildInfoUtils','editor/CodeHintManager','language/JSLintUtils','utils/PerfUtils','project/FileIndexManager','search/QuickOpen','command/Menus','file/FileUtils','text!htmlContent/main-view.html','strings','widgets/Dialogs','utils/ExtensionLoader','project/SidebarView','utils/Async','utils/UpdateNotification','utils/UrlParams','document/ChangedDocumentTracker','editor/EditorCommandHandlers','debug/DebugCommandHandlers','view/ViewCommandHandlers','search/FindInFiles','search/FindReplace','utils/ExtensionUtils','utils/ShellAPI','preferences/PreferencesManager','command/CommandManager','language/CSSUtils','LiveDevelopment/LiveDevelopment','LiveDevelopment/Inspector/Inspector','utils/NativeApp','utils/ExtensionUtils','utils/UpdateNotification'],function (require, exports, module) {
define('brackets',['require','exports','module','widgets/bootstrap-dropdown','widgets/bootstrap-modal','thirdparty/path-utils/path-utils.min','thirdparty/smart-auto-complete/jquery.smart_autocomplete','LiveDevelopment/main','project/ProjectManager','document/DocumentManager','editor/EditorManager','editor/CSSInlineEditor','language/JSUtils','project/WorkingSetView','document/DocumentCommandHandlers','project/FileViewController','project/FileSyncManager','command/KeyBindingManager','command/Commands','command/CommandManager','utils/BuildInfoUtils','editor/CodeHintManager','language/JSLintUtils','utils/PerfUtils','project/FileIndexManager','search/QuickOpen','command/Menus','file/FileUtils','text!htmlContent/main-view.html','strings','widgets/Dialogs','utils/ExtensionLoader','project/SidebarView','utils/Async','utils/UpdateNotification','utils/UrlParams','document/ChangedDocumentTracker','editor/EditorCommandHandlers','view/ViewCommandHandlers','search/FindInFiles','search/FindReplace','utils/ExtensionUtils','utils/ShellAPI','preferences/PreferencesManager','command/CommandManager','language/CSSUtils','LiveDevelopment/LiveDevelopment','LiveDevelopment/Inspector/Inspector','utils/NativeApp','utils/ExtensionUtils','utils/UpdateNotification'],function (require, exports, module) {


// Load dependent non-module scripts
Expand Down Expand Up @@ -37994,7 +37994,6 @@ define('brackets',['require','exports','module','widgets/bootstrap-dropdown','wi
//Load modules that self-register and just need to get included in the main project
require("document/ChangedDocumentTracker");
require("editor/EditorCommandHandlers");
require("debug/DebugCommandHandlers");
require("view/ViewCommandHandlers");
require("search/FindInFiles");
require("search/FindReplace");
Expand Down Expand Up @@ -75069,7 +75068,7 @@ define('editor/EditorCommandHandlers',['require','exports','module','command/Com
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, window */

define('debug/DebugCommandHandlers',['require','exports','module','command/Commands','command/CommandManager','editor/Editor','strings','utils/PerfUtils','utils/NativeApp','file/NativeFileSystem','file/FileUtils','utils/UpdateNotification'],function (require, exports, module) {
define(['require','exports','module','command/Commands','command/CommandManager','editor/Editor','strings','utils/PerfUtils','utils/NativeApp','file/NativeFileSystem','file/FileUtils','utils/UpdateNotification'],function (require, exports, module) {


var Commands = require("command/Commands"),
Expand Down Expand Up @@ -76195,7 +76194,7 @@ require.config({
* htmlContentLoadComplete - sent when the HTML DOM is fully loaded. Modules should not touch
* or modify DOM elements before this event is sent.
*/
define('brackets',['require','exports','module','widgets/bootstrap-dropdown','widgets/bootstrap-modal','thirdparty/path-utils/path-utils.min','thirdparty/smart-auto-complete/jquery.smart_autocomplete','LiveDevelopment/main','project/ProjectManager','document/DocumentManager','editor/EditorManager','editor/CSSInlineEditor','language/JSUtils','project/WorkingSetView','document/DocumentCommandHandlers','project/FileViewController','project/FileSyncManager','command/KeyBindingManager','command/Commands','command/CommandManager','utils/BuildInfoUtils','editor/CodeHintManager','language/JSLintUtils','utils/PerfUtils','project/FileIndexManager','search/QuickOpen','command/Menus','file/FileUtils','text!htmlContent/main-view.html','strings','widgets/Dialogs','utils/ExtensionLoader','project/SidebarView','utils/Async','utils/UpdateNotification','utils/UrlParams','document/ChangedDocumentTracker','editor/EditorCommandHandlers','debug/DebugCommandHandlers','view/ViewCommandHandlers','search/FindInFiles','search/FindReplace','utils/ExtensionUtils','utils/ShellAPI','preferences/PreferencesManager','command/CommandManager','language/CSSUtils','LiveDevelopment/LiveDevelopment','LiveDevelopment/Inspector/Inspector','utils/NativeApp','utils/ExtensionUtils','utils/UpdateNotification'],function (require, exports, module) {
define('brackets',['require','exports','module','widgets/bootstrap-dropdown','widgets/bootstrap-modal','thirdparty/path-utils/path-utils.min','thirdparty/smart-auto-complete/jquery.smart_autocomplete','LiveDevelopment/main','project/ProjectManager','document/DocumentManager','editor/EditorManager','editor/CSSInlineEditor','language/JSUtils','project/WorkingSetView','document/DocumentCommandHandlers','project/FileViewController','project/FileSyncManager','command/KeyBindingManager','command/Commands','command/CommandManager','utils/BuildInfoUtils','editor/CodeHintManager','language/JSLintUtils','utils/PerfUtils','project/FileIndexManager','search/QuickOpen','command/Menus','file/FileUtils','text!htmlContent/main-view.html','strings','widgets/Dialogs','utils/ExtensionLoader','project/SidebarView','utils/Async','utils/UpdateNotification','utils/UrlParams','document/ChangedDocumentTracker','editor/EditorCommandHandlers','view/ViewCommandHandlers','search/FindInFiles','search/FindReplace','utils/ExtensionUtils','utils/ShellAPI','preferences/PreferencesManager','command/CommandManager','language/CSSUtils','LiveDevelopment/LiveDevelopment','LiveDevelopment/Inspector/Inspector','utils/NativeApp','utils/ExtensionUtils','utils/UpdateNotification'],function (require, exports, module) {


// Load dependent non-module scripts
Expand Down Expand Up @@ -76248,7 +76247,6 @@ define('brackets',['require','exports','module','widgets/bootstrap-dropdown','wi
//Load modules that self-register and just need to get included in the main project
require("document/ChangedDocumentTracker");
require("editor/EditorCommandHandlers");
require("debug/DebugCommandHandlers");
require("view/ViewCommandHandlers");
require("search/FindInFiles");
require("search/FindReplace");
Expand Down