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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 WebInspector.SourcesPanel = function(workspaceForTest) | 59 WebInspector.SourcesPanel = function(workspaceForTest) |
60 { | 60 { |
61 WebInspector.Panel.call(this, "sources"); | 61 WebInspector.Panel.call(this, "sources"); |
62 this.registerRequiredCSS("sourcesPanel.css"); | 62 this.registerRequiredCSS("sourcesPanel.css"); |
63 this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplet
e. | 63 this.registerRequiredCSS("textPrompt.css"); // Watch Expressions autocomplet
e. |
64 | 64 |
65 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti
ng("showEditorInDrawer", true); | 65 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti
ng("showEditorInDrawer", true); |
66 | 66 |
67 this._workspace = workspaceForTest || WebInspector.workspace; | 67 this._workspace = workspaceForTest || WebInspector.workspace; |
68 | 68 |
69 /** | |
70 * @return {!WebInspector.View} | |
71 * @this {WebInspector.SourcesPanel} | |
72 */ | |
73 function viewGetter() | |
74 { | |
75 return this; | |
76 } | |
77 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | |
78 | |
79 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString
("Sources Panel")); | 69 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString
("Sources Panel")); |
80 this.debugToolbar = this._createDebugToolbar(); | 70 this.debugToolbar = this._createDebugToolbar(); |
81 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); | 71 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); |
82 this.threadsToolbar = new WebInspector.ThreadsToolbar(); | 72 this.threadsToolbar = new WebInspector.ThreadsToolbar(); |
83 | 73 |
84 const initialDebugSidebarWidth = 225; | 74 const initialDebugSidebarWidth = 225; |
85 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); | 75 this._splitView = new WebInspector.SplitView(true, true, "sourcesPanelSplitV
iewState", initialDebugSidebarWidth); |
86 this._splitView.enableShowModeSaving(); | 76 this._splitView.enableShowModeSaving(); |
87 this._splitView.setMainElementConstraints(200, 25); | 77 this._splitView.setMainElementConstraints(200, 25); |
88 this._splitView.setSidebarElementConstraints(WebInspector.SourcesPanel.minTo
olbarWidth, 25); | 78 this._splitView.setSidebarElementConstraints(WebInspector.SourcesPanel.minTo
olbarWidth, 25); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 132 |
143 if (Capabilities.isMainFrontend) | 133 if (Capabilities.isMainFrontend) |
144 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(); | 134 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(); |
145 | 135 |
146 this._historyManager = new WebInspector.EditingLocationHistoryManager(this,
this.currentSourceFrame.bind(this)); | 136 this._historyManager = new WebInspector.EditingLocationHistoryManager(this,
this.currentSourceFrame.bind(this)); |
147 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Ju
mpToPreviousLocation, this._onJumpToPreviousLocation.bind(this)); | 137 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Ju
mpToPreviousLocation, this._onJumpToPreviousLocation.bind(this)); |
148 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Ju
mpToNextLocation, this._onJumpToNextLocation.bind(this)); | 138 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Ju
mpToNextLocation, this._onJumpToNextLocation.bind(this)); |
149 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Cl
oseEditorTab, this._onCloseEditorTab.bind(this)); | 139 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Cl
oseEditorTab, this._onCloseEditorTab.bind(this)); |
150 | 140 |
151 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th
is)); | 141 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th
is)); |
| 142 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Go
ToLine, this._showGoToLineDialog.bind(this)); |
152 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Go
ToMember, this._showOutlineDialog.bind(this)); | 143 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Go
ToMember, this._showOutlineDialog.bind(this)); |
153 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.To
ggleBreakpoint, this._toggleBreakpoint.bind(this)); | 144 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.To
ggleBreakpoint, this._toggleBreakpoint.bind(this)); |
154 | 145 |
155 this._extensionSidebarPanes = []; | 146 this._extensionSidebarPanes = []; |
156 | 147 |
157 this._scriptViewStatusBarItemsContainer = document.createElement("div"); | 148 this._scriptViewStatusBarItemsContainer = document.createElement("div"); |
158 this._scriptViewStatusBarItemsContainer.className = "inline-block"; | 149 this._scriptViewStatusBarItemsContainer.className = "inline-block"; |
159 | 150 |
160 this._scriptViewStatusBarTextContainer = document.createElement("div"); | 151 this._scriptViewStatusBarTextContainer = document.createElement("div"); |
161 this._scriptViewStatusBarTextContainer.className = "hbox"; | 152 this._scriptViewStatusBarTextContainer.className = "hbox"; |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 */ | 1226 */ |
1236 _showOutlineDialog: function(event) | 1227 _showOutlineDialog: function(event) |
1237 { | 1228 { |
1238 var uiSourceCode = this._editorContainer.currentFile(); | 1229 var uiSourceCode = this._editorContainer.currentFile(); |
1239 if (!uiSourceCode) | 1230 if (!uiSourceCode) |
1240 return false; | 1231 return false; |
1241 | 1232 |
1242 switch (uiSourceCode.contentType()) { | 1233 switch (uiSourceCode.contentType()) { |
1243 case WebInspector.resourceTypes.Document: | 1234 case WebInspector.resourceTypes.Document: |
1244 case WebInspector.resourceTypes.Script: | 1235 case WebInspector.resourceTypes.Script: |
1245 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSource
Code, this.highlightPosition.bind(this)); | 1236 WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSource
Code, this.showUISourceCode.bind(this, uiSourceCode)); |
1246 return true; | 1237 return true; |
1247 case WebInspector.resourceTypes.Stylesheet: | 1238 case WebInspector.resourceTypes.Stylesheet: |
1248 WebInspector.StyleSheetOutlineDialog.show(this.visibleView, uiSource
Code, this.highlightPosition.bind(this)); | 1239 WebInspector.StyleSheetOutlineDialog.show(this.visibleView, uiSource
Code, this.showUISourceCode.bind(this, uiSourceCode)); |
1249 return true; | 1240 return true; |
1250 } | 1241 } |
1251 return false; | 1242 return false; |
1252 }, | 1243 }, |
1253 | 1244 |
1254 _installDebuggerSidebarController: function() | 1245 _installDebuggerSidebarController: function() |
1255 { | 1246 { |
1256 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSideb
arButton("navigator", "scripts-navigator-show-hide-button"); | 1247 this._toggleNavigatorSidebarButton = this.editorView.createShowHideSideb
arButton("navigator", "scripts-navigator-show-hide-button"); |
1257 this.editorView.mainElement().appendChild(this._toggleNavigatorSidebarBu
tton.element); | 1248 this.editorView.mainElement().appendChild(this._toggleNavigatorSidebarBu
tton.element); |
1258 | 1249 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 * @this {WebInspector.SourcesPanel} | 1422 * @this {WebInspector.SourcesPanel} |
1432 */ | 1423 */ |
1433 function revealFunction() | 1424 function revealFunction() |
1434 { | 1425 { |
1435 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetDetail
s.bind(this)); | 1426 DebuggerAgent.getFunctionDetails(remoteObject.objectId, didGetDetail
s.bind(this)); |
1436 } | 1427 } |
1437 | 1428 |
1438 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Show function definition" : "Show Function Definition"), revealFun
ction.bind(this)); | 1429 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe
nuTitles() ? "Show function definition" : "Show Function Definition"), revealFun
ction.bind(this)); |
1439 }, | 1430 }, |
1440 | 1431 |
1441 showGoToSourceDialog: function() | 1432 /** |
| 1433 * @param {string=} query |
| 1434 */ |
| 1435 _showOpenResourceDialog: function(query) |
1442 { | 1436 { |
1443 var uiSourceCodes = this._editorContainer.historyUISourceCodes(); | 1437 var uiSourceCodes = this._editorContainer.historyUISourceCodes(); |
1444 /** @type {!Map.<!WebInspector.UISourceCode, number>} */ | 1438 /** @type {!Map.<!WebInspector.UISourceCode, number>} */ |
1445 var defaultScores = new Map(); | 1439 var defaultScores = new Map(); |
1446 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element | 1440 for (var i = 1; i < uiSourceCodes.length; ++i) // Skip current element |
1447 defaultScores.put(uiSourceCodes[i], uiSourceCodes.length - i); | 1441 defaultScores.put(uiSourceCodes[i], uiSourceCodes.length - i); |
1448 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, undefined, defaultScores); | 1442 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, query, defaultScores); |
| 1443 }, |
| 1444 |
| 1445 /** |
| 1446 * @param {?Event=} event |
| 1447 * @return {boolean} |
| 1448 */ |
| 1449 _showGoToLineDialog: function(event) |
| 1450 { |
| 1451 this._showOpenResourceDialog(":"); |
| 1452 return true; |
| 1453 }, |
| 1454 |
| 1455 showGoToSourceDialog: function() |
| 1456 { |
| 1457 this._showOpenResourceDialog(); |
1449 }, | 1458 }, |
1450 | 1459 |
1451 _dockSideChanged: function() | 1460 _dockSideChanged: function() |
1452 { | 1461 { |
1453 var vertically = WebInspector.dockController.isVertical() && WebInspecto
r.settings.splitVerticallyWhenDockedToRight.get(); | 1462 var vertically = WebInspector.dockController.isVertical() && WebInspecto
r.settings.splitVerticallyWhenDockedToRight.get(); |
1454 this._splitVertically(vertically); | 1463 this._splitVertically(vertically); |
1455 }, | 1464 }, |
1456 | 1465 |
1457 /** | 1466 /** |
1458 * @param {boolean} vertically | 1467 * @param {boolean} vertically |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 | 1526 |
1518 this.sidebarPanes.scopechain.expand(); | 1527 this.sidebarPanes.scopechain.expand(); |
1519 this.sidebarPanes.jsBreakpoints.expand(); | 1528 this.sidebarPanes.jsBreakpoints.expand(); |
1520 this.sidebarPanes.callstack.expand(); | 1529 this.sidebarPanes.callstack.expand(); |
1521 | 1530 |
1522 if (WebInspector.settings.watchExpressions.get().length > 0) | 1531 if (WebInspector.settings.watchExpressions.get().length > 0) |
1523 this.sidebarPanes.watchExpressions.expand(); | 1532 this.sidebarPanes.watchExpressions.expand(); |
1524 }, | 1533 }, |
1525 | 1534 |
1526 /** | 1535 /** |
1527 * @return {boolean} | |
1528 */ | |
1529 canHighlightPosition: function() | |
1530 { | |
1531 return !!this.currentSourceFrame(); | |
1532 }, | |
1533 | |
1534 /** | |
1535 * @param {number} line | |
1536 * @param {number=} column | |
1537 */ | |
1538 highlightPosition: function(line, column) | |
1539 { | |
1540 var sourceFrame = this.currentSourceFrame(); | |
1541 if (!sourceFrame) | |
1542 return; | |
1543 this._historyManager.updateCurrentState(); | |
1544 sourceFrame.highlightPosition(line, column); | |
1545 this._historyManager.pushNewState(); | |
1546 }, | |
1547 | |
1548 /** | |
1549 * @param {string} id | 1536 * @param {string} id |
1550 * @param {!WebInspector.SidebarPane} pane | 1537 * @param {!WebInspector.SidebarPane} pane |
1551 */ | 1538 */ |
1552 addExtensionSidebarPane: function(id, pane) | 1539 addExtensionSidebarPane: function(id, pane) |
1553 { | 1540 { |
1554 this._extensionSidebarPanes.push(pane); | 1541 this._extensionSidebarPanes.push(pane); |
1555 this._extensionSidebarPanesContainer.addPane(pane); | 1542 this._extensionSidebarPanesContainer.addPane(pane); |
1556 this.setHideOnDetach(); | 1543 this.setHideOnDetach(); |
1557 }, | 1544 }, |
1558 | 1545 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 { | 1722 { |
1736 } | 1723 } |
1737 | 1724 |
1738 WebInspector.SourcesPanel.EditorAction.prototype = { | 1725 WebInspector.SourcesPanel.EditorAction.prototype = { |
1739 /** | 1726 /** |
1740 * @param {!WebInspector.SourcesPanel} panel | 1727 * @param {!WebInspector.SourcesPanel} panel |
1741 * @return {!Element} | 1728 * @return {!Element} |
1742 */ | 1729 */ |
1743 button: function(panel) { } | 1730 button: function(panel) { } |
1744 } | 1731 } |
OLD | NEW |