| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 * @implements {WebInspector.ContextMenu.Provider} | 60 * @implements {WebInspector.ContextMenu.Provider} |
| 61 * @extends {WebInspector.Panel} | 61 * @extends {WebInspector.Panel} |
| 62 * @param {!WebInspector.Workspace=} workspaceForTest | 62 * @param {!WebInspector.Workspace=} workspaceForTest |
| 63 */ | 63 */ |
| 64 WebInspector.SourcesPanel = function(workspaceForTest) | 64 WebInspector.SourcesPanel = function(workspaceForTest) |
| 65 { | 65 { |
| 66 WebInspector.Panel.call(this, "sources"); | 66 WebInspector.Panel.call(this, "sources"); |
| 67 this.registerRequiredCSS("sourcesPanel.css"); | 67 this.registerRequiredCSS("sourcesPanel.css"); |
| 68 new WebInspector.UpgradeFileSystemDropTarget(this.element); | 68 new WebInspector.UpgradeFileSystemDropTarget(this.element); |
| 69 | 69 |
| 70 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti
ng("showEditorInDrawer", true); | |
| 71 | |
| 72 this._workspace = workspaceForTest || WebInspector.workspace; | 70 this._workspace = workspaceForTest || WebInspector.workspace; |
| 73 | 71 |
| 74 this.debugToolbar = this._createDebugToolbar(); | 72 this.debugToolbar = this._createDebugToolbar(); |
| 75 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); | 73 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); |
| 76 this._targetsToolbar = new WebInspector.TargetsToolbar(); | 74 this._targetsToolbar = new WebInspector.TargetsToolbar(); |
| 77 | 75 |
| 78 const initialDebugSidebarWidth = 225; | 76 const initialDebugSidebarWidth = 225; |
| 79 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); | 77 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); |
| 80 this._splitView.enableShowModeSaving(); | 78 this._splitView.enableShowModeSaving(); |
| 81 this._splitView.show(this.element); | 79 this._splitView.show(this.element); |
| 82 | 80 |
| 83 // Create scripts navigator | 81 // Create scripts navigator |
| 84 const initialNavigatorWidth = 225; | 82 const initialNavigatorWidth = 225; |
| 85 this.editorView = new WebInspector.SplitView(true, false, "sourcesPanelNavig
atorSplitViewState", initialNavigatorWidth); | 83 this.editorView = new WebInspector.SplitView(true, false, "sourcesPanelNavig
atorSplitViewState", initialNavigatorWidth); |
| 86 this.editorView.enableShowModeSaving(); | 84 this.editorView.enableShowModeSaving(); |
| 87 this.editorView.element.id = "scripts-editor-split-view"; | 85 this.editorView.element.id = "scripts-editor-split-view"; |
| 88 this.editorView.element.tabIndex = 0; | 86 this.editorView.element.tabIndex = 0; |
| 89 this.editorView.show(this._splitView.mainElement()); | 87 this.editorView.show(this._splitView.mainElement()); |
| 90 | 88 |
| 91 this._navigator = new WebInspector.SourcesNavigator(this._workspace); | 89 this._navigator = new WebInspector.SourcesNavigator(this._workspace); |
| 92 this._navigator.view.setMinimumSize(100, 25); | 90 this._navigator.view.setMinimumSize(100, 25); |
| 93 this._navigator.view.show(this.editorView.sidebarElement()); | 91 this._navigator.view.show(this.editorView.sidebarElement()); |
| 94 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Selected, this._sourceSelected, this); | 92 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Selected, this._sourceSelected, this); |
| 95 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Renamed, this._sourceRenamed, this); | 93 this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.Source
Renamed, this._sourceRenamed, this); |
| 96 | 94 |
| 97 this._sourcesView = new WebInspector.SourcesView(this._workspace, this); | 95 this._sourcesView = new WebInspector.SourcesView(this._workspace, this); |
| 98 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); | 96 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSel
ected, this._editorSelected.bind(this)); |
| 99 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); | 97 this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClo
sed, this._editorClosed.bind(this)); |
| 100 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); | 98 this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this)); |
| 101 | 99 this._sourcesView.show(this.editorView.mainElement()); |
| 102 if (WebInspector.experimentsSettings.editorInDrawer.isEnabled()) { | |
| 103 this._drawerEditorView = new WebInspector.SourcesPanel.DrawerEditorView(
); | |
| 104 this._sourcesView.show(this._drawerEditorView.element); | |
| 105 } else { | |
| 106 this._sourcesView.show(this.editorView.mainElement()); | |
| 107 } | |
| 108 | 100 |
| 109 this._debugSidebarResizeWidgetElement = document.createElementWithClass("div
", "resizer-widget"); | 101 this._debugSidebarResizeWidgetElement = document.createElementWithClass("div
", "resizer-widget"); |
| 110 this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-wi
dget"; | 102 this._debugSidebarResizeWidgetElement.id = "scripts-debug-sidebar-resizer-wi
dget"; |
| 111 this._splitView.addEventListener(WebInspector.SplitView.Events.ShowModeChang
ed, this._updateDebugSidebarResizeWidget, this); | 103 this._splitView.addEventListener(WebInspector.SplitView.Events.ShowModeChang
ed, this._updateDebugSidebarResizeWidget, this); |
| 112 this._updateDebugSidebarResizeWidget(); | 104 this._updateDebugSidebarResizeWidget(); |
| 113 this._splitView.installResizer(this._debugSidebarResizeWidgetElement); | 105 this._splitView.installResizer(this._debugSidebarResizeWidgetElement); |
| 114 | 106 |
| 115 this.sidebarPanes = {}; | 107 this.sidebarPanes = {}; |
| 116 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba
rPane(); | 108 this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSideba
rPane(); |
| 117 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); | 109 this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 }, | 182 }, |
| 191 | 183 |
| 192 /** | 184 /** |
| 193 * @return {boolean} | 185 * @return {boolean} |
| 194 */ | 186 */ |
| 195 paused: function() | 187 paused: function() |
| 196 { | 188 { |
| 197 return this._paused; | 189 return this._paused; |
| 198 }, | 190 }, |
| 199 | 191 |
| 200 /** | |
| 201 * @return {!WebInspector.SourcesPanel.DrawerEditor} | |
| 202 */ | |
| 203 _drawerEditor: function() | |
| 204 { | |
| 205 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec
tor.DrawerEditor); | |
| 206 console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel
.DrawerEditor, "WebInspector.DrawerEditor module instance does not use WebInspec
tor.SourcesPanel.DrawerEditor as an implementation. "); | |
| 207 return /** @type {!WebInspector.SourcesPanel.DrawerEditor} */ (drawerEdi
torInstance); | |
| 208 }, | |
| 209 | |
| 210 wasShown: function() | 192 wasShown: function() |
| 211 { | 193 { |
| 212 WebInspector.context.setFlavor(WebInspector.SourcesPanel, this); | 194 WebInspector.context.setFlavor(WebInspector.SourcesPanel, this); |
| 213 if (WebInspector.experimentsSettings.editorInDrawer.isEnabled()) { | |
| 214 this._drawerEditor()._panelWasShown(); | |
| 215 this._sourcesView.show(this.editorView.mainElement()); | |
| 216 } | |
| 217 WebInspector.Panel.prototype.wasShown.call(this); | 195 WebInspector.Panel.prototype.wasShown.call(this); |
| 218 }, | 196 }, |
| 219 | 197 |
| 220 willHide: function() | 198 willHide: function() |
| 221 { | 199 { |
| 222 WebInspector.Panel.prototype.willHide.call(this); | 200 WebInspector.Panel.prototype.willHide.call(this); |
| 223 if (WebInspector.experimentsSettings.editorInDrawer.isEnabled()) { | |
| 224 this._drawerEditor()._panelWillHide(); | |
| 225 this._sourcesView.show(this._drawerEditorView.element); | |
| 226 } | |
| 227 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); | 201 WebInspector.context.setFlavor(WebInspector.SourcesPanel, null); |
| 228 }, | 202 }, |
| 229 | 203 |
| 230 /** | 204 /** |
| 231 * @return {!WebInspector.SearchableView} | 205 * @return {!WebInspector.SearchableView} |
| 232 */ | 206 */ |
| 233 searchableView: function() | 207 searchableView: function() |
| 234 { | 208 { |
| 235 return this._sourcesView.searchableView(); | 209 return this._sourcesView.searchableView(); |
| 236 }, | 210 }, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 showUISourceCode: function(uiSourceCode, lineNumber, columnNumber, forceShow
InPanel) | 347 showUISourceCode: function(uiSourceCode, lineNumber, columnNumber, forceShow
InPanel) |
| 374 { | 348 { |
| 375 this._showEditor(forceShowInPanel); | 349 this._showEditor(forceShowInPanel); |
| 376 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum
ber); | 350 this._sourcesView.showSourceLocation(uiSourceCode, lineNumber, columnNum
ber); |
| 377 }, | 351 }, |
| 378 | 352 |
| 379 _showEditor: function(forceShowInPanel) | 353 _showEditor: function(forceShowInPanel) |
| 380 { | 354 { |
| 381 if (this._sourcesView.isShowing()) | 355 if (this._sourcesView.isShowing()) |
| 382 return; | 356 return; |
| 383 | 357 WebInspector.inspectorView.showPanel("sources"); |
| 384 if (this._shouldShowEditorInDrawer() && !forceShowInPanel) | |
| 385 this._drawerEditor()._show(); | |
| 386 else | |
| 387 WebInspector.inspectorView.showPanel("sources"); | |
| 388 }, | 358 }, |
| 389 | 359 |
| 390 /** | 360 /** |
| 391 * @param {!WebInspector.UILocation} uiLocation | 361 * @param {!WebInspector.UILocation} uiLocation |
| 392 * @param {boolean=} forceShowInPanel | 362 * @param {boolean=} forceShowInPanel |
| 393 */ | 363 */ |
| 394 showUILocation: function(uiLocation, forceShowInPanel) | 364 showUILocation: function(uiLocation, forceShowInPanel) |
| 395 { | 365 { |
| 396 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui
Location.columnNumber, forceShowInPanel); | 366 this.showUISourceCode(uiLocation.uiSourceCode, uiLocation.lineNumber, ui
Location.columnNumber, forceShowInPanel); |
| 397 }, | 367 }, |
| 398 | 368 |
| 399 /** | 369 /** |
| 400 * @return {boolean} | |
| 401 */ | |
| 402 _shouldShowEditorInDrawer: function() | |
| 403 { | |
| 404 return WebInspector.experimentsSettings.editorInDrawer.isEnabled() && We
bInspector.settings.showEditorInDrawer.get() && WebInspector.inspectorView.isDra
werEditorShown(); | |
| 405 }, | |
| 406 | |
| 407 /** | |
| 408 * @param {!WebInspector.UISourceCode} uiSourceCode | 370 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 409 */ | 371 */ |
| 410 _revealInNavigator: function(uiSourceCode) | 372 _revealInNavigator: function(uiSourceCode) |
| 411 { | 373 { |
| 412 this._navigator.revealUISourceCode(uiSourceCode); | 374 this._navigator.revealUISourceCode(uiSourceCode); |
| 413 }, | 375 }, |
| 414 | 376 |
| 415 /** | 377 /** |
| 416 * @param {boolean} ignoreExecutionLineEvents | 378 * @param {boolean} ignoreExecutionLineEvents |
| 417 */ | 379 */ |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 | 1193 |
| 1232 _removeMask: function () | 1194 _removeMask: function () |
| 1233 { | 1195 { |
| 1234 this._dragMaskElement.remove(); | 1196 this._dragMaskElement.remove(); |
| 1235 delete this._dragMaskElement; | 1197 delete this._dragMaskElement; |
| 1236 } | 1198 } |
| 1237 } | 1199 } |
| 1238 | 1200 |
| 1239 /** | 1201 /** |
| 1240 * @constructor | 1202 * @constructor |
| 1241 * @implements {WebInspector.DrawerEditor} | |
| 1242 */ | |
| 1243 WebInspector.SourcesPanel.DrawerEditor = function() | |
| 1244 { | |
| 1245 this._panel = WebInspector.inspectorView.panel("sources"); | |
| 1246 } | |
| 1247 | |
| 1248 WebInspector.SourcesPanel.DrawerEditor.prototype = { | |
| 1249 /** | |
| 1250 * @return {!WebInspector.View} | |
| 1251 */ | |
| 1252 view: function() | |
| 1253 { | |
| 1254 return this._panel._drawerEditorView; | |
| 1255 }, | |
| 1256 | |
| 1257 installedIntoDrawer: function() | |
| 1258 { | |
| 1259 if (this._panel.isShowing()) | |
| 1260 this._panelWasShown(); | |
| 1261 else | |
| 1262 this._panelWillHide(); | |
| 1263 }, | |
| 1264 | |
| 1265 _panelWasShown: function() | |
| 1266 { | |
| 1267 WebInspector.inspectorView.setDrawerEditorAvailable(false); | |
| 1268 WebInspector.inspectorView.hideDrawerEditor(); | |
| 1269 }, | |
| 1270 | |
| 1271 _panelWillHide: function() | |
| 1272 { | |
| 1273 WebInspector.inspectorView.setDrawerEditorAvailable(true); | |
| 1274 if (WebInspector.inspectorView.isDrawerEditorShown()) | |
| 1275 WebInspector.inspectorView.showDrawerEditor(); | |
| 1276 }, | |
| 1277 | |
| 1278 _show: function() | |
| 1279 { | |
| 1280 WebInspector.inspectorView.showDrawerEditor(); | |
| 1281 }, | |
| 1282 } | |
| 1283 | |
| 1284 /** | |
| 1285 * @constructor | |
| 1286 * @extends {WebInspector.VBox} | |
| 1287 */ | |
| 1288 WebInspector.SourcesPanel.DrawerEditorView = function() | |
| 1289 { | |
| 1290 WebInspector.VBox.call(this); | |
| 1291 this.element.id = "drawer-editor-view"; | |
| 1292 } | |
| 1293 | |
| 1294 WebInspector.SourcesPanel.DrawerEditorView.prototype = { | |
| 1295 __proto__: WebInspector.VBox.prototype | |
| 1296 } | |
| 1297 | |
| 1298 | |
| 1299 /** | |
| 1300 * @constructor | |
| 1301 * @implements {WebInspector.ContextMenu.Provider} | 1203 * @implements {WebInspector.ContextMenu.Provider} |
| 1302 */ | 1204 */ |
| 1303 WebInspector.SourcesPanel.ContextMenuProvider = function() | 1205 WebInspector.SourcesPanel.ContextMenuProvider = function() |
| 1304 { | 1206 { |
| 1305 } | 1207 } |
| 1306 | 1208 |
| 1307 WebInspector.SourcesPanel.ContextMenuProvider.prototype = { | 1209 WebInspector.SourcesPanel.ContextMenuProvider.prototype = { |
| 1308 /** | 1210 /** |
| 1309 * @param {!Event} event | 1211 * @param {!Event} event |
| 1310 * @param {!WebInspector.ContextMenu} contextMenu | 1212 * @param {!WebInspector.ContextMenu} contextMenu |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 */ | 1352 */ |
| 1451 handleAction: function() | 1353 handleAction: function() |
| 1452 { | 1354 { |
| 1453 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp
ectorView.showPanel("sources")); | 1355 var panel = /** @type {?WebInspector.SourcesPanel} */ (WebInspector.insp
ectorView.showPanel("sources")); |
| 1454 if (!panel) | 1356 if (!panel) |
| 1455 return false; | 1357 return false; |
| 1456 panel.togglePause(); | 1358 panel.togglePause(); |
| 1457 return true; | 1359 return true; |
| 1458 } | 1360 } |
| 1459 } | 1361 } |
| OLD | NEW |