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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 * @constructor | 52 * @constructor |
53 * @implements {WebInspector.ContextMenu.Provider} | 53 * @implements {WebInspector.ContextMenu.Provider} |
54 * @extends {WebInspector.Panel} | 54 * @extends {WebInspector.Panel} |
55 * @param {!WebInspector.Workspace=} workspaceForTest | 55 * @param {!WebInspector.Workspace=} workspaceForTest |
56 */ | 56 */ |
57 WebInspector.SourcesPanel = function(workspaceForTest) | 57 WebInspector.SourcesPanel = function(workspaceForTest) |
58 { | 58 { |
59 WebInspector.Panel.call(this, "sources"); | 59 WebInspector.Panel.call(this, "sources"); |
60 this.registerRequiredCSS("sourcesPanel.css"); | 60 this.registerRequiredCSS("sourcesPanel.css"); |
61 this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplet e. | 61 this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplet e. |
62 new WebInspector.UpgradeFileSystemDropTarget(this.element); | |
62 | 63 |
63 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); | 64 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); |
64 | 65 |
65 this._workspace = workspaceForTest || WebInspector.workspace; | 66 this._workspace = workspaceForTest || WebInspector.workspace; |
66 | 67 |
67 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel")); | 68 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel")); |
68 this.debugToolbar = this._createDebugToolbar(); | 69 this.debugToolbar = this._createDebugToolbar(); |
69 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); | 70 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); |
70 this.threadsToolbar = new WebInspector.ThreadsToolbar(); | 71 this.threadsToolbar = new WebInspector.ThreadsToolbar(); |
71 | 72 |
(...skipping 14 matching lines...) Expand all Loading... | |
86 | 87 |
87 this.editorView.setSidebarElementConstraints(Preferences.minSidebarWidth); | 88 this.editorView.setSidebarElementConstraints(Preferences.minSidebarWidth); |
88 this.editorView.setMainElementConstraints(50, 50); | 89 this.editorView.setMainElementConstraints(50, 50); |
89 this.editorView.show(this._splitView.mainElement()); | 90 this.editorView.show(this._splitView.mainElement()); |
90 | 91 |
91 this._navigator = new WebInspector.SourcesNavigator(this._workspace); | 92 this._navigator = new WebInspector.SourcesNavigator(this._workspace); |
92 this._navigator.view.show(this.editorView.sidebarElement()); | 93 this._navigator.view.show(this.editorView.sidebarElement()); |
93 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source Selected, this._sourceSelected, this); | 94 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source Selected, this._sourceSelected, this); |
94 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source Renamed, this._sourceRenamed, this); | 95 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source Renamed, this._sourceRenamed, this); |
95 | 96 |
96 this._sourcesEditor = new WebInspector.SourcesEditor(this._workspace, this); | 97 this._sourcesView = new WebInspector.SourcesView(this._workspace, this); |
97 this._sourcesEditor.addEventListener(WebInspector.SourcesEditor.Events.Edito rSelected, this._editorSelected.bind(this)); | 98 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel ected, this._editorSelected.bind(this)); |
98 this._sourcesEditor.addEventListener(WebInspector.SourcesEditor.Events.Edito rClosed, this._editorClosed.bind(this)); | 99 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo sed, this._editorClosed.bind(this)); |
99 this._sourcesEditor.registerShortcuts(this.registerShortcuts.bind(this)); | 100 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); |
100 | 101 |
101 this._drawerEditorView = new WebInspector.SourcesPanel.DrawerEditorView(); | 102 this._drawerEditorView = new WebInspector.SourcesPanel.DrawerEditorView(); |
102 this._sourcesEditor.sourcesView().show(this._drawerEditorView.element); | 103 this._sourcesView.show(this._drawerEditorView.element); |
103 | 104 |
104 this._debugSidebarResizeWidgetElement = document.createElementWithClass("div ", "resizer-widget"); | 105 this._debugSidebarResizeWidgetElement = document.createElementWithClass("div ", "resizer-widget"); |
105 this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-wi dget"; | 106 this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-wi dget"; |
106 this._splitView.addEventListener(WebInspector.SplitView.Events.ShowModeChang ed, this._updateDebugSidebarResizeWidget, this); | 107 this._splitView.addEventListener(WebInspector.SplitView.Events.ShowModeChang ed, this._updateDebugSidebarResizeWidget, this); |
107 this._updateDebugSidebarResizeWidget(); | 108 this._updateDebugSidebarResizeWidget(); |
108 this._splitView.installResizer(this._debugSidebarResizeWidgetElement); | 109 this._splitView.installResizer(this._debugSidebarResizeWidgetElement); |
109 | 110 |
110 this.sidebarPanes = {}; | 111 this.sidebarPanes = {}; |
111 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba rPane(); | 112 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba rPane(); |
112 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); | 113 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 } | 149 } |
149 | 150 |
150 WebInspector.SourcesPanel.minToolbarWidth = 215; | 151 WebInspector.SourcesPanel.minToolbarWidth = 215; |
151 | 152 |
152 WebInspector.SourcesPanel.prototype = { | 153 WebInspector.SourcesPanel.prototype = { |
153 /** | 154 /** |
154 * @return {!Element} | 155 * @return {!Element} |
155 */ | 156 */ |
156 defaultFocusedElement: function() | 157 defaultFocusedElement: function() |
157 { | 158 { |
158 return this._sourcesEditor.defaultFocusedElement() || this._navigator.vi ew.defaultFocusedElement(); | 159 return this._sourcesView.defaultFocusedElement() || this._navigator.view .defaultFocusedElement(); |
159 }, | 160 }, |
160 | 161 |
161 get paused() | 162 get paused() |
162 { | 163 { |
163 return this._paused; | 164 return this._paused; |
164 }, | 165 }, |
165 | 166 |
166 /** | 167 /** |
167 * @return {!WebInspector.SourcesPanel.DrawerEditor} | 168 * @return {!WebInspector.SourcesPanel.DrawerEditor} |
168 */ | 169 */ |
169 _drawerEditor: function() | 170 _drawerEditor: function() |
170 { | 171 { |
171 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec tor.DrawerEditor); | 172 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec tor.DrawerEditor); |
172 console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel .DrawerEditor, "WebInspector.DrawerEditor module instance does not use WebInspec tor.SourcesPanel.DrawerEditor as an implementation. "); | 173 console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel .DrawerEditor, "WebInspector.DrawerEditor module instance does not use WebInspec tor.SourcesPanel.DrawerEditor as an implementation. "); |
173 return /** @type {!WebInspector.SourcesPanel.DrawerEditor} */ (drawerEdi torInstance); | 174 return /** @type {!WebInspector.SourcesPanel.DrawerEditor} */ (drawerEdi torInstance); |
174 }, | 175 }, |
175 | 176 |
176 wasShown: function() | 177 wasShown: function() |
177 { | 178 { |
178 this._drawerEditor()._panelWasShown(); | 179 this._drawerEditor()._panelWasShown(); |
179 this._sourcesEditor.sourcesView().show(this.editorView.mainElement()); | 180 this._sourcesView.show(this.editorView.mainElement()); |
180 WebInspector.Panel.prototype.wasShown.call(this); | 181 WebInspector.Panel.prototype.wasShown.call(this); |
181 }, | 182 }, |
182 | 183 |
183 willHide: function() | 184 willHide: function() |
184 { | 185 { |
185 WebInspector.Panel.prototype.willHide.call(this); | 186 WebInspector.Panel.prototype.willHide.call(this); |
186 this._drawerEditor()._panelWillHide(); | 187 this._drawerEditor()._panelWillHide(); |
187 this._sourcesEditor.sourcesView().show(this._drawerEditorView.element); | 188 this._sourcesView.show(this._drawerEditorView.element); |
188 }, | 189 }, |
189 | 190 |
190 /** | 191 /** |
191 * @return {!WebInspector.SearchableView} | 192 * @return {!WebInspector.SearchableView} |
192 */ | 193 */ |
193 searchableView: function() | 194 searchableView: function() |
194 { | 195 { |
195 return this._sourcesEditor.searchableView(); | 196 return this._sourcesView.searchableView(); |
196 }, | 197 }, |
197 | 198 |
198 _consoleCommandEvaluatedInSelectedCallFrame: function(event) | 199 _consoleCommandEvaluatedInSelectedCallFrame: function(event) |
199 { | 200 { |
200 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); | 201 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); |
201 }, | 202 }, |
202 | 203 |
203 _debuggerPaused: function() | 204 _debuggerPaused: function() |
204 { | 205 { |
205 WebInspector.inspectorView.setCurrentPanel(this); | 206 WebInspector.inspectorView.setCurrentPanel(this); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 this._debuggerResumed(); | 296 this._debuggerResumed(); |
296 this.sidebarPanes.watchExpressions.reset(); | 297 this.sidebarPanes.watchExpressions.reset(); |
297 delete this._skipExecutionLineRevealing; | 298 delete this._skipExecutionLineRevealing; |
298 }, | 299 }, |
299 | 300 |
300 /** | 301 /** |
301 * @return {!WebInspector.View} | 302 * @return {!WebInspector.View} |
302 */ | 303 */ |
303 get visibleView() | 304 get visibleView() |
304 { | 305 { |
305 return this._sourcesEditor.visibleView(); | 306 return this._sourcesView.visibleView(); |
306 }, | 307 }, |
307 | 308 |
308 /** | 309 /** |
309 * @param {!WebInspector.UISourceCode} uiSourceCode | 310 * @param {!WebInspector.UISourceCode} uiSourceCode |
310 * @param {number=} lineNumber | 311 * @param {number=} lineNumber |
311 * @param {number=} columnNumber | 312 * @param {number=} columnNumber |
312 * @param {boolean=} forceShowInPanel | 313 * @param {boolean=} forceShowInPanel |
313 */ | 314 */ |
314 showUISourceCode: function(uiSourceCode, lineNumber, columnNumber, forceShow InPanel) | 315 showUISourceCode: function(uiSourceCode, lineNumber, columnNumber, forceShow InPanel) |
315 { | 316 { |
316 this._showEditor(forceShowInPanel); | 317 this._showEditor(forceShowInPanel); |
317 this._sourcesEditor.showSourceLocation(uiSourceCode, lineNumber, columnN umber); | 318 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum ber); |
318 }, | 319 }, |
319 | 320 |
320 _showEditor: function(forceShowInPanel) | 321 _showEditor: function(forceShowInPanel) |
321 { | 322 { |
322 if (this._sourcesEditor.sourcesView().isShowing()) | 323 if (this._sourcesView.isShowing()) |
323 return; | 324 return; |
324 | 325 |
325 if (this._shouldShowEditorInDrawer() && !forceShowInPanel) | 326 if (this._shouldShowEditorInDrawer() && !forceShowInPanel) |
326 this._drawerEditor()._show(); | 327 this._drawerEditor()._show(); |
327 else | 328 else |
328 WebInspector.inspectorView.showPanel("sources"); | 329 WebInspector.inspectorView.showPanel("sources"); |
329 }, | 330 }, |
330 | 331 |
331 /** | 332 /** |
332 * @param {!WebInspector.UILocation} uiLocation | 333 * @param {!WebInspector.UILocation} uiLocation |
(...skipping 15 matching lines...) Expand all Loading... | |
348 /** | 349 /** |
349 * @param {!WebInspector.UISourceCode} uiSourceCode | 350 * @param {!WebInspector.UISourceCode} uiSourceCode |
350 */ | 351 */ |
351 _revealInNavigator: function(uiSourceCode) | 352 _revealInNavigator: function(uiSourceCode) |
352 { | 353 { |
353 this._navigator.revealUISourceCode(uiSourceCode); | 354 this._navigator.revealUISourceCode(uiSourceCode); |
354 }, | 355 }, |
355 | 356 |
356 _executionLineChanged: function(uiLocation) | 357 _executionLineChanged: function(uiLocation) |
357 { | 358 { |
358 this._sourcesEditor.clearCurrentExecutionLine(); | 359 this._sourcesView.clearCurrentExecutionLine(); |
359 this._sourcesEditor.setExecutionLine(uiLocation); | 360 this._sourcesView.setExecutionLine(uiLocation); |
360 if (this._skipExecutionLineRevealing) | 361 if (this._skipExecutionLineRevealing) |
361 return; | 362 return; |
362 this._skipExecutionLineRevealing = true; | 363 this._skipExecutionLineRevealing = true; |
363 this._sourcesEditor.showSourceLocation(uiLocation.uiSourceCode, uiLocati on.lineNumber, 0, undefined, true); | 364 this._sourcesView.showSourceLocation(uiLocation.uiSourceCode, uiLocation .lineNumber, 0, undefined, true); |
364 }, | 365 }, |
365 | 366 |
366 _callFrameSelected: function(event) | 367 _callFrameSelected: function(event) |
367 { | 368 { |
368 var callFrame = event.data; | 369 var callFrame = event.data; |
369 | 370 |
370 if (!callFrame) | 371 if (!callFrame) |
371 return; | 372 return; |
372 | 373 |
373 this.sidebarPanes.scopechain.update(callFrame); | 374 this.sidebarPanes.scopechain.update(callFrame); |
374 this.sidebarPanes.watchExpressions.refreshExpressions(); | 375 this.sidebarPanes.watchExpressions.refreshExpressions(); |
375 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | 376 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); |
376 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | 377 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); |
377 }, | 378 }, |
378 | 379 |
379 /** | 380 /** |
380 * @param {!WebInspector.Event} event | 381 * @param {!WebInspector.Event} event |
381 */ | 382 */ |
382 _sourceSelected: function(event) | 383 _sourceSelected: function(event) |
383 { | 384 { |
384 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); | 385 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); |
385 this._sourcesEditor.showSourceLocation(uiSourceCode, undefined, undefine d, !event.data.focusSource) | 386 this._sourcesView.showSourceLocation(uiSourceCode, undefined, undefined, !event.data.focusSource) |
386 }, | 387 }, |
387 | 388 |
388 /** | 389 /** |
389 * @param {!WebInspector.Event} event | 390 * @param {!WebInspector.Event} event |
390 */ | 391 */ |
391 _sourceRenamed: function(event) | 392 _sourceRenamed: function(event) |
392 { | 393 { |
393 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); | 394 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); |
394 this._sourcesEditor.sourceRenamed(uiSourceCode); | 395 this._sourcesView.sourceRenamed(uiSourceCode); |
395 }, | 396 }, |
396 | 397 |
397 _pauseOnExceptionEnabledChanged: function() | 398 _pauseOnExceptionEnabledChanged: function() |
398 { | 399 { |
399 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); | 400 var enabled = WebInspector.settings.pauseOnExceptionEnabled.get(); |
400 this._pauseOnExceptionButton.toggled = enabled; | 401 this._pauseOnExceptionButton.toggled = enabled; |
401 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do n't pause on exceptions." : "Pause on exceptions."); | 402 this._pauseOnExceptionButton.title = WebInspector.UIString(enabled ? "Do n't pause on exceptions." : "Pause on exceptions."); |
402 this._debugToolbarDrawer.classList.toggle("expanded", enabled); | 403 this._debugToolbarDrawer.classList.toggle("expanded", enabled); |
403 }, | 404 }, |
404 | 405 |
(...skipping 22 matching lines...) Expand all Loading... | |
427 | 428 |
428 _clearInterface: function() | 429 _clearInterface: function() |
429 { | 430 { |
430 this.sidebarPanes.callstack.update(null, null); | 431 this.sidebarPanes.callstack.update(null, null); |
431 this.sidebarPanes.scopechain.update(null); | 432 this.sidebarPanes.scopechain.update(null); |
432 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); | 433 this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight(); |
433 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); | 434 WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight(); |
434 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); | 435 this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight(); |
435 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); | 436 this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight(); |
436 | 437 |
437 this._sourcesEditor.clearCurrentExecutionLine(); | 438 this._sourcesView.clearCurrentExecutionLine(); |
438 this._updateDebuggerButtons(); | 439 this._updateDebuggerButtons(); |
439 }, | 440 }, |
440 | 441 |
441 _togglePauseOnExceptions: function() | 442 _togglePauseOnExceptions: function() |
442 { | 443 { |
443 WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptio nButton.toggled); | 444 WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptio nButton.toggled); |
444 }, | 445 }, |
445 | 446 |
446 /** | 447 /** |
447 * @return {boolean} | 448 * @return {boolean} |
448 */ | 449 */ |
449 _runSnippet: function() | 450 _runSnippet: function() |
450 { | 451 { |
451 var uiSourceCode = this._sourcesEditor.currentUISourceCode(); | 452 var uiSourceCode = this._sourcesView.currentUISourceCode(); |
452 if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets ) | 453 if (uiSourceCode.project().type() !== WebInspector.projectTypes.Snippets ) |
453 return false; | 454 return false; |
454 WebInspector.scriptSnippetModel.evaluateScriptSnippet(uiSourceCode); | 455 WebInspector.scriptSnippetModel.evaluateScriptSnippet(uiSourceCode); |
455 return true; | 456 return true; |
456 }, | 457 }, |
457 | 458 |
458 /** | 459 /** |
459 * @param {!WebInspector.Event} event | 460 * @param {!WebInspector.Event} event |
460 */ | 461 */ |
461 _editorSelected: function(event) | 462 _editorSelected: function(event) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 _toggleBreakpointsClicked: function(event) | 602 _toggleBreakpointsClicked: function(event) |
602 { | 603 { |
603 WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerMo del.breakpointsActive()); | 604 WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerMo del.breakpointsActive()); |
604 }, | 605 }, |
605 | 606 |
606 _breakpointsActiveStateChanged: function(event) | 607 _breakpointsActiveStateChanged: function(event) |
607 { | 608 { |
608 var active = event.data; | 609 var active = event.data; |
609 this._toggleBreakpointsButton.toggled = !active; | 610 this._toggleBreakpointsButton.toggled = !active; |
610 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active); | 611 this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoint s-list-deactivated", !active); |
611 this._sourcesEditor.toggleBreakpointsActiveState(active); | 612 this._sourcesView.toggleBreakpointsActiveState(active); |
612 if (active) | 613 if (active) |
613 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv ate breakpoints."); | 614 this._toggleBreakpointsButton.title = WebInspector.UIString("Deactiv ate breakpoints."); |
614 else | 615 else |
615 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat e breakpoints."); | 616 this._toggleBreakpointsButton.title = WebInspector.UIString("Activat e breakpoints."); |
616 }, | 617 }, |
617 | 618 |
618 _createDebugToolbar: function() | 619 _createDebugToolbar: function() |
619 { | 620 { |
620 var debugToolbar = document.createElement("div"); | 621 var debugToolbar = document.createElement("div"); |
621 debugToolbar.className = "scripts-debug-toolbar"; | 622 debugToolbar.className = "scripts-debug-toolbar"; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 if (!uiLocation) | 962 if (!uiLocation) |
962 return; | 963 return; |
963 | 964 |
964 this.showUILocation(uiLocation, true); | 965 this.showUILocation(uiLocation, true); |
965 } | 966 } |
966 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetFunctionDe tails.bind(this)); | 967 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetFunctionDe tails.bind(this)); |
967 }, | 968 }, |
968 | 969 |
969 showGoToSourceDialog: function() | 970 showGoToSourceDialog: function() |
970 { | 971 { |
971 this._sourcesEditor.showOpenResourceDialog(); | 972 this._sourcesView.showOpenResourceDialog(); |
972 }, | 973 }, |
973 | 974 |
974 _dockSideChanged: function() | 975 _dockSideChanged: function() |
975 { | 976 { |
976 var vertically = WebInspector.dockController.isVertical() && WebInspecto r.settings.splitVerticallyWhenDockedToRight.get(); | 977 var vertically = WebInspector.dockController.isVertical() && WebInspecto r.settings.splitVerticallyWhenDockedToRight.get(); |
977 this._splitVertically(vertically); | 978 this._splitVertically(vertically); |
978 }, | 979 }, |
979 | 980 |
980 /** | 981 /** |
981 * @param {boolean} vertically | 982 * @param {boolean} vertically |
982 */ | 983 */ |
983 _splitVertically: function(vertically) | 984 _splitVertically: function(vertically) |
984 { | 985 { |
985 if (this.sidebarPaneView && vertically === !this._splitView.isVertical() ) | 986 if (this.sidebarPaneView && vertically === !this._splitView.isVertical() ) |
986 return; | 987 return; |
987 | 988 |
988 if (this.sidebarPaneView) | 989 if (this.sidebarPaneView) |
989 this.sidebarPaneView.detach(); | 990 this.sidebarPaneView.detach(); |
990 | 991 |
991 this._splitView.setVertical(!vertically); | 992 this._splitView.setVertical(!vertically); |
992 | 993 |
993 if (!vertically) | 994 if (!vertically) |
994 this._splitView.uninstallResizer(this._sourcesEditor.statusBarContai nerElement()); | 995 this._splitView.uninstallResizer(this._sourcesView.statusBarContaine rElement()); |
995 else | 996 else |
996 this._splitView.installResizer(this._sourcesEditor.statusBarContaine rElement()); | 997 this._splitView.installResizer(this._sourcesView.statusBarContainerE lement()); |
997 | 998 |
998 // Create vertical box with stack. | 999 // Create vertical box with stack. |
999 var vbox = new WebInspector.VBox(); | 1000 var vbox = new WebInspector.VBox(); |
1000 vbox.element.appendChild(this._debugToolbarDrawer); | 1001 vbox.element.appendChild(this._debugToolbarDrawer); |
1001 vbox.element.appendChild(this.debugToolbar); | 1002 vbox.element.appendChild(this.debugToolbar); |
1002 vbox.element.appendChild(this.threadsToolbar.element); | 1003 vbox.element.appendChild(this.threadsToolbar.element); |
1003 var sidebarPaneStack = new WebInspector.SidebarPaneStack(); | 1004 var sidebarPaneStack = new WebInspector.SidebarPaneStack(); |
1004 sidebarPaneStack.element.classList.add("flex-auto"); | 1005 sidebarPaneStack.element.classList.add("flex-auto"); |
1005 sidebarPaneStack.show(vbox.element); | 1006 sidebarPaneStack.show(vbox.element); |
1006 | 1007 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1051 * @param {!WebInspector.SidebarPane} pane | 1052 * @param {!WebInspector.SidebarPane} pane |
1052 */ | 1053 */ |
1053 addExtensionSidebarPane: function(id, pane) | 1054 addExtensionSidebarPane: function(id, pane) |
1054 { | 1055 { |
1055 this._extensionSidebarPanes.push(pane); | 1056 this._extensionSidebarPanes.push(pane); |
1056 this._extensionSidebarPanesContainer.addPane(pane); | 1057 this._extensionSidebarPanesContainer.addPane(pane); |
1057 this.setHideOnDetach(); | 1058 this.setHideOnDetach(); |
1058 }, | 1059 }, |
1059 | 1060 |
1060 /** | 1061 /** |
1061 * @return {!WebInspector.SourcesEditor} | 1062 * @return {!WebInspector.SourcesView} |
1062 */ | 1063 */ |
1063 sourcesEditor: function() | 1064 sourcesView: function() |
1064 { | 1065 { |
1065 return this._sourcesEditor; | 1066 return this._sourcesView; |
1066 }, | 1067 }, |
1067 | 1068 |
1068 __proto__: WebInspector.Panel.prototype | 1069 __proto__: WebInspector.Panel.prototype |
1069 } | 1070 } |
1070 | 1071 |
1071 /** | 1072 /** |
1072 * @constructor | 1073 * @constructor |
1074 * @param {!Element} element | |
1075 */ | |
1076 WebInspector.UpgradeFileSystemDropTarget = function(element) | |
1077 { | |
1078 element.addEventListener("dragenter", this._onDragEnter.bind(this), true); | |
1079 element.addEventListener("dragover", this._onDragOver.bind(this), true); | |
1080 this._element = element; | |
1081 } | |
1082 | |
1083 WebInspector.UpgradeFileSystemDropTarget.dragAndDropFilesType = "Files"; | |
1084 | |
1085 WebInspector.UpgradeFileSystemDropTarget.prototype = { | |
1086 _onDragEnter: function (event) | |
1087 { | |
1088 if (event.dataTransfer.types.indexOf(WebInspector.UpgradeFileSystemDropT arget.dragAndDropFilesType) === -1) | |
1089 return; | |
1090 event.consume(true); | |
1091 }, | |
1092 | |
1093 _onDragOver: function (event) | |
1094 { | |
1095 if (event.dataTransfer.types.indexOf(WebInspector.UpgradeFileSystemDropT arget.dragAndDropFilesType) === -1) | |
1096 return; | |
1097 event.consume(true); | |
1098 if (this._dragMaskElement) | |
1099 return; | |
1100 this._dragMaskElement = this._element.createChild("div", "fill drag-mask "); | |
vsevik
2014/03/25 11:58:15
drag-mask is defined in sourcesView.css
| |
1101 this._dragMaskElement.addEventListener("drop", this._onDrop.bind(this), true); | |
1102 this._dragMaskElement.addEventListener("dragleave", this._onDragLeave.bi nd(this), true); | |
1103 }, | |
1104 | |
1105 _onDrop: function (event) | |
1106 { | |
1107 event.consume(true); | |
1108 this._removeMask(); | |
1109 var items = /** @type {!Array.<!DataTransferItem>} */ (event.dataTransfe r.items); | |
1110 if (!items.length) | |
1111 return; | |
1112 var entry = items[0].webkitGetAsEntry(); | |
1113 if (!entry.isDirectory) | |
1114 return; | |
1115 InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesyst em); | |
1116 }, | |
1117 | |
1118 _onDragLeave: function (event) | |
1119 { | |
1120 event.consume(true); | |
1121 this._removeMask(); | |
1122 }, | |
1123 | |
1124 _removeMask: function () | |
1125 { | |
1126 this._dragMaskElement.remove(); | |
1127 delete this._dragMaskElement; | |
1128 } | |
1129 } | |
1130 | |
1131 /** | |
1132 * @constructor | |
1073 * @implements {WebInspector.DrawerEditor} | 1133 * @implements {WebInspector.DrawerEditor} |
1074 */ | 1134 */ |
1075 WebInspector.SourcesPanel.DrawerEditor = function() | 1135 WebInspector.SourcesPanel.DrawerEditor = function() |
1076 { | 1136 { |
1077 this._panel = WebInspector.inspectorView.panel("sources"); | 1137 this._panel = WebInspector.inspectorView.panel("sources"); |
1078 } | 1138 } |
1079 | 1139 |
1080 WebInspector.SourcesPanel.DrawerEditor.prototype = { | 1140 WebInspector.SourcesPanel.DrawerEditor.prototype = { |
1081 /** | 1141 /** |
1082 * @return {!WebInspector.View} | 1142 * @return {!WebInspector.View} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 WebInspector.SourcesPanel.UILocationRevealer.prototype = { | 1218 WebInspector.SourcesPanel.UILocationRevealer.prototype = { |
1159 /** | 1219 /** |
1160 * @param {!Object} uiLocation | 1220 * @param {!Object} uiLocation |
1161 */ | 1221 */ |
1162 reveal: function(uiLocation) | 1222 reveal: function(uiLocation) |
1163 { | 1223 { |
1164 if (uiLocation instanceof WebInspector.UILocation) | 1224 if (uiLocation instanceof WebInspector.UILocation) |
1165 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorVie w.panel("sources")).showUILocation(uiLocation); | 1225 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorVie w.panel("sources")).showUILocation(uiLocation); |
1166 } | 1226 } |
1167 } | 1227 } |
OLD | NEW |