OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 var hasShortcuts = button.shortcuts && button.shortcuts.length; | 699 var hasShortcuts = button.shortcuts && button.shortcuts.length; |
700 if (hasShortcuts) | 700 if (hasShortcuts) |
701 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); | 701 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); |
702 else | 702 else |
703 button.title = buttonTitle; | 703 button.title = buttonTitle; |
704 }, | 704 }, |
705 | 705 |
706 /** | 706 /** |
707 * @param {string} buttonId | 707 * @param {string} buttonId |
708 * @param {string} buttonTitle | 708 * @param {string} buttonTitle |
709 * @param {function(!Event=):boolean} handler | 709 * @param {function(!Event=)} handler |
710 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts | 710 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts |
711 * @return {!WebInspector.StatusBarButton} | 711 * @return {!WebInspector.StatusBarButton} |
712 */ | 712 */ |
713 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) | 713 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) |
714 { | 714 { |
715 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); | 715 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); |
716 button.element.addEventListener("click", handler, false); | 716 button.element.addEventListener("click", handler, false); |
717 button.shortcuts = shortcuts; | 717 button.shortcuts = shortcuts; |
718 this._updateButtonTitle(button, buttonTitle); | 718 this._updateButtonTitle(button, buttonTitle); |
719 this.registerShortcuts(shortcuts, handler); | 719 this.registerShortcuts(shortcuts, handler); |
720 return button; | 720 return button; |
721 }, | 721 }, |
722 | 722 |
723 /** | 723 /** |
724 * @param {string} buttonId | 724 * @param {string} buttonId |
725 * @param {string} buttonTitle | 725 * @param {string} buttonTitle |
726 * @param {string} actionId | 726 * @param {string} actionId |
727 * @return {!WebInspector.StatusBarButton} | 727 * @return {!WebInspector.StatusBarButton} |
728 */ | 728 */ |
729 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle,
actionId) | 729 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle,
actionId) |
730 { | 730 { |
731 /** | |
732 * @return {boolean} | |
733 */ | |
734 function handler() | 731 function handler() |
735 { | 732 { |
736 return WebInspector.actionRegistry.execute(actionId); | 733 WebInspector.actionRegistry.execute(actionId); |
737 } | 734 } |
738 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForActi
on(actionId); | 735 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForActi
on(actionId); |
739 return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, han
dler, shortcuts); | 736 return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, han
dler, shortcuts); |
740 }, | 737 }, |
741 | 738 |
742 addToWatch: function(expression) | 739 addToWatch: function(expression) |
743 { | 740 { |
744 this.sidebarPanes.watchExpressions.addExpression(expression); | 741 this.sidebarPanes.watchExpressions.addExpression(expression); |
745 }, | 742 }, |
746 | 743 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 | 1401 |
1405 WebInspector.SourcesPanelFactory.prototype = { | 1402 WebInspector.SourcesPanelFactory.prototype = { |
1406 /** | 1403 /** |
1407 * @return {!WebInspector.Panel} | 1404 * @return {!WebInspector.Panel} |
1408 */ | 1405 */ |
1409 createPanel: function() | 1406 createPanel: function() |
1410 { | 1407 { |
1411 return WebInspector.SourcesPanel.instance(); | 1408 return WebInspector.SourcesPanel.instance(); |
1412 } | 1409 } |
1413 } | 1410 } |
OLD | NEW |