OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
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 * | 10 * |
(...skipping 12 matching lines...) Expand all Loading... |
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 /** | 29 /** |
30 * @extends {WebInspector.Object} | 30 * @extends {WebInspector.Object} |
31 * @constructor | 31 * @constructor |
32 */ | 32 */ |
33 WebInspector.ScriptsNavigator = function() | 33 WebInspector.SourcesNavigator = function() |
34 { | 34 { |
35 WebInspector.Object.call(this); | 35 WebInspector.Object.call(this); |
36 | 36 |
37 this._tabbedPane = new WebInspector.TabbedPane(); | 37 this._tabbedPane = new WebInspector.TabbedPane(); |
38 this._tabbedPane.shrinkableTabs = true; | 38 this._tabbedPane.shrinkableTabs = true; |
39 this._tabbedPane.element.addStyleClass("navigator-tabbed-pane"); | 39 this._tabbedPane.element.addStyleClass("navigator-tabbed-pane"); |
40 | 40 |
41 this._scriptsView = new WebInspector.NavigatorView(); | 41 this._sourcesView = new WebInspector.NavigatorView(); |
42 this._scriptsView.addEventListener(WebInspector.NavigatorView.Events.ItemSel
ected, this._scriptSelected, this); | 42 this._sourcesView.addEventListener(WebInspector.NavigatorView.Events.ItemSel
ected, this._sourceSelected, this); |
43 this._scriptsView.addEventListener(WebInspector.NavigatorView.Events.ItemSea
rchStarted, this._itemSearchStarted, this); | 43 this._sourcesView.addEventListener(WebInspector.NavigatorView.Events.ItemSea
rchStarted, this._itemSearchStarted, this); |
44 this._scriptsView.addEventListener(WebInspector.NavigatorView.Events.ItemRen
amingRequested, this._itemRenamingRequested, this); | 44 this._sourcesView.addEventListener(WebInspector.NavigatorView.Events.ItemRen
amingRequested, this._itemRenamingRequested, this); |
45 this._scriptsView.addEventListener(WebInspector.NavigatorView.Events.ItemCre
ationRequested, this._itemCreationRequested, this); | 45 this._sourcesView.addEventListener(WebInspector.NavigatorView.Events.ItemCre
ationRequested, this._itemCreationRequested, this); |
46 | 46 |
47 this._contentScriptsView = new WebInspector.NavigatorView(); | 47 this._contentScriptsView = new WebInspector.NavigatorView(); |
48 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemSelected, this._scriptSelected, this); | 48 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemSelected, this._sourceSelected, this); |
49 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemSearchStarted, this._itemSearchStarted, this); | 49 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemSearchStarted, this._itemSearchStarted, this); |
50 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemRenamingRequested, this._itemRenamingRequested, this); | 50 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemRenamingRequested, this._itemRenamingRequested, this); |
51 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemCreationRequested, this._itemCreationRequested, this); | 51 this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.
ItemCreationRequested, this._itemCreationRequested, this); |
52 | 52 |
53 this._snippetsView = new WebInspector.SnippetsNavigatorView(); | 53 this._snippetsView = new WebInspector.SnippetsNavigatorView(); |
54 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemSe
lected, this._scriptSelected, this); | 54 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemSe
lected, this._sourceSelected, this); |
55 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemSe
archStarted, this._itemSearchStarted, this); | 55 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemSe
archStarted, this._itemSearchStarted, this); |
56 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemRe
namingRequested, this._itemRenamingRequested, this); | 56 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemRe
namingRequested, this._itemRenamingRequested, this); |
57 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemCr
eationRequested, this._itemCreationRequested, this); | 57 this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemCr
eationRequested, this._itemCreationRequested, this); |
58 | 58 |
59 this._tabbedPane.appendTab(WebInspector.ScriptsNavigator.ScriptsTab, WebInsp
ector.UIString("Sources"), this._scriptsView); | 59 this._tabbedPane.appendTab(WebInspector.SourcesNavigator.SourcesTab, WebInsp
ector.UIString("Sources"), this._sourcesView); |
60 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ScriptsTab); | 60 this._tabbedPane.selectTab(WebInspector.SourcesNavigator.SourcesTab); |
61 this._tabbedPane.appendTab(WebInspector.ScriptsNavigator.ContentScriptsTab,
WebInspector.UIString("Content scripts"), this._contentScriptsView); | 61 this._tabbedPane.appendTab(WebInspector.SourcesNavigator.ContentScriptsTab,
WebInspector.UIString("Content scripts"), this._contentScriptsView); |
62 this._tabbedPane.appendTab(WebInspector.ScriptsNavigator.SnippetsTab, WebIns
pector.UIString("Snippets"), this._snippetsView); | 62 this._tabbedPane.appendTab(WebInspector.SourcesNavigator.SnippetsTab, WebIns
pector.UIString("Snippets"), this._snippetsView); |
63 } | 63 } |
64 | 64 |
65 WebInspector.ScriptsNavigator.Events = { | 65 WebInspector.SourcesNavigator.Events = { |
66 ScriptSelected: "ScriptSelected", | 66 SourceSelected: "SourceSelected", |
67 ItemCreationRequested: "ItemCreationRequested", | 67 ItemCreationRequested: "ItemCreationRequested", |
68 ItemRenamingRequested: "ItemRenamingRequested", | 68 ItemRenamingRequested: "ItemRenamingRequested", |
69 ItemSearchStarted: "ItemSearchStarted", | 69 ItemSearchStarted: "ItemSearchStarted", |
70 } | 70 } |
71 | 71 |
72 WebInspector.ScriptsNavigator.ScriptsTab = "scripts"; | 72 WebInspector.SourcesNavigator.SourcesTab = "sources"; |
73 WebInspector.ScriptsNavigator.ContentScriptsTab = "contentScripts"; | 73 WebInspector.SourcesNavigator.ContentScriptsTab = "contentScripts"; |
74 WebInspector.ScriptsNavigator.SnippetsTab = "snippets"; | 74 WebInspector.SourcesNavigator.SnippetsTab = "snippets"; |
75 | 75 |
76 WebInspector.ScriptsNavigator.prototype = { | 76 WebInspector.SourcesNavigator.prototype = { |
77 /* | 77 /* |
78 * @return {WebInspector.View} | 78 * @return {WebInspector.View} |
79 */ | 79 */ |
80 get view() | 80 get view() |
81 { | 81 { |
82 return this._tabbedPane; | 82 return this._tabbedPane; |
83 }, | 83 }, |
84 | 84 |
85 /** | 85 /** |
86 * @param {WebInspector.UISourceCode} uiSourceCode | 86 * @param {WebInspector.UISourceCode} uiSourceCode |
87 */ | 87 */ |
88 _navigatorViewForUISourceCode: function(uiSourceCode) | 88 _navigatorViewForUISourceCode: function(uiSourceCode) |
89 { | 89 { |
90 if (uiSourceCode.isContentScript) | 90 if (uiSourceCode.isContentScript) |
91 return this._contentScriptsView; | 91 return this._contentScriptsView; |
92 else if (uiSourceCode.project().type() === WebInspector.projectTypes.Sni
ppets) | 92 else if (uiSourceCode.project().type() === WebInspector.projectTypes.Sni
ppets) |
93 return this._snippetsView; | 93 return this._snippetsView; |
94 else | 94 else |
95 return this._scriptsView; | 95 return this._sourcesView; |
96 }, | 96 }, |
97 | 97 |
98 /** | 98 /** |
99 * @param {WebInspector.UISourceCode} uiSourceCode | 99 * @param {WebInspector.UISourceCode} uiSourceCode |
100 */ | 100 */ |
101 addUISourceCode: function(uiSourceCode) | 101 addUISourceCode: function(uiSourceCode) |
102 { | 102 { |
103 this._navigatorViewForUISourceCode(uiSourceCode).addUISourceCode(uiSourc
eCode); | 103 this._navigatorViewForUISourceCode(uiSourceCode).addUISourceCode(uiSourc
eCode); |
104 }, | 104 }, |
105 | 105 |
106 /** | 106 /** |
107 * @param {WebInspector.UISourceCode} uiSourceCode | 107 * @param {WebInspector.UISourceCode} uiSourceCode |
108 */ | 108 */ |
109 removeUISourceCode: function(uiSourceCode) | 109 removeUISourceCode: function(uiSourceCode) |
110 { | 110 { |
111 this._navigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSo
urceCode); | 111 this._navigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSo
urceCode); |
112 }, | 112 }, |
113 | 113 |
114 /** | 114 /** |
115 * @param {WebInspector.UISourceCode} uiSourceCode | 115 * @param {WebInspector.UISourceCode} uiSourceCode |
116 * @param {boolean=} select | 116 * @param {boolean=} select |
117 */ | 117 */ |
118 revealUISourceCode: function(uiSourceCode, select) | 118 revealUISourceCode: function(uiSourceCode, select) |
119 { | 119 { |
120 this._navigatorViewForUISourceCode(uiSourceCode).revealUISourceCode(uiSo
urceCode, select); | 120 this._navigatorViewForUISourceCode(uiSourceCode).revealUISourceCode(uiSo
urceCode, select); |
121 if (uiSourceCode.isContentScript) | 121 if (uiSourceCode.isContentScript) |
122 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ContentScri
ptsTab); | 122 this._tabbedPane.selectTab(WebInspector.SourcesNavigator.ContentScri
ptsTab); |
123 else if (uiSourceCode.project().type() !== WebInspector.projectTypes.Sni
ppets) | 123 else if (uiSourceCode.project().type() !== WebInspector.projectTypes.Sni
ppets) |
124 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ScriptsTab)
; | 124 this._tabbedPane.selectTab(WebInspector.SourcesNavigator.SourcesTab)
; |
125 }, | 125 }, |
126 | 126 |
127 /** | 127 /** |
128 * @param {WebInspector.UISourceCode} uiSourceCode | 128 * @param {WebInspector.UISourceCode} uiSourceCode |
129 * @param {function(boolean)=} callback | 129 * @param {function(boolean)=} callback |
130 */ | 130 */ |
131 rename: function(uiSourceCode, callback) | 131 rename: function(uiSourceCode, callback) |
132 { | 132 { |
133 this._navigatorViewForUISourceCode(uiSourceCode).rename(uiSourceCode, ca
llback); | 133 this._navigatorViewForUISourceCode(uiSourceCode).rename(uiSourceCode, ca
llback); |
134 }, | 134 }, |
135 | 135 |
136 /** | 136 /** |
137 * @param {WebInspector.Event} event | 137 * @param {WebInspector.Event} event |
138 */ | 138 */ |
139 _scriptSelected: function(event) | 139 _sourceSelected: function(event) |
140 { | 140 { |
141 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.Scrip
tSelected, event.data); | 141 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.Sourc
eSelected, event.data); |
142 }, | 142 }, |
143 | 143 |
144 /** | 144 /** |
145 * @param {WebInspector.Event} event | 145 * @param {WebInspector.Event} event |
146 */ | 146 */ |
147 _itemSearchStarted: function(event) | 147 _itemSearchStarted: function(event) |
148 { | 148 { |
149 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemS
earchStarted, event.data); | 149 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.ItemS
earchStarted, event.data); |
150 }, | 150 }, |
151 | 151 |
152 /** | 152 /** |
153 * @param {WebInspector.Event} event | 153 * @param {WebInspector.Event} event |
154 */ | 154 */ |
155 _itemRenamingRequested: function(event) | 155 _itemRenamingRequested: function(event) |
156 { | 156 { |
157 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemR
enamingRequested, event.data); | 157 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.ItemR
enamingRequested, event.data); |
158 }, | 158 }, |
159 | 159 |
160 /** | 160 /** |
161 * @param {WebInspector.Event} event | 161 * @param {WebInspector.Event} event |
162 */ | 162 */ |
163 _itemCreationRequested: function(event) | 163 _itemCreationRequested: function(event) |
164 { | 164 { |
165 this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemC
reationRequested, event.data); | 165 this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.ItemC
reationRequested, event.data); |
166 }, | 166 }, |
167 | 167 |
168 __proto__: WebInspector.Object.prototype | 168 __proto__: WebInspector.Object.prototype |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * @constructor | 172 * @constructor |
173 * @extends {WebInspector.NavigatorView} | 173 * @extends {WebInspector.NavigatorView} |
174 */ | 174 */ |
175 WebInspector.SnippetsNavigatorView = function() | 175 WebInspector.SnippetsNavigatorView = function() |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 _handleCreateSnippet: function() | 226 _handleCreateSnippet: function() |
227 { | 227 { |
228 var data = {}; | 228 var data = {}; |
229 data.project = WebInspector.scriptSnippetModel.project(); | 229 data.project = WebInspector.scriptSnippetModel.project(); |
230 data.path = ""; | 230 data.path = ""; |
231 this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemCrea
tionRequested, data); | 231 this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemCrea
tionRequested, data); |
232 }, | 232 }, |
233 | 233 |
234 __proto__: WebInspector.NavigatorView.prototype | 234 __proto__: WebInspector.NavigatorView.prototype |
235 } | 235 } |
OLD | NEW |