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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 var hasShortcuts = button.shortcuts && button.shortcuts.length; | 701 var hasShortcuts = button.shortcuts && button.shortcuts.length; |
702 if (hasShortcuts) | 702 if (hasShortcuts) |
703 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); | 703 button.title = String.vsprintf(buttonTitle, [button.shortcuts[0].nam
e]); |
704 else | 704 else |
705 button.title = buttonTitle; | 705 button.title = buttonTitle; |
706 }, | 706 }, |
707 | 707 |
708 /** | 708 /** |
709 * @param {string} buttonId | 709 * @param {string} buttonId |
710 * @param {string} buttonTitle | 710 * @param {string} buttonTitle |
711 * @param {function(!Event=):boolean} handler | 711 * @param {function(!Event=)} handler |
712 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts | 712 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts |
713 * @return {!WebInspector.StatusBarButton} | 713 * @return {!WebInspector.StatusBarButton} |
714 */ | 714 */ |
715 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) | 715 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler,
shortcuts) |
716 { | 716 { |
717 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); | 717 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); |
718 button.element.addEventListener("click", handler, false); | 718 button.element.addEventListener("click", handler, false); |
719 button.shortcuts = shortcuts; | 719 button.shortcuts = shortcuts; |
720 this._updateButtonTitle(button, buttonTitle); | 720 this._updateButtonTitle(button, buttonTitle); |
721 this.registerShortcuts(shortcuts, handler); | 721 this.registerShortcuts(shortcuts, handler); |
722 return button; | 722 return button; |
723 }, | 723 }, |
724 | 724 |
725 /** | 725 /** |
726 * @param {string} buttonId | 726 * @param {string} buttonId |
727 * @param {string} buttonTitle | 727 * @param {string} buttonTitle |
728 * @param {string} actionId | 728 * @param {string} actionId |
729 * @return {!WebInspector.StatusBarButton} | 729 * @return {!WebInspector.StatusBarButton} |
730 */ | 730 */ |
731 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle,
actionId) | 731 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle,
actionId) |
732 { | 732 { |
733 /** | |
734 * @return {boolean} | |
735 */ | |
736 function handler() | 733 function handler() |
737 { | 734 { |
738 return WebInspector.actionRegistry.execute(actionId); | 735 WebInspector.actionRegistry.execute(actionId); |
739 } | 736 } |
740 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForActi
on(actionId); | 737 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForActi
on(actionId); |
741 return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, han
dler, shortcuts); | 738 return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, han
dler, shortcuts); |
742 }, | 739 }, |
743 | 740 |
744 addToWatch: function(expression) | 741 addToWatch: function(expression) |
745 { | 742 { |
746 this.sidebarPanes.watchExpressions.addExpression(expression); | 743 this.sidebarPanes.watchExpressions.addExpression(expression); |
747 }, | 744 }, |
748 | 745 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 | 1403 |
1407 WebInspector.SourcesPanelFactory.prototype = { | 1404 WebInspector.SourcesPanelFactory.prototype = { |
1408 /** | 1405 /** |
1409 * @return {!WebInspector.Panel} | 1406 * @return {!WebInspector.Panel} |
1410 */ | 1407 */ |
1411 createPanel: function() | 1408 createPanel: function() |
1412 { | 1409 { |
1413 return WebInspector.SourcesPanel.instance(); | 1410 return WebInspector.SourcesPanel.instance(); |
1414 } | 1411 } |
1415 } | 1412 } |
OLD | NEW |