Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1186)

Side by Side Diff: Source/devtools/front_end/console/ConsoleView.js

Issue 1273363002: Devtools UI: Show multiple shortcuts, show more shortcuts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 this._visibleViewMessages = []; 52 this._visibleViewMessages = [];
53 this._urlToMessageCount = {}; 53 this._urlToMessageCount = {};
54 this._hiddenByFilterCount = 0; 54 this._hiddenByFilterCount = 0;
55 55
56 /** 56 /**
57 * @type {!Array.<!WebInspector.ConsoleView.RegexMatchRange>} 57 * @type {!Array.<!WebInspector.ConsoleView.RegexMatchRange>}
58 */ 58 */
59 this._regexMatchRanges = []; 59 this._regexMatchRanges = [];
60 60
61 this._clearConsoleButton = new WebInspector.ToolbarButton(WebInspector.UIStr ing("Clear console log"), "clear-toolbar-item"); 61 this._clearConsoleButton = new WebInspector.ToolbarButton(WebInspector.UIStr ing("Clear console log"), "clear-toolbar-item");
62 this._clearConsoleButton.addEventListener("click", this._requestClearMessage s, this); 62 this._clearConsoleButton.setAction("console.clear");
pfeldman 2015/08/17 19:22:49 I think you should build it from the action and if
63 63
64 this._executionContextComboBox = new WebInspector.ToolbarComboBox(null, "con sole-context"); 64 this._executionContextComboBox = new WebInspector.ToolbarComboBox(null, "con sole-context");
65 this._executionContextComboBox.setMaxWidth(200); 65 this._executionContextComboBox.setMaxWidth(200);
66 this._executionContextModel = new WebInspector.ExecutionContextModel(this._e xecutionContextComboBox.selectElement()); 66 this._executionContextModel = new WebInspector.ExecutionContextModel(this._e xecutionContextComboBox.selectElement());
67 67
68 this._filter = new WebInspector.ConsoleViewFilter(this); 68 this._filter = new WebInspector.ConsoleViewFilter(this);
69 this._filter.addEventListener(WebInspector.ConsoleViewFilter.Events.FilterCh anged, this._updateMessageList.bind(this)); 69 this._filter.addEventListener(WebInspector.ConsoleViewFilter.Events.FilterCh anged, this._updateMessageList.bind(this));
70 70
71 this._filterBar = new WebInspector.FilterBar("consoleView"); 71 this._filterBar = new WebInspector.FilterBar("consoleView");
72 72
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 572
573 for (var url in this._filter.messageURLFilters) { 573 for (var url in this._filter.messageURLFilters) {
574 filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)", new WebIn spector.ParsedURL(url).displayName, this._urlToMessageCount[url]), this._filter. removeMessageURLFilter.bind(this._filter, url), true); 574 filterSubMenu.appendCheckboxItem(String.sprintf("%s (%d)", new WebIn spector.ParsedURL(url).displayName, this._urlToMessageCount[url]), this._filter. removeMessageURLFilter.bind(this._filter, url), true);
575 hasFilters = true; 575 hasFilters = true;
576 } 576 }
577 577
578 filterSubMenu.setEnabled(hasFilters || (consoleMessage && consoleMessage .url)); 578 filterSubMenu.setEnabled(hasFilters || (consoleMessage && consoleMessage .url));
579 unhideAll.setEnabled(hasFilters); 579 unhideAll.setEnabled(hasFilters);
580 580
581 contextMenu.appendSeparator(); 581 contextMenu.appendSeparator();
582 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^console" ), this._requestClearMessages.bind(this)); 582 contextMenu.appendAction(WebInspector.UIString("Clear console"), "consol e.clear");
pfeldman 2015/08/17 19:22:49 Like we do to context menus in here.
583 contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveCo nsole.bind(this)); 583 contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveCo nsole.bind(this));
584 584
585 var request = consoleMessage ? consoleMessage.request : null; 585 var request = consoleMessage ? consoleMessage.request : null;
586 if (request && request.resourceType() === WebInspector.resourceTypes.XHR ) { 586 if (request && request.resourceType() === WebInspector.resourceTypes.XHR ) {
587 contextMenu.appendSeparator(); 587 contextMenu.appendSeparator();
588 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), request. replayXHR.bind(request)); 588 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), request. replayXHR.bind(request));
589 } 589 }
590 590
591 contextMenu.show(); 591 contextMenu.show();
592 }, 592 },
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 }, 701 },
702 702
703 _registerShortcuts: function() 703 _registerShortcuts: function()
704 { 704 {
705 this._shortcuts = {}; 705 this._shortcuts = {};
706 706
707 var shortcut = WebInspector.KeyboardShortcut; 707 var shortcut = WebInspector.KeyboardShortcut;
708 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Console")); 708 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Console"));
709 709
710 var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortc ut.Modifiers.Ctrl); 710 var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortc ut.Modifiers.Ctrl);
711 this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this);
712 var keys = [shortcutL]; 711 var keys = [shortcutL];
713 if (WebInspector.isMac()) { 712 if (WebInspector.isMac()) {
714 var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardSh ortcut.Modifiers.Meta); 713 var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardSh ortcut.Modifiers.Meta);
715 this._shortcuts[shortcutK.key] = this._requestClearMessages.bind(thi s);
716 keys.unshift(shortcutK); 714 keys.unshift(shortcutK);
717 } 715 }
718 section.addAlternateKeys(keys, WebInspector.UIString("Clear console")); 716 section.addAlternateKeys(keys, WebInspector.UIString("Clear console"));
719 717
720 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tab), WebInspector. UIString("Autocomplete common prefix")); 718 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tab), WebInspector. UIString("Autocomplete common prefix"));
721 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Right), WebInspecto r.UIString("Accept suggestion")); 719 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Right), WebInspecto r.UIString("Accept suggestion"));
722 720
723 var shortcutU = shortcut.makeDescriptor("u", WebInspector.KeyboardShortc ut.Modifiers.Ctrl); 721 var shortcutU = shortcut.makeDescriptor("u", WebInspector.KeyboardShortc ut.Modifiers.Ctrl);
724 this._shortcuts[shortcutU.key] = this._clearPromptBackwards.bind(this); 722 this._shortcuts[shortcutU.key] = this._clearPromptBackwards.bind(this);
725 section.addAlternateKeys([shortcutU], WebInspector.UIString("Clear conso le prompt")); 723 section.addAlternateKeys([shortcutU], WebInspector.UIString("Clear conso le prompt"));
(...skipping 13 matching lines...) Expand all
739 } 737 }
740 738
741 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspecto r.UIString("Execute command")); 739 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspecto r.UIString("Execute command"));
742 }, 740 },
743 741
744 _clearPromptBackwards: function() 742 _clearPromptBackwards: function()
745 { 743 {
746 this._prompt.setText(""); 744 this._prompt.setText("");
747 }, 745 },
748 746
749 _requestClearMessages: function()
750 {
751 var targets = WebInspector.targetManager.targets();
752 for (var i = 0; i < targets.length; ++i)
753 targets[i].consoleModel.requestClearMessages();
754 },
755
756 _promptKeyDown: function(event) 747 _promptKeyDown: function(event)
757 { 748 {
758 if (isEnterKey(event)) { 749 if (isEnterKey(event)) {
759 this._enterKeyPressed(event); 750 this._enterKeyPressed(event);
760 return; 751 return;
761 } 752 }
762 753
763 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); 754 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
764 var handler = this._shortcuts[shortcut]; 755 var handler = this._shortcuts[shortcut];
765 if (handler) { 756 if (handler) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 parentGroup: function() 1273 parentGroup: function()
1283 { 1274 {
1284 return this._parentGroup || this; 1275 return this._parentGroup || this;
1285 }, 1276 },
1286 } 1277 }
1287 1278
1288 /** 1279 /**
1289 * @constructor 1280 * @constructor
1290 * @implements {WebInspector.ActionDelegate} 1281 * @implements {WebInspector.ActionDelegate}
1291 */ 1282 */
1292 WebInspector.ConsoleView.ShowConsoleActionDelegate = function() 1283 WebInspector.ConsoleView.ActionDelegate = function()
1293 { 1284 {
1294 } 1285 }
1295 1286
1296 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { 1287 WebInspector.ConsoleView.ActionDelegate.prototype = {
1297 /** 1288 /**
1298 * @override 1289 * @override
1299 * @param {!WebInspector.Context} context 1290 * @param {!WebInspector.Context} context
1300 * @param {string} actionId 1291 * @param {string} actionId
1301 */ 1292 */
1302 handleAction: function(context, actionId) 1293 handleAction: function(context, actionId)
1303 { 1294 {
1304 WebInspector.console.show(); 1295 if (actionId === "console.show")
1296 WebInspector.console.show();
1297 else if (actionId === "console.clear")
1298 WebInspector.ConsoleModel.clearConsole();
1305 } 1299 }
1306 } 1300 }
1307 1301
1308 /** 1302 /**
1309 * @typedef {{messageIndex: number, matchIndex: number}} 1303 * @typedef {{messageIndex: number, matchIndex: number}}
1310 */ 1304 */
1311 WebInspector.ConsoleView.RegexMatchRange; 1305 WebInspector.ConsoleView.RegexMatchRange;
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/console/module.json » ('j') | Source/devtools/front_end/console/module.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698