OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 this.element.addEventListener("contextmenu", this.handleContextMenu.bind(thi
s), false); | 55 this.element.addEventListener("contextmenu", this.handleContextMenu.bind(thi
s), false); |
56 | 56 |
57 this._navigatorGroupByFolderSetting = WebInspector.moduleSetting("navigatorG
roupByFolder"); | 57 this._navigatorGroupByFolderSetting = WebInspector.moduleSetting("navigatorG
roupByFolder"); |
58 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); | 58 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); |
59 | 59 |
60 this._initGrouping(); | 60 this._initGrouping(); |
61 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this
); | 61 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated, this
); |
62 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this); | 62 WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel,
WebInspector.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this); |
63 WebInspector.targetManager.observeTargets(this); | 63 WebInspector.targetManager.observeTargets(this); |
| 64 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingCreated, this._onBindingCreated, this); |
| 65 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingRemoved, this._onBindingRemoved, this); |
64 this._resetWorkspace(WebInspector.workspace); | 66 this._resetWorkspace(WebInspector.workspace); |
65 } | 67 } |
66 | 68 |
67 WebInspector.NavigatorView.Types = { | 69 WebInspector.NavigatorView.Types = { |
68 Category: "category", | 70 Category: "category", |
69 Domain: "domain", | 71 Domain: "domain", |
70 File: "file", | 72 File: "file", |
71 FileSystem: "fs", | 73 FileSystem: "fs", |
72 FileSystemFolder: "fs-folder", | 74 FileSystemFolder: "fs-folder", |
73 Frame: "frame", | 75 Frame: "frame", |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 var searchLabel = WebInspector.UIString.capitalize("Search in ^folder"); | 147 var searchLabel = WebInspector.UIString.capitalize("Search in ^folder"); |
146 if (!path || !path.trim()) { | 148 if (!path || !path.trim()) { |
147 path = "*"; | 149 path = "*"; |
148 searchLabel = WebInspector.UIString.capitalize("Search in ^all ^files"); | 150 searchLabel = WebInspector.UIString.capitalize("Search in ^all ^files"); |
149 } | 151 } |
150 contextMenu.appendItem(searchLabel, searchPath); | 152 contextMenu.appendItem(searchLabel, searchPath); |
151 } | 153 } |
152 | 154 |
153 WebInspector.NavigatorView.prototype = { | 155 WebInspector.NavigatorView.prototype = { |
154 /** | 156 /** |
| 157 * @param {!WebInspector.Event} event |
| 158 */ |
| 159 _onBindingCreated: function(event) |
| 160 { |
| 161 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data
); |
| 162 // TODO(lushnikov): show network UISourceCodes in navigator. |
| 163 this._removeUISourceCode(binding.network); |
| 164 }, |
| 165 |
| 166 /** |
| 167 * @param {!WebInspector.Event} event |
| 168 */ |
| 169 _onBindingRemoved: function(event) |
| 170 { |
| 171 var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data
); |
| 172 this._addUISourceCode(binding.network); |
| 173 }, |
| 174 |
| 175 /** |
155 * @override | 176 * @override |
156 */ | 177 */ |
157 focus: function() | 178 focus: function() |
158 { | 179 { |
159 this._scriptsTree.focus(); | 180 this._scriptsTree.focus(); |
160 }, | 181 }, |
161 | 182 |
162 /** | 183 /** |
163 * @param {!WebInspector.Workspace} workspace | 184 * @param {!WebInspector.Workspace} workspace |
164 */ | 185 */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 }, | 224 }, |
204 | 225 |
205 /** | 226 /** |
206 * @param {!WebInspector.UISourceCode} uiSourceCode | 227 * @param {!WebInspector.UISourceCode} uiSourceCode |
207 */ | 228 */ |
208 _addUISourceCode: function(uiSourceCode) | 229 _addUISourceCode: function(uiSourceCode) |
209 { | 230 { |
210 if (!this.accept(uiSourceCode)) | 231 if (!this.accept(uiSourceCode)) |
211 return; | 232 return; |
212 | 233 |
| 234 var binding = WebInspector.persistence.binding(uiSourceCode); |
| 235 if (binding && binding.network === uiSourceCode) |
| 236 return; |
| 237 |
213 var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap(); | 238 var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap(); |
214 var path; | 239 var path; |
215 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) | 240 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst
em) |
216 path = WebInspector.FileSystemWorkspaceBinding.relativePath(uiSource
Code).slice(0, -1); | 241 path = WebInspector.FileSystemWorkspaceBinding.relativePath(uiSource
Code).slice(0, -1); |
217 else | 242 else |
218 path = WebInspector.ParsedURL.splitURLIntoPathComponents(uiSourceCod
e.url()).slice(1, -1); | 243 path = WebInspector.ParsedURL.splitURLIntoPathComponents(uiSourceCod
e.url()).slice(1, -1); |
219 | 244 |
220 var project = uiSourceCode.project(); | 245 var project = uiSourceCode.project(); |
221 var target = WebInspector.NetworkProject.targetForUISourceCode(uiSourceC
ode); | 246 var target = WebInspector.NetworkProject.targetForUISourceCode(uiSourceC
ode); |
222 var frame = this._uiSourceCodeFrame(uiSourceCode); | 247 var frame = this._uiSourceCodeFrame(uiSourceCode); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 457 |
433 return (prettyURL || projectOrigin); | 458 return (prettyURL || projectOrigin); |
434 }, | 459 }, |
435 | 460 |
436 /** | 461 /** |
437 * @param {!WebInspector.UISourceCode} uiSourceCode | 462 * @param {!WebInspector.UISourceCode} uiSourceCode |
438 * @param {boolean=} select | 463 * @param {boolean=} select |
439 */ | 464 */ |
440 revealUISourceCode: function(uiSourceCode, select) | 465 revealUISourceCode: function(uiSourceCode, select) |
441 { | 466 { |
| 467 var binding = WebInspector.persistence.binding(uiSourceCode); |
| 468 if (binding && binding.network === uiSourceCode) |
| 469 uiSourceCode = binding.fileSystem; |
442 var node = this._uiSourceCodeNodes.get(uiSourceCode); | 470 var node = this._uiSourceCodeNodes.get(uiSourceCode); |
443 if (!node) | 471 if (!node) |
444 return; | 472 return; |
445 if (this._scriptsTree.selectedTreeElement) | 473 if (this._scriptsTree.selectedTreeElement) |
446 this._scriptsTree.selectedTreeElement.deselect(); | 474 this._scriptsTree.selectedTreeElement.deselect(); |
447 this._lastSelectedUISourceCode = uiSourceCode; | 475 this._lastSelectedUISourceCode = uiSourceCode; |
448 node.reveal(select); | 476 node.reveal(select); |
449 }, | 477 }, |
450 | 478 |
451 /** | 479 /** |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1283 |
1256 /** | 1284 /** |
1257 * @param {boolean=} ignoreIsDirty | 1285 * @param {boolean=} ignoreIsDirty |
1258 */ | 1286 */ |
1259 updateTitle: function(ignoreIsDirty) | 1287 updateTitle: function(ignoreIsDirty) |
1260 { | 1288 { |
1261 if (!this._treeElement) | 1289 if (!this._treeElement) |
1262 return; | 1290 return; |
1263 | 1291 |
1264 var titleText = this._uiSourceCode.displayName(); | 1292 var titleText = this._uiSourceCode.displayName(); |
1265 if (!ignoreIsDirty && (this._uiSourceCode.isDirty() || this._uiSourceCod
e.hasUnsavedCommittedChanges())) | 1293 if (!ignoreIsDirty && (this._uiSourceCode.isDirty() || WebInspector.pers
istence.hasUnsavedCommittedChanges(this._uiSourceCode))) |
1266 titleText = "*" + titleText; | 1294 titleText = "*" + titleText; |
1267 this._treeElement.title = titleText; | 1295 this._treeElement.title = titleText; |
1268 | 1296 |
1269 var tooltip = this._uiSourceCode.url(); | 1297 var tooltip = this._uiSourceCode.url(); |
1270 if (this._uiSourceCode.contentType().isFromSourceMap()) | 1298 if (this._uiSourceCode.contentType().isFromSourceMap()) |
1271 tooltip = WebInspector.UIString("%s (from source map)", this._uiSour
ceCode.displayName()); | 1299 tooltip = WebInspector.UIString("%s (from source map)", this._uiSour
ceCode.displayName()); |
1272 this._treeElement.tooltip = tooltip; | 1300 this._treeElement.tooltip = tooltip; |
1273 }, | 1301 }, |
1274 | 1302 |
1275 /** | 1303 /** |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 { | 1597 { |
1570 if (this._treeElement) | 1598 if (this._treeElement) |
1571 return this._treeElement; | 1599 return this._treeElement; |
1572 this._treeElement = new WebInspector.NavigatorFolderTreeElement(this._na
vigatorView, this._type, this._title, this._hoverCallback); | 1600 this._treeElement = new WebInspector.NavigatorFolderTreeElement(this._na
vigatorView, this._type, this._title, this._hoverCallback); |
1573 this._treeElement.setNode(this); | 1601 this._treeElement.setNode(this); |
1574 return this._treeElement; | 1602 return this._treeElement; |
1575 }, | 1603 }, |
1576 | 1604 |
1577 __proto__: WebInspector.NavigatorTreeNode.prototype | 1605 __proto__: WebInspector.NavigatorTreeNode.prototype |
1578 } | 1606 } |
OLD | NEW |