OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * | |
11 * 2. Redistributions in binary form must reproduce the above | |
12 * copyright notice, this list of conditions and the following disclaimer | |
13 * in the documentation and/or other materials provided with the | |
14 * distribution. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS | |
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. | |
20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 */ | |
28 | |
29 /** | |
30 * @constructor | |
31 * @extends {WebInspector.PanelDescriptor} | |
32 * @implements {WebInspector.ContextMenu.Provider} | |
33 */ | |
34 WebInspector.ScriptsPanelDescriptor = function() | |
35 { | |
36 WebInspector.PanelDescriptor.call(this, "scripts", WebInspector.UIString("So
urces"), "ScriptsPanel", "ScriptsPanel.js"); | |
37 WebInspector.ContextMenu.registerProvider(this); | |
38 } | |
39 | |
40 WebInspector.ScriptsPanelDescriptor.prototype = { | |
41 /** | |
42 * @param {WebInspector.ContextMenu} contextMenu | |
43 * @param {Object} target | |
44 */ | |
45 appendApplicableItems: function(event, contextMenu, target) | |
46 { | |
47 var hasApplicableItems = target instanceof WebInspector.UISourceCode; | |
48 | |
49 if (!hasApplicableItems && target instanceof WebInspector.RemoteObject)
{ | |
50 var remoteObject = /** @type {WebInspector.RemoteObject} */ (target)
; | |
51 if (remoteObject.type !== "function") | |
52 return; | |
53 } | |
54 | |
55 this.panel().appendApplicableItems(event, contextMenu, target); | |
56 }, | |
57 | |
58 registerShortcuts: function() | |
59 { | |
60 var section = WebInspector.shortcutsScreen.section(WebInspector.UIString
("Sources Panel")); | |
61 | |
62 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.PauseContinue, WebInspector.UIString("Pause/Continue")); | |
63 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.StepOver, WebInspector.UIString("Step over")); | |
64 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.StepInto, WebInspector.UIString("Step into")); | |
65 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.StepIntoSelection, WebInspector.UIString("Step into selection")); | |
66 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.StepOut, WebInspector.UIString("Step out")); | |
67 | |
68 var nextAndPrevFrameKeys = WebInspector.ScriptsPanelDescriptor.ShortcutK
eys.NextCallFrame.concat(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCa
llFrame); | |
69 section.addRelatedKeys(nextAndPrevFrameKeys, WebInspector.UIString("Next
/previous call frame")); | |
70 | |
71 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.EvaluateSelectionInConsole, WebInspector.UIString("Evaluate selection in conso
le")); | |
72 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.GoToMember, WebInspector.UIString("Go to member")); | |
73 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.ToggleBreakpoint, WebInspector.UIString("Toggle breakpoint")); | |
74 section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKey
s.ToggleComment, WebInspector.UIString("Toggle comment")); | |
75 }, | |
76 | |
77 __proto__: WebInspector.PanelDescriptor.prototype | |
78 } | |
79 | |
80 WebInspector.ScriptsPanelDescriptor.ShortcutKeys = { | |
81 RunSnippet: [ | |
82 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Enter, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) | |
83 ], | |
84 | |
85 PauseContinue: [ | |
86 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F8), | |
87 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Backslash, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) | |
88 ], | |
89 | |
90 StepOver: [ | |
91 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F10), | |
92 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.SingleQuote, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) | |
93 ], | |
94 | |
95 StepInto: [ | |
96 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F11), | |
97 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) | |
98 ], | |
99 | |
100 StepIntoSelection: [ | |
101 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta), | |
102 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.Keyboa
rdShortcut.Modifiers.CtrlOrMeta) | |
103 ], | |
104 | |
105 StepOut: [ | |
106 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift), | |
107 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.
KeyboardShortcut.Modifiers.CtrlOrMeta) | |
108 ], | |
109 | |
110 EvaluateSelectionInConsole: [ | |
111 WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardS
hortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.Ctrl) | |
112 ], | |
113 | |
114 GoToMember: [ | |
115 WebInspector.KeyboardShortcut.makeDescriptor("o", WebInspector.KeyboardS
hortcut.Modifiers.CtrlOrMeta | WebInspector.KeyboardShortcut.Modifiers.Shift) | |
116 ], | |
117 | |
118 ToggleBreakpoint: [ | |
119 WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardS
hortcut.Modifiers.CtrlOrMeta) | |
120 ], | |
121 | |
122 NextCallFrame: [ | |
123 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Period, WebInspector.KeyboardShortcut.Modifiers.Ctrl) | |
124 ], | |
125 | |
126 PrevCallFrame: [ | |
127 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Comma, WebInspector.KeyboardShortcut.Modifiers.Ctrl) | |
128 ], | |
129 | |
130 ToggleComment: [ | |
131 WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortc
ut.Keys.Slash, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) | |
132 | |
133 ] | |
134 }; | |
OLD | NEW |