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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {WebInspector.TabbedEditorContainerDelegate} 5 * @implements {Sources.TabbedEditorContainerDelegate}
6 * @implements {WebInspector.Searchable} 6 * @implements {UI.Searchable}
7 * @implements {WebInspector.Replaceable} 7 * @implements {UI.Replaceable}
8 * @unrestricted 8 * @unrestricted
9 */ 9 */
10 WebInspector.SourcesView = class extends WebInspector.VBox { 10 Sources.SourcesView = class extends UI.VBox {
11 /** 11 /**
12 * @suppressGlobalPropertiesCheck 12 * @suppressGlobalPropertiesCheck
13 */ 13 */
14 constructor() { 14 constructor() {
15 super(); 15 super();
16 this.registerRequiredCSS('sources/sourcesView.css'); 16 this.registerRequiredCSS('sources/sourcesView.css');
17 this.element.id = 'sources-panel-sources-view'; 17 this.element.id = 'sources-panel-sources-view';
18 this.setMinimumAndPreferredSizes(50, 52, 150, 100); 18 this.setMinimumAndPreferredSizes(50, 52, 150, 100);
19 19
20 var workspace = WebInspector.workspace; 20 var workspace = Workspace.workspace;
21 21
22 this._searchableView = new WebInspector.SearchableView(this, 'sourcesViewSea rchConfig'); 22 this._searchableView = new UI.SearchableView(this, 'sourcesViewSearchConfig' );
23 this._searchableView.setMinimalSearchQuerySize(0); 23 this._searchableView.setMinimalSearchQuerySize(0);
24 this._searchableView.show(this.element); 24 this._searchableView.show(this.element);
25 25
26 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.Widget>} */ 26 /** @type {!Map.<!Workspace.UISourceCode, !UI.Widget>} */
27 this._sourceViewByUISourceCode = new Map(); 27 this._sourceViewByUISourceCode = new Map();
28 28
29 var tabbedEditorPlaceholderText = WebInspector.isMac() ? WebInspector.UIStri ng('Hit \u2318+P to open a file') : 29 var tabbedEditorPlaceholderText = Host.isMac() ? Common.UIString('Hit \u2318 +P to open a file') :
30 WebInspector.UIStri ng('Hit Ctrl+P to open a file'); 30 Common.UIString('Hi t Ctrl+P to open a file');
31 this._editorContainer = new WebInspector.TabbedEditorContainer( 31 this._editorContainer = new Sources.TabbedEditorContainer(
32 this, WebInspector.settings.createLocalSetting('previouslyViewedFiles', []), tabbedEditorPlaceholderText); 32 this, Common.settings.createLocalSetting('previouslyViewedFiles', []), t abbedEditorPlaceholderText);
33 this._editorContainer.show(this._searchableView.element); 33 this._editorContainer.show(this._searchableView.element);
34 this._editorContainer.addEventListener( 34 this._editorContainer.addEventListener(
35 WebInspector.TabbedEditorContainer.Events.EditorSelected, this._editorSe lected, this); 35 Sources.TabbedEditorContainer.Events.EditorSelected, this._editorSelecte d, this);
36 this._editorContainer.addEventListener( 36 this._editorContainer.addEventListener(
37 WebInspector.TabbedEditorContainer.Events.EditorClosed, this._editorClos ed, this); 37 Sources.TabbedEditorContainer.Events.EditorClosed, this._editorClosed, t his);
38 38
39 this._historyManager = new WebInspector.EditingLocationHistoryManager(this, this.currentSourceFrame.bind(this)); 39 this._historyManager = new Sources.EditingLocationHistoryManager(this, this. currentSourceFrame.bind(this));
40 40
41 this._toolbarContainerElement = this.element.createChild('div', 'sources-too lbar'); 41 this._toolbarContainerElement = this.element.createChild('div', 'sources-too lbar');
42 this._toolbarEditorActions = new WebInspector.Toolbar('', this._toolbarConta inerElement); 42 this._toolbarEditorActions = new UI.Toolbar('', this._toolbarContainerElemen t);
43 43
44 self.runtime.allInstances(WebInspector.SourcesView.EditorAction).then(append ButtonsForExtensions.bind(this)); 44 self.runtime.allInstances(Sources.SourcesView.EditorAction).then(appendButto nsForExtensions.bind(this));
45 /** 45 /**
46 * @param {!Array.<!WebInspector.SourcesView.EditorAction>} actions 46 * @param {!Array.<!Sources.SourcesView.EditorAction>} actions
47 * @this {WebInspector.SourcesView} 47 * @this {Sources.SourcesView}
48 */ 48 */
49 function appendButtonsForExtensions(actions) { 49 function appendButtonsForExtensions(actions) {
50 for (var i = 0; i < actions.length; ++i) 50 for (var i = 0; i < actions.length; ++i)
51 this._toolbarEditorActions.appendToolbarItem(actions[i].button(this)); 51 this._toolbarEditorActions.appendToolbarItem(actions[i].button(this));
52 } 52 }
53 this._scriptViewToolbar = new WebInspector.Toolbar('', this._toolbarContaine rElement); 53 this._scriptViewToolbar = new UI.Toolbar('', this._toolbarContainerElement);
54 this._scriptViewToolbar.element.style.flex = 'auto'; 54 this._scriptViewToolbar.element.style.flex = 'auto';
55 this._bottomToolbar = new WebInspector.Toolbar('', this._toolbarContainerEle ment); 55 this._bottomToolbar = new UI.Toolbar('', this._toolbarContainerElement);
56 56
57 WebInspector.startBatchUpdate(); 57 UI.startBatchUpdate();
58 workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); 58 workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));
59 WebInspector.endBatchUpdate(); 59 UI.endBatchUpdate();
60 60
61 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this); 61 workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, thi s._uiSourceCodeAdded, this);
62 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved , this._uiSourceCodeRemoved, this); 62 workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemoved, t his._uiSourceCodeRemoved, this);
63 workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, thi s._projectRemoved.bind(this), this); 63 workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this._ projectRemoved.bind(this), this);
64 64
65 /** 65 /**
66 * @param {!Event} event 66 * @param {!Event} event
67 */ 67 */
68 function handleBeforeUnload(event) { 68 function handleBeforeUnload(event) {
69 if (event.returnValue) 69 if (event.returnValue)
70 return; 70 return;
71 71
72 var unsavedSourceCodes = []; 72 var unsavedSourceCodes = [];
73 var projects = WebInspector.workspace.projectsForType(WebInspector.project Types.FileSystem); 73 var projects = Workspace.workspace.projectsForType(Workspace.projectTypes. FileSystem);
74 for (var i = 0; i < projects.length; ++i) 74 for (var i = 0; i < projects.length; ++i)
75 unsavedSourceCodes = unsavedSourceCodes.concat(projects[i].uiSourceCodes ().filter(isUnsaved)); 75 unsavedSourceCodes = unsavedSourceCodes.concat(projects[i].uiSourceCodes ().filter(isUnsaved));
76 76
77 if (!unsavedSourceCodes.length) 77 if (!unsavedSourceCodes.length)
78 return; 78 return;
79 79
80 event.returnValue = WebInspector.UIString('DevTools have unsaved changes t hat will be permanently lost.'); 80 event.returnValue = Common.UIString('DevTools have unsaved changes that wi ll be permanently lost.');
81 WebInspector.viewManager.showView('sources'); 81 UI.viewManager.showView('sources');
82 for (var i = 0; i < unsavedSourceCodes.length; ++i) 82 for (var i = 0; i < unsavedSourceCodes.length; ++i)
83 WebInspector.Revealer.reveal(unsavedSourceCodes[i]); 83 Common.Revealer.reveal(unsavedSourceCodes[i]);
84 84
85 /** 85 /**
86 * @param {!WebInspector.UISourceCode} sourceCode 86 * @param {!Workspace.UISourceCode} sourceCode
87 * @return {boolean} 87 * @return {boolean}
88 */ 88 */
89 function isUnsaved(sourceCode) { 89 function isUnsaved(sourceCode) {
90 var binding = WebInspector.persistence.binding(sourceCode); 90 var binding = Persistence.persistence.binding(sourceCode);
91 if (binding) 91 if (binding)
92 return binding.network.isDirty(); 92 return binding.network.isDirty();
93 return sourceCode.isDirty(); 93 return sourceCode.isDirty();
94 } 94 }
95 } 95 }
96 96
97 if (!window.opener) 97 if (!window.opener)
98 window.addEventListener('beforeunload', handleBeforeUnload, true); 98 window.addEventListener('beforeunload', handleBeforeUnload, true);
99 99
100 this._shortcuts = {}; 100 this._shortcuts = {};
101 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal se); 101 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal se);
102 } 102 }
103 103
104 /** 104 /**
105 * @param {function(!Array.<!WebInspector.KeyboardShortcut.Descriptor>, functi on(!Event=):boolean)} registerShortcutDelegate 105 * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event= ):boolean)} registerShortcutDelegate
106 */ 106 */
107 registerShortcuts(registerShortcutDelegate) { 107 registerShortcuts(registerShortcutDelegate) {
108 /** 108 /**
109 * @this {WebInspector.SourcesView} 109 * @this {Sources.SourcesView}
110 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts 110 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} shortcuts
111 * @param {function(!Event=):boolean} handler 111 * @param {function(!Event=):boolean} handler
112 */ 112 */
113 function registerShortcut(shortcuts, handler) { 113 function registerShortcut(shortcuts, handler) {
114 registerShortcutDelegate(shortcuts, handler); 114 registerShortcutDelegate(shortcuts, handler);
115 this._registerShortcuts(shortcuts, handler); 115 this._registerShortcuts(shortcuts, handler);
116 } 116 }
117 117
118 registerShortcut.call( 118 registerShortcut.call(
119 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToPreviousL ocation, 119 this, Components.ShortcutsScreen.SourcesPanelShortcuts.JumpToPreviousLoc ation,
120 this._onJumpToPreviousLocation.bind(this)); 120 this._onJumpToPreviousLocation.bind(this));
121 registerShortcut.call( 121 registerShortcut.call(
122 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToNextLocat ion, 122 this, Components.ShortcutsScreen.SourcesPanelShortcuts.JumpToNextLocatio n,
123 this._onJumpToNextLocation.bind(this)); 123 this._onJumpToNextLocation.bind(this));
124 registerShortcut.call( 124 registerShortcut.call(
125 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.CloseEditorTab, this._onCloseEditorTab.bind(this)); 125 this, Components.ShortcutsScreen.SourcesPanelShortcuts.CloseEditorTab, t his._onCloseEditorTab.bind(this));
126 registerShortcut.call( 126 registerShortcut.call(
127 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToLine, this. _showGoToLineDialog.bind(this)); 127 this, Components.ShortcutsScreen.SourcesPanelShortcuts.GoToLine, this._s howGoToLineDialog.bind(this));
128 registerShortcut.call( 128 registerShortcut.call(
129 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToMember, thi s._showOutlineDialog.bind(this)); 129 this, Components.ShortcutsScreen.SourcesPanelShortcuts.GoToMember, this. _showOutlineDialog.bind(this));
130 registerShortcut.call( 130 registerShortcut.call(
131 this, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleBreakpoin t, this._toggleBreakpoint.bind(this)); 131 this, Components.ShortcutsScreen.SourcesPanelShortcuts.ToggleBreakpoint, this._toggleBreakpoint.bind(this));
132 registerShortcut.call(this, WebInspector.ShortcutsScreen.SourcesPanelShortcu ts.Save, this._save.bind(this)); 132 registerShortcut.call(this, Components.ShortcutsScreen.SourcesPanelShortcuts .Save, this._save.bind(this));
133 registerShortcut.call(this, WebInspector.ShortcutsScreen.SourcesPanelShortcu ts.SaveAll, this._saveAll.bind(this)); 133 registerShortcut.call(this, Components.ShortcutsScreen.SourcesPanelShortcuts .SaveAll, this._saveAll.bind(this));
134 } 134 }
135 135
136 /** 136 /**
137 * @return {!WebInspector.Toolbar} 137 * @return {!UI.Toolbar}
138 */ 138 */
139 leftToolbar() { 139 leftToolbar() {
140 return this._editorContainer.leftToolbar(); 140 return this._editorContainer.leftToolbar();
141 } 141 }
142 142
143 /** 143 /**
144 * @return {!WebInspector.Toolbar} 144 * @return {!UI.Toolbar}
145 */ 145 */
146 rightToolbar() { 146 rightToolbar() {
147 return this._editorContainer.rightToolbar(); 147 return this._editorContainer.rightToolbar();
148 } 148 }
149 149
150 /** 150 /**
151 * @return {!WebInspector.Toolbar} 151 * @return {!UI.Toolbar}
152 */ 152 */
153 bottomToolbar() { 153 bottomToolbar() {
154 return this._bottomToolbar; 154 return this._bottomToolbar;
155 } 155 }
156 156
157 /** 157 /**
158 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} keys 158 * @param {!Array.<!UI.KeyboardShortcut.Descriptor>} keys
159 * @param {function(!Event=):boolean} handler 159 * @param {function(!Event=):boolean} handler
160 */ 160 */
161 _registerShortcuts(keys, handler) { 161 _registerShortcuts(keys, handler) {
162 for (var i = 0; i < keys.length; ++i) 162 for (var i = 0; i < keys.length; ++i)
163 this._shortcuts[keys[i].key] = handler; 163 this._shortcuts[keys[i].key] = handler;
164 } 164 }
165 165
166 _handleKeyDown(event) { 166 _handleKeyDown(event) {
167 var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); 167 var shortcutKey = UI.KeyboardShortcut.makeKeyFromEvent(event);
168 var handler = this._shortcuts[shortcutKey]; 168 var handler = this._shortcuts[shortcutKey];
169 if (handler && handler()) 169 if (handler && handler())
170 event.consume(true); 170 event.consume(true);
171 } 171 }
172 172
173 /** 173 /**
174 * @override 174 * @override
175 */ 175 */
176 wasShown() { 176 wasShown() {
177 super.wasShown(); 177 super.wasShown();
178 WebInspector.context.setFlavor(WebInspector.SourcesView, this); 178 UI.context.setFlavor(Sources.SourcesView, this);
179 } 179 }
180 180
181 /** 181 /**
182 * @override 182 * @override
183 */ 183 */
184 willHide() { 184 willHide() {
185 WebInspector.context.setFlavor(WebInspector.SourcesView, null); 185 UI.context.setFlavor(Sources.SourcesView, null);
186 super.willHide(); 186 super.willHide();
187 } 187 }
188 188
189 /** 189 /**
190 * @return {!Element} 190 * @return {!Element}
191 */ 191 */
192 toolbarContainerElement() { 192 toolbarContainerElement() {
193 return this._toolbarContainerElement; 193 return this._toolbarContainerElement;
194 } 194 }
195 195
196 /** 196 /**
197 * @return {!WebInspector.SearchableView} 197 * @return {!UI.SearchableView}
198 */ 198 */
199 searchableView() { 199 searchableView() {
200 return this._searchableView; 200 return this._searchableView;
201 } 201 }
202 202
203 /** 203 /**
204 * @return {?WebInspector.Widget} 204 * @return {?UI.Widget}
205 */ 205 */
206 visibleView() { 206 visibleView() {
207 return this._editorContainer.visibleView; 207 return this._editorContainer.visibleView;
208 } 208 }
209 209
210 /** 210 /**
211 * @return {?WebInspector.UISourceCodeFrame} 211 * @return {?Sources.UISourceCodeFrame}
212 */ 212 */
213 currentSourceFrame() { 213 currentSourceFrame() {
214 var view = this.visibleView(); 214 var view = this.visibleView();
215 if (!(view instanceof WebInspector.UISourceCodeFrame)) 215 if (!(view instanceof Sources.UISourceCodeFrame))
216 return null; 216 return null;
217 return /** @type {!WebInspector.UISourceCodeFrame} */ (view); 217 return /** @type {!Sources.UISourceCodeFrame} */ (view);
218 } 218 }
219 219
220 /** 220 /**
221 * @return {?WebInspector.UISourceCode} 221 * @return {?Workspace.UISourceCode}
222 */ 222 */
223 currentUISourceCode() { 223 currentUISourceCode() {
224 return this._editorContainer.currentFile(); 224 return this._editorContainer.currentFile();
225 } 225 }
226 226
227 /** 227 /**
228 * @param {!Event=} event 228 * @param {!Event=} event
229 */ 229 */
230 _onCloseEditorTab(event) { 230 _onCloseEditorTab(event) {
231 var uiSourceCode = this._editorContainer.currentFile(); 231 var uiSourceCode = this._editorContainer.currentFile();
(...skipping 13 matching lines...) Expand all
245 245
246 /** 246 /**
247 * @param {!Event=} event 247 * @param {!Event=} event
248 */ 248 */
249 _onJumpToNextLocation(event) { 249 _onJumpToNextLocation(event) {
250 this._historyManager.rollover(); 250 this._historyManager.rollover();
251 return true; 251 return true;
252 } 252 }
253 253
254 /** 254 /**
255 * @param {!WebInspector.Event} event 255 * @param {!Common.Event} event
256 */ 256 */
257 _uiSourceCodeAdded(event) { 257 _uiSourceCodeAdded(event) {
258 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 258 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
259 this._addUISourceCode(uiSourceCode); 259 this._addUISourceCode(uiSourceCode);
260 } 260 }
261 261
262 /** 262 /**
263 * @param {!WebInspector.UISourceCode} uiSourceCode 263 * @param {!Workspace.UISourceCode} uiSourceCode
264 */ 264 */
265 _addUISourceCode(uiSourceCode) { 265 _addUISourceCode(uiSourceCode) {
266 if (uiSourceCode.isFromServiceProject()) 266 if (uiSourceCode.isFromServiceProject())
267 return; 267 return;
268 this._editorContainer.addUISourceCode(uiSourceCode); 268 this._editorContainer.addUISourceCode(uiSourceCode);
269 } 269 }
270 270
271 _uiSourceCodeRemoved(event) { 271 _uiSourceCodeRemoved(event) {
272 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 272 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
273 this._removeUISourceCodes([uiSourceCode]); 273 this._removeUISourceCodes([uiSourceCode]);
274 } 274 }
275 275
276 /** 276 /**
277 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes 277 * @param {!Array.<!Workspace.UISourceCode>} uiSourceCodes
278 */ 278 */
279 _removeUISourceCodes(uiSourceCodes) { 279 _removeUISourceCodes(uiSourceCodes) {
280 this._editorContainer.removeUISourceCodes(uiSourceCodes); 280 this._editorContainer.removeUISourceCodes(uiSourceCodes);
281 for (var i = 0; i < uiSourceCodes.length; ++i) { 281 for (var i = 0; i < uiSourceCodes.length; ++i) {
282 this._removeSourceFrame(uiSourceCodes[i]); 282 this._removeSourceFrame(uiSourceCodes[i]);
283 this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]); 283 this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]);
284 } 284 }
285 } 285 }
286 286
287 _projectRemoved(event) { 287 _projectRemoved(event) {
288 var project = event.data; 288 var project = event.data;
289 var uiSourceCodes = project.uiSourceCodes(); 289 var uiSourceCodes = project.uiSourceCodes();
290 this._removeUISourceCodes(uiSourceCodes); 290 this._removeUISourceCodes(uiSourceCodes);
291 } 291 }
292 292
293 _updateScriptViewToolbarItems() { 293 _updateScriptViewToolbarItems() {
294 this._scriptViewToolbar.removeToolbarItems(); 294 this._scriptViewToolbar.removeToolbarItems();
295 var view = this.visibleView(); 295 var view = this.visibleView();
296 if (view instanceof WebInspector.SimpleView) { 296 if (view instanceof UI.SimpleView) {
297 for (var item of (/** @type {?WebInspector.SimpleView} */ (view)).syncTool barItems()) 297 for (var item of (/** @type {?UI.SimpleView} */ (view)).syncToolbarItems() )
298 this._scriptViewToolbar.appendToolbarItem(item); 298 this._scriptViewToolbar.appendToolbarItem(item);
299 } 299 }
300 } 300 }
301 301
302 /** 302 /**
303 * @param {!WebInspector.UISourceCode} uiSourceCode 303 * @param {!Workspace.UISourceCode} uiSourceCode
304 * @param {number=} lineNumber 0-based 304 * @param {number=} lineNumber 0-based
305 * @param {number=} columnNumber 305 * @param {number=} columnNumber
306 * @param {boolean=} omitFocus 306 * @param {boolean=} omitFocus
307 * @param {boolean=} omitHighlight 307 * @param {boolean=} omitHighlight
308 */ 308 */
309 showSourceLocation(uiSourceCode, lineNumber, columnNumber, omitFocus, omitHigh light) { 309 showSourceLocation(uiSourceCode, lineNumber, columnNumber, omitFocus, omitHigh light) {
310 this._historyManager.updateCurrentState(); 310 this._historyManager.updateCurrentState();
311 this._editorContainer.showFile(uiSourceCode); 311 this._editorContainer.showFile(uiSourceCode);
312 var currentSourceFrame = this.currentSourceFrame(); 312 var currentSourceFrame = this.currentSourceFrame();
313 if (currentSourceFrame && typeof lineNumber === 'number') 313 if (currentSourceFrame && typeof lineNumber === 'number')
314 currentSourceFrame.revealPosition(lineNumber, columnNumber, !omitHighlight ); 314 currentSourceFrame.revealPosition(lineNumber, columnNumber, !omitHighlight );
315 this._historyManager.pushNewState(); 315 this._historyManager.pushNewState();
316 if (!omitFocus) 316 if (!omitFocus)
317 this.visibleView().focus(); 317 this.visibleView().focus();
318 } 318 }
319 319
320 /** 320 /**
321 * @param {!WebInspector.UISourceCode} uiSourceCode 321 * @param {!Workspace.UISourceCode} uiSourceCode
322 * @return {!WebInspector.Widget} 322 * @return {!UI.Widget}
323 */ 323 */
324 _createSourceView(uiSourceCode) { 324 _createSourceView(uiSourceCode) {
325 var sourceFrame; 325 var sourceFrame;
326 var sourceView; 326 var sourceView;
327 var contentType = uiSourceCode.contentType(); 327 var contentType = uiSourceCode.contentType();
328 328
329 if (contentType.hasScripts()) 329 if (contentType.hasScripts())
330 sourceFrame = new WebInspector.JavaScriptSourceFrame(uiSourceCode); 330 sourceFrame = new Sources.JavaScriptSourceFrame(uiSourceCode);
331 else if (contentType.isStyleSheet()) 331 else if (contentType.isStyleSheet())
332 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); 332 sourceFrame = new Sources.CSSSourceFrame(uiSourceCode);
333 else if (contentType === WebInspector.resourceTypes.Image) 333 else if (contentType === Common.resourceTypes.Image)
334 sourceView = 334 sourceView =
335 new WebInspector.ImageView(WebInspector.NetworkProject.uiSourceCodeMim eType(uiSourceCode), uiSourceCode); 335 new SourceFrame.ImageView(Bindings.NetworkProject.uiSourceCodeMimeType (uiSourceCode), uiSourceCode);
336 else if (contentType === WebInspector.resourceTypes.Font) 336 else if (contentType === Common.resourceTypes.Font)
337 sourceView = 337 sourceView =
338 new WebInspector.FontView(WebInspector.NetworkProject.uiSourceCodeMime Type(uiSourceCode), uiSourceCode); 338 new SourceFrame.FontView(Bindings.NetworkProject.uiSourceCodeMimeType( uiSourceCode), uiSourceCode);
339 else 339 else
340 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); 340 sourceFrame = new Sources.UISourceCodeFrame(uiSourceCode);
341 341
342 if (sourceFrame) { 342 if (sourceFrame) {
343 sourceFrame.setHighlighterType(WebInspector.NetworkProject.uiSourceCodeMim eType(uiSourceCode)); 343 sourceFrame.setHighlighterType(Bindings.NetworkProject.uiSourceCodeMimeTyp e(uiSourceCode));
344 this._historyManager.trackSourceFrameCursorJumps(sourceFrame); 344 this._historyManager.trackSourceFrameCursorJumps(sourceFrame);
345 } 345 }
346 var widget = /** @type {!WebInspector.Widget} */ (sourceFrame || sourceView) ; 346 var widget = /** @type {!UI.Widget} */ (sourceFrame || sourceView);
347 this._sourceViewByUISourceCode.set(uiSourceCode, widget); 347 this._sourceViewByUISourceCode.set(uiSourceCode, widget);
348 uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged, this); 348 uiSourceCode.addEventListener(Workspace.UISourceCode.Events.TitleChanged, th is._uiSourceCodeTitleChanged, this);
349 return widget; 349 return widget;
350 } 350 }
351 351
352 /** 352 /**
353 * @param {!WebInspector.UISourceCode} uiSourceCode 353 * @param {!Workspace.UISourceCode} uiSourceCode
354 * @return {!WebInspector.Widget} 354 * @return {!UI.Widget}
355 */ 355 */
356 _getOrCreateSourceView(uiSourceCode) { 356 _getOrCreateSourceView(uiSourceCode) {
357 return this._sourceViewByUISourceCode.get(uiSourceCode) || this._createSourc eView(uiSourceCode); 357 return this._sourceViewByUISourceCode.get(uiSourceCode) || this._createSourc eView(uiSourceCode);
358 } 358 }
359 359
360 /** 360 /**
361 * @param {!WebInspector.UISourceCodeFrame} sourceFrame 361 * @param {!Sources.UISourceCodeFrame} sourceFrame
362 * @param {!WebInspector.UISourceCode} uiSourceCode 362 * @param {!Workspace.UISourceCode} uiSourceCode
363 * @return {boolean} 363 * @return {boolean}
364 */ 364 */
365 _sourceFrameMatchesUISourceCode(sourceFrame, uiSourceCode) { 365 _sourceFrameMatchesUISourceCode(sourceFrame, uiSourceCode) {
366 if (uiSourceCode.contentType().hasScripts()) 366 if (uiSourceCode.contentType().hasScripts())
367 return sourceFrame instanceof WebInspector.JavaScriptSourceFrame; 367 return sourceFrame instanceof Sources.JavaScriptSourceFrame;
368 if (uiSourceCode.contentType().isStyleSheet()) 368 if (uiSourceCode.contentType().isStyleSheet())
369 return sourceFrame instanceof WebInspector.CSSSourceFrame; 369 return sourceFrame instanceof Sources.CSSSourceFrame;
370 return !(sourceFrame instanceof WebInspector.JavaScriptSourceFrame); 370 return !(sourceFrame instanceof Sources.JavaScriptSourceFrame);
371 } 371 }
372 372
373 /** 373 /**
374 * @param {!WebInspector.UISourceCode} uiSourceCode 374 * @param {!Workspace.UISourceCode} uiSourceCode
375 */ 375 */
376 _recreateSourceFrameIfNeeded(uiSourceCode) { 376 _recreateSourceFrameIfNeeded(uiSourceCode) {
377 var oldSourceView = this._sourceViewByUISourceCode.get(uiSourceCode); 377 var oldSourceView = this._sourceViewByUISourceCode.get(uiSourceCode);
378 if (!oldSourceView || !(oldSourceView instanceof WebInspector.UISourceCodeFr ame)) 378 if (!oldSourceView || !(oldSourceView instanceof Sources.UISourceCodeFrame))
379 return; 379 return;
380 var oldSourceFrame = /** @type {!WebInspector.UISourceCodeFrame} */ (oldSour ceView); 380 var oldSourceFrame = /** @type {!Sources.UISourceCodeFrame} */ (oldSourceVie w);
381 if (this._sourceFrameMatchesUISourceCode(oldSourceFrame, uiSourceCode)) { 381 if (this._sourceFrameMatchesUISourceCode(oldSourceFrame, uiSourceCode)) {
382 oldSourceFrame.setHighlighterType(WebInspector.NetworkProject.uiSourceCode MimeType(uiSourceCode)); 382 oldSourceFrame.setHighlighterType(Bindings.NetworkProject.uiSourceCodeMime Type(uiSourceCode));
383 } else { 383 } else {
384 this._editorContainer.removeUISourceCode(uiSourceCode); 384 this._editorContainer.removeUISourceCode(uiSourceCode);
385 this._removeSourceFrame(uiSourceCode); 385 this._removeSourceFrame(uiSourceCode);
386 } 386 }
387 } 387 }
388 388
389 /** 389 /**
390 * @override 390 * @override
391 * @param {!WebInspector.UISourceCode} uiSourceCode 391 * @param {!Workspace.UISourceCode} uiSourceCode
392 * @return {!WebInspector.Widget} 392 * @return {!UI.Widget}
393 */ 393 */
394 viewForFile(uiSourceCode) { 394 viewForFile(uiSourceCode) {
395 return this._getOrCreateSourceView(uiSourceCode); 395 return this._getOrCreateSourceView(uiSourceCode);
396 } 396 }
397 397
398 /** 398 /**
399 * @param {!WebInspector.UISourceCode} uiSourceCode 399 * @param {!Workspace.UISourceCode} uiSourceCode
400 */ 400 */
401 _removeSourceFrame(uiSourceCode) { 401 _removeSourceFrame(uiSourceCode) {
402 var sourceView = this._sourceViewByUISourceCode.get(uiSourceCode); 402 var sourceView = this._sourceViewByUISourceCode.get(uiSourceCode);
403 this._sourceViewByUISourceCode.remove(uiSourceCode); 403 this._sourceViewByUISourceCode.remove(uiSourceCode);
404 uiSourceCode.removeEventListener( 404 uiSourceCode.removeEventListener(
405 WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleCh anged, this); 405 Workspace.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChang ed, this);
406 if (sourceView && sourceView instanceof WebInspector.UISourceCodeFrame) 406 if (sourceView && sourceView instanceof Sources.UISourceCodeFrame)
407 /** @type {!WebInspector.UISourceCodeFrame} */ (sourceView).dispose(); 407 /** @type {!Sources.UISourceCodeFrame} */ (sourceView).dispose();
408 } 408 }
409 409
410 clearCurrentExecutionLine() { 410 clearCurrentExecutionLine() {
411 if (this._executionSourceFrame) 411 if (this._executionSourceFrame)
412 this._executionSourceFrame.clearExecutionLine(); 412 this._executionSourceFrame.clearExecutionLine();
413 delete this._executionSourceFrame; 413 delete this._executionSourceFrame;
414 } 414 }
415 415
416 /** 416 /**
417 * @param {!WebInspector.UILocation} uiLocation 417 * @param {!Workspace.UILocation} uiLocation
418 */ 418 */
419 setExecutionLocation(uiLocation) { 419 setExecutionLocation(uiLocation) {
420 var sourceView = this._getOrCreateSourceView(uiLocation.uiSourceCode); 420 var sourceView = this._getOrCreateSourceView(uiLocation.uiSourceCode);
421 if (sourceView instanceof WebInspector.UISourceCodeFrame) { 421 if (sourceView instanceof Sources.UISourceCodeFrame) {
422 var sourceFrame = /** @type {!WebInspector.UISourceCodeFrame} */ (sourceVi ew); 422 var sourceFrame = /** @type {!Sources.UISourceCodeFrame} */ (sourceView);
423 sourceFrame.setExecutionLocation(uiLocation); 423 sourceFrame.setExecutionLocation(uiLocation);
424 this._executionSourceFrame = sourceFrame; 424 this._executionSourceFrame = sourceFrame;
425 } 425 }
426 } 426 }
427 427
428 /** 428 /**
429 * @param {!WebInspector.Event} event 429 * @param {!Common.Event} event
430 */ 430 */
431 _editorClosed(event) { 431 _editorClosed(event) {
432 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 432 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
433 this._historyManager.removeHistoryForSourceCode(uiSourceCode); 433 this._historyManager.removeHistoryForSourceCode(uiSourceCode);
434 434
435 var wasSelected = false; 435 var wasSelected = false;
436 if (!this._editorContainer.currentFile()) 436 if (!this._editorContainer.currentFile())
437 wasSelected = true; 437 wasSelected = true;
438 438
439 // SourcesNavigator does not need to update on EditorClosed. 439 // SourcesNavigator does not need to update on EditorClosed.
440 this._updateScriptViewToolbarItems(); 440 this._updateScriptViewToolbarItems();
441 this._searchableView.resetSearch(); 441 this._searchableView.resetSearch();
442 442
443 var data = {}; 443 var data = {};
444 data.uiSourceCode = uiSourceCode; 444 data.uiSourceCode = uiSourceCode;
445 data.wasSelected = wasSelected; 445 data.wasSelected = wasSelected;
446 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorClosed, data); 446 this.dispatchEventToListeners(Sources.SourcesView.Events.EditorClosed, data) ;
447 } 447 }
448 448
449 /** 449 /**
450 * @param {!WebInspector.Event} event 450 * @param {!Common.Event} event
451 */ 451 */
452 _editorSelected(event) { 452 _editorSelected(event) {
453 var previousSourceFrame = 453 var previousSourceFrame =
454 event.data.previousView instanceof WebInspector.UISourceCodeFrame ? even t.data.previousView : null; 454 event.data.previousView instanceof Sources.UISourceCodeFrame ? event.dat a.previousView : null;
455 if (previousSourceFrame) 455 if (previousSourceFrame)
456 previousSourceFrame.setSearchableView(null); 456 previousSourceFrame.setSearchableView(null);
457 var currentSourceFrame = 457 var currentSourceFrame =
458 event.data.currentView instanceof WebInspector.UISourceCodeFrame ? event .data.currentView : null; 458 event.data.currentView instanceof Sources.UISourceCodeFrame ? event.data .currentView : null;
459 if (currentSourceFrame) 459 if (currentSourceFrame)
460 currentSourceFrame.setSearchableView(this._searchableView); 460 currentSourceFrame.setSearchableView(this._searchableView);
461 461
462 this._searchableView.setReplaceable(!!currentSourceFrame && currentSourceFra me.canEditSource()); 462 this._searchableView.setReplaceable(!!currentSourceFrame && currentSourceFra me.canEditSource());
463 this._searchableView.refreshSearch(); 463 this._searchableView.refreshSearch();
464 this._updateScriptViewToolbarItems(); 464 this._updateScriptViewToolbarItems();
465 465
466 this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSelected , this._editorContainer.currentFile()); 466 this.dispatchEventToListeners(Sources.SourcesView.Events.EditorSelected, thi s._editorContainer.currentFile());
467 } 467 }
468 468
469 /** 469 /**
470 * @param {!WebInspector.Event} event 470 * @param {!Common.Event} event
471 */ 471 */
472 _uiSourceCodeTitleChanged(event) { 472 _uiSourceCodeTitleChanged(event) {
473 this._recreateSourceFrameIfNeeded(/** @type {!WebInspector.UISourceCode} */ (event.target)); 473 this._recreateSourceFrameIfNeeded(/** @type {!Workspace.UISourceCode} */ (ev ent.target));
474 } 474 }
475 475
476 /** 476 /**
477 * @override 477 * @override
478 */ 478 */
479 searchCanceled() { 479 searchCanceled() {
480 if (this._searchView) 480 if (this._searchView)
481 this._searchView.searchCanceled(); 481 this._searchView.searchCanceled();
482 482
483 delete this._searchView; 483 delete this._searchView;
484 delete this._searchConfig; 484 delete this._searchConfig;
485 } 485 }
486 486
487 /** 487 /**
488 * @override 488 * @override
489 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 489 * @param {!UI.SearchableView.SearchConfig} searchConfig
490 * @param {boolean} shouldJump 490 * @param {boolean} shouldJump
491 * @param {boolean=} jumpBackwards 491 * @param {boolean=} jumpBackwards
492 */ 492 */
493 performSearch(searchConfig, shouldJump, jumpBackwards) { 493 performSearch(searchConfig, shouldJump, jumpBackwards) {
494 var sourceFrame = this.currentSourceFrame(); 494 var sourceFrame = this.currentSourceFrame();
495 if (!sourceFrame) 495 if (!sourceFrame)
496 return; 496 return;
497 497
498 this._searchView = sourceFrame; 498 this._searchView = sourceFrame;
499 this._searchConfig = searchConfig; 499 this._searchConfig = searchConfig;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 /** 544 /**
545 * @override 545 * @override
546 * @return {boolean} 546 * @return {boolean}
547 */ 547 */
548 supportsRegexSearch() { 548 supportsRegexSearch() {
549 return true; 549 return true;
550 } 550 }
551 551
552 /** 552 /**
553 * @override 553 * @override
554 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 554 * @param {!UI.SearchableView.SearchConfig} searchConfig
555 * @param {string} replacement 555 * @param {string} replacement
556 */ 556 */
557 replaceSelectionWith(searchConfig, replacement) { 557 replaceSelectionWith(searchConfig, replacement) {
558 var sourceFrame = this.currentSourceFrame(); 558 var sourceFrame = this.currentSourceFrame();
559 if (!sourceFrame) { 559 if (!sourceFrame) {
560 console.assert(sourceFrame); 560 console.assert(sourceFrame);
561 return; 561 return;
562 } 562 }
563 sourceFrame.replaceSelectionWith(searchConfig, replacement); 563 sourceFrame.replaceSelectionWith(searchConfig, replacement);
564 } 564 }
565 565
566 /** 566 /**
567 * @override 567 * @override
568 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 568 * @param {!UI.SearchableView.SearchConfig} searchConfig
569 * @param {string} replacement 569 * @param {string} replacement
570 */ 570 */
571 replaceAllWith(searchConfig, replacement) { 571 replaceAllWith(searchConfig, replacement) {
572 var sourceFrame = this.currentSourceFrame(); 572 var sourceFrame = this.currentSourceFrame();
573 if (!sourceFrame) { 573 if (!sourceFrame) {
574 console.assert(sourceFrame); 574 console.assert(sourceFrame);
575 return; 575 return;
576 } 576 }
577 sourceFrame.replaceAllWith(searchConfig, replacement); 577 sourceFrame.replaceAllWith(searchConfig, replacement);
578 } 578 }
579 579
580 /** 580 /**
581 * @param {!Event=} event 581 * @param {!Event=} event
582 * @return {boolean} 582 * @return {boolean}
583 */ 583 */
584 _showOutlineDialog(event) { 584 _showOutlineDialog(event) {
585 var uiSourceCode = this._editorContainer.currentFile(); 585 var uiSourceCode = this._editorContainer.currentFile();
586 if (!uiSourceCode) 586 if (!uiSourceCode)
587 return false; 587 return false;
588 588
589 if (uiSourceCode.contentType().hasScripts()) { 589 if (uiSourceCode.contentType().hasScripts()) {
590 WebInspector.JavaScriptOutlineDialog.show(uiSourceCode, this.showSourceLoc ation.bind(this, uiSourceCode)); 590 Sources.JavaScriptOutlineDialog.show(uiSourceCode, this.showSourceLocation .bind(this, uiSourceCode));
591 return true; 591 return true;
592 } 592 }
593 593
594 if (uiSourceCode.contentType().isStyleSheet()) { 594 if (uiSourceCode.contentType().isStyleSheet()) {
595 WebInspector.StyleSheetOutlineDialog.show(uiSourceCode, this.showSourceLoc ation.bind(this, uiSourceCode)); 595 Sources.StyleSheetOutlineDialog.show(uiSourceCode, this.showSourceLocation .bind(this, uiSourceCode));
596 return true; 596 return true;
597 } 597 }
598 598
599 // We don't want default browser shortcut to be executed, so pretend to hand le this event. 599 // We don't want default browser shortcut to be executed, so pretend to hand le this event.
600 return true; 600 return true;
601 } 601 }
602 602
603 /** 603 /**
604 * @param {string=} query 604 * @param {string=} query
605 */ 605 */
606 showOpenResourceDialog(query) { 606 showOpenResourceDialog(query) {
607 var uiSourceCodes = this._editorContainer.historyUISourceCodes(); 607 var uiSourceCodes = this._editorContainer.historyUISourceCodes();
608 /** @type {!Map.<!WebInspector.UISourceCode, number>} */ 608 /** @type {!Map.<!Workspace.UISourceCode, number>} */
609 var defaultScores = new Map(); 609 var defaultScores = new Map();
610 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element 610 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element
611 defaultScores.set(uiSourceCodes[i], uiSourceCodes.length - i); 611 defaultScores.set(uiSourceCodes[i], uiSourceCodes.length - i);
612 if (!this._openResourceDialogHistory) 612 if (!this._openResourceDialogHistory)
613 this._openResourceDialogHistory = []; 613 this._openResourceDialogHistory = [];
614 WebInspector.OpenResourceDialog.show(this, query || '', defaultScores, this. _openResourceDialogHistory); 614 Sources.OpenResourceDialog.show(this, query || '', defaultScores, this._open ResourceDialogHistory);
615 } 615 }
616 616
617 /** 617 /**
618 * @param {!Event=} event 618 * @param {!Event=} event
619 * @return {boolean} 619 * @return {boolean}
620 */ 620 */
621 _showGoToLineDialog(event) { 621 _showGoToLineDialog(event) {
622 if (this._editorContainer.currentFile()) 622 if (this._editorContainer.currentFile())
623 this.showOpenResourceDialog(':'); 623 this.showOpenResourceDialog(':');
624 return true; 624 return true;
(...skipping 10 matching lines...) Expand all
635 /** 635 /**
636 * @return {boolean} 636 * @return {boolean}
637 */ 637 */
638 _saveAll() { 638 _saveAll() {
639 var sourceFrames = this._editorContainer.fileViews(); 639 var sourceFrames = this._editorContainer.fileViews();
640 sourceFrames.forEach(this._saveSourceFrame.bind(this)); 640 sourceFrames.forEach(this._saveSourceFrame.bind(this));
641 return true; 641 return true;
642 } 642 }
643 643
644 /** 644 /**
645 * @param {?WebInspector.Widget} sourceFrame 645 * @param {?UI.Widget} sourceFrame
646 */ 646 */
647 _saveSourceFrame(sourceFrame) { 647 _saveSourceFrame(sourceFrame) {
648 if (!(sourceFrame instanceof WebInspector.UISourceCodeFrame)) 648 if (!(sourceFrame instanceof Sources.UISourceCodeFrame))
649 return; 649 return;
650 var uiSourceCodeFrame = /** @type {!WebInspector.UISourceCodeFrame} */ (sour ceFrame); 650 var uiSourceCodeFrame = /** @type {!Sources.UISourceCodeFrame} */ (sourceFra me);
651 uiSourceCodeFrame.commitEditing(); 651 uiSourceCodeFrame.commitEditing();
652 } 652 }
653 653
654 /** 654 /**
655 * @return {boolean} 655 * @return {boolean}
656 */ 656 */
657 _toggleBreakpoint() { 657 _toggleBreakpoint() {
658 var sourceFrame = this.currentSourceFrame(); 658 var sourceFrame = this.currentSourceFrame();
659 if (!sourceFrame) 659 if (!sourceFrame)
660 return false; 660 return false;
661 661
662 if (sourceFrame instanceof WebInspector.JavaScriptSourceFrame) { 662 if (sourceFrame instanceof Sources.JavaScriptSourceFrame) {
663 var javaScriptSourceFrame = /** @type {!WebInspector.JavaScriptSourceFrame } */ (sourceFrame); 663 var javaScriptSourceFrame = /** @type {!Sources.JavaScriptSourceFrame} */ (sourceFrame);
664 javaScriptSourceFrame.toggleBreakpointOnCurrentLine(); 664 javaScriptSourceFrame.toggleBreakpointOnCurrentLine();
665 return true; 665 return true;
666 } 666 }
667 return false; 667 return false;
668 } 668 }
669 669
670 /** 670 /**
671 * @param {boolean} active 671 * @param {boolean} active
672 */ 672 */
673 toggleBreakpointsActiveState(active) { 673 toggleBreakpointsActiveState(active) {
674 this._editorContainer.view.element.classList.toggle('breakpoints-deactivated ', !active); 674 this._editorContainer.view.element.classList.toggle('breakpoints-deactivated ', !active);
675 } 675 }
676 }; 676 };
677 677
678 /** @enum {symbol} */ 678 /** @enum {symbol} */
679 WebInspector.SourcesView.Events = { 679 Sources.SourcesView.Events = {
680 EditorClosed: Symbol('EditorClosed'), 680 EditorClosed: Symbol('EditorClosed'),
681 EditorSelected: Symbol('EditorSelected'), 681 EditorSelected: Symbol('EditorSelected'),
682 }; 682 };
683 683
684 /** 684 /**
685 * @interface 685 * @interface
686 */ 686 */
687 WebInspector.SourcesView.EditorAction = function() {}; 687 Sources.SourcesView.EditorAction = function() {};
688 688
689 WebInspector.SourcesView.EditorAction.prototype = { 689 Sources.SourcesView.EditorAction.prototype = {
690 /** 690 /**
691 * @param {!WebInspector.SourcesView} sourcesView 691 * @param {!Sources.SourcesView} sourcesView
692 * @return {!WebInspector.ToolbarButton} 692 * @return {!UI.ToolbarButton}
693 */ 693 */
694 button: function(sourcesView) {} 694 button: function(sourcesView) {}
695 }; 695 };
696 696
697 /** 697 /**
698 * @implements {WebInspector.ActionDelegate} 698 * @implements {UI.ActionDelegate}
699 * @unrestricted 699 * @unrestricted
700 */ 700 */
701 WebInspector.SourcesView.SwitchFileActionDelegate = class { 701 Sources.SourcesView.SwitchFileActionDelegate = class {
702 /** 702 /**
703 * @param {!WebInspector.UISourceCode} currentUISourceCode 703 * @param {!Workspace.UISourceCode} currentUISourceCode
704 * @return {?WebInspector.UISourceCode} 704 * @return {?Workspace.UISourceCode}
705 */ 705 */
706 static _nextFile(currentUISourceCode) { 706 static _nextFile(currentUISourceCode) {
707 /** 707 /**
708 * @param {string} name 708 * @param {string} name
709 * @return {string} 709 * @return {string}
710 */ 710 */
711 function fileNamePrefix(name) { 711 function fileNamePrefix(name) {
712 var lastDotIndex = name.lastIndexOf('.'); 712 var lastDotIndex = name.lastIndexOf('.');
713 var namePrefix = name.substr(0, lastDotIndex !== -1 ? lastDotIndex : name. length); 713 var namePrefix = name.substr(0, lastDotIndex !== -1 ? lastDotIndex : name. length);
714 return namePrefix.toLowerCase(); 714 return namePrefix.toLowerCase();
(...skipping 13 matching lines...) Expand all
728 } 728 }
729 candidates.sort(String.naturalOrderComparator); 729 candidates.sort(String.naturalOrderComparator);
730 var index = mod(candidates.indexOf(name) + 1, candidates.length); 730 var index = mod(candidates.indexOf(name) + 1, candidates.length);
731 var fullURL = (url ? url + '/' : '') + candidates[index]; 731 var fullURL = (url ? url + '/' : '') + candidates[index];
732 var nextUISourceCode = currentUISourceCode.project().uiSourceCodeForURL(full URL); 732 var nextUISourceCode = currentUISourceCode.project().uiSourceCodeForURL(full URL);
733 return nextUISourceCode !== currentUISourceCode ? nextUISourceCode : null; 733 return nextUISourceCode !== currentUISourceCode ? nextUISourceCode : null;
734 } 734 }
735 735
736 /** 736 /**
737 * @override 737 * @override
738 * @param {!WebInspector.Context} context 738 * @param {!UI.Context} context
739 * @param {string} actionId 739 * @param {string} actionId
740 * @return {boolean} 740 * @return {boolean}
741 */ 741 */
742 handleAction(context, actionId) { 742 handleAction(context, actionId) {
743 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); 743 var sourcesView = UI.context.flavor(Sources.SourcesView);
744 var currentUISourceCode = sourcesView.currentUISourceCode(); 744 var currentUISourceCode = sourcesView.currentUISourceCode();
745 if (!currentUISourceCode) 745 if (!currentUISourceCode)
746 return false; 746 return false;
747 var nextUISourceCode = WebInspector.SourcesView.SwitchFileActionDelegate._ne xtFile(currentUISourceCode); 747 var nextUISourceCode = Sources.SourcesView.SwitchFileActionDelegate._nextFil e(currentUISourceCode);
748 if (!nextUISourceCode) 748 if (!nextUISourceCode)
749 return false; 749 return false;
750 sourcesView.showSourceLocation(nextUISourceCode); 750 sourcesView.showSourceLocation(nextUISourceCode);
751 return true; 751 return true;
752 } 752 }
753 }; 753 };
754 754
755 755
756 /** 756 /**
757 * @implements {WebInspector.ActionDelegate} 757 * @implements {UI.ActionDelegate}
758 * @unrestricted 758 * @unrestricted
759 */ 759 */
760 WebInspector.SourcesView.CloseAllActionDelegate = class { 760 Sources.SourcesView.CloseAllActionDelegate = class {
761 /** 761 /**
762 * @override 762 * @override
763 * @param {!WebInspector.Context} context 763 * @param {!UI.Context} context
764 * @param {string} actionId 764 * @param {string} actionId
765 * @return {boolean} 765 * @return {boolean}
766 */ 766 */
767 handleAction(context, actionId) { 767 handleAction(context, actionId) {
768 var sourcesView = WebInspector.context.flavor(WebInspector.SourcesView); 768 var sourcesView = UI.context.flavor(Sources.SourcesView);
769 if (!sourcesView) 769 if (!sourcesView)
770 return false; 770 return false;
771 sourcesView._editorContainer.closeAllFiles(); 771 sourcesView._editorContainer.closeAllFiles();
772 return true; 772 return true;
773 } 773 }
774 }; 774 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698