Index: Source/devtools/front_end/console/ConsoleView.js |
diff --git a/Source/devtools/front_end/console/ConsoleView.js b/Source/devtools/front_end/console/ConsoleView.js |
index 7c51da8a8af96c7d13c8ce4bea5d4c97a7a693fd..02fdc59a93b54f1c3cfe65514f53d842e61c0c23 100644 |
--- a/Source/devtools/front_end/console/ConsoleView.js |
+++ b/Source/devtools/front_end/console/ConsoleView.js |
@@ -58,8 +58,7 @@ WebInspector.ConsoleView = function() |
*/ |
this._regexMatchRanges = []; |
- this._clearConsoleButton = new WebInspector.ToolbarButton(WebInspector.UIString("Clear console log"), "clear-toolbar-item"); |
- this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this); |
+ this._clearConsoleButton = WebInspector.ToolbarButton.createActionButton("console.clear"); |
this._executionContextComboBox = new WebInspector.ToolbarComboBox(null, "console-context"); |
this._executionContextComboBox.setMaxWidth(200); |
@@ -579,7 +578,7 @@ WebInspector.ConsoleView.prototype = { |
unhideAll.setEnabled(hasFilters); |
contextMenu.appendSeparator(); |
- contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^console"), this._requestClearMessages.bind(this)); |
+ contextMenu.appendAction("console.clear"); |
contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveConsole.bind(this)); |
var request = consoleMessage ? consoleMessage.request : null; |
@@ -708,11 +707,9 @@ WebInspector.ConsoleView.prototype = { |
var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); |
var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); |
- this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this); |
var keys = [shortcutL]; |
if (WebInspector.isMac()) { |
var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta); |
- this._shortcuts[shortcutK.key] = this._requestClearMessages.bind(this); |
keys.unshift(shortcutK); |
} |
section.addAlternateKeys(keys, WebInspector.UIString("Clear console")); |
@@ -746,13 +743,6 @@ WebInspector.ConsoleView.prototype = { |
this._prompt.setText(""); |
}, |
- _requestClearMessages: function() |
- { |
- var targets = WebInspector.targetManager.targets(); |
- for (var i = 0; i < targets.length; ++i) |
- targets[i].consoleModel.requestClearMessages(); |
- }, |
- |
_promptKeyDown: function(event) |
{ |
if (isEnterKey(event)) { |
@@ -1289,11 +1279,11 @@ WebInspector.ConsoleGroup.prototype = { |
* @constructor |
* @implements {WebInspector.ActionDelegate} |
*/ |
-WebInspector.ConsoleView.ShowConsoleActionDelegate = function() |
+WebInspector.ConsoleView.ActionDelegate = function() |
{ |
} |
-WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
+WebInspector.ConsoleView.ActionDelegate.prototype = { |
/** |
* @override |
* @param {!WebInspector.Context} context |
@@ -1301,7 +1291,10 @@ WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
*/ |
handleAction: function(context, actionId) |
{ |
- WebInspector.console.show(); |
+ if (actionId === "console.show") |
+ WebInspector.console.show(); |
+ else if (actionId === "console.clear") |
+ WebInspector.ConsoleModel.clearConsole(); |
} |
} |