| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 // Update UISourceCode titles. | 190 // Update UISourceCode titles. |
| 191 var networkNode = this._uiSourceCodeNodes.get(binding.network); | 191 var networkNode = this._uiSourceCodeNodes.get(binding.network); |
| 192 if (networkNode) | 192 if (networkNode) |
| 193 networkNode.updateTitle(); | 193 networkNode.updateTitle(); |
| 194 var fileSystemNode = this._uiSourceCodeNodes.get(binding.fileSystem); | 194 var fileSystemNode = this._uiSourceCodeNodes.get(binding.fileSystem); |
| 195 if (fileSystemNode) | 195 if (fileSystemNode) |
| 196 fileSystemNode.updateTitle(); | 196 fileSystemNode.updateTitle(); |
| 197 | 197 |
| 198 // Update folder titles. | 198 // Update folder titles. |
| 199 var pathTokens = Bindings.FileSystemWorkspaceBinding.relativePath(binding.fi
leSystem); | 199 var pathTokens = Persistence.FileSystemWorkspaceBinding.relativePath(binding
.fileSystem); |
| 200 var folderPath = ''; | 200 var folderPath = ''; |
| 201 for (var i = 0; i < pathTokens.length - 1; ++i) { | 201 for (var i = 0; i < pathTokens.length - 1; ++i) { |
| 202 folderPath += pathTokens[i]; | 202 folderPath += pathTokens[i]; |
| 203 var folderId = | 203 var folderId = |
| 204 this._folderNodeId(binding.fileSystem.project(), null, null, binding.f
ileSystem.origin(), folderPath); | 204 this._folderNodeId(binding.fileSystem.project(), null, null, binding.f
ileSystem.origin(), folderPath); |
| 205 var folderNode = this._subfolderNodes.get(folderId); | 205 var folderNode = this._subfolderNodes.get(folderId); |
| 206 if (folderNode) | 206 if (folderNode) |
| 207 folderNode.updateTitle(); | 207 folderNode.updateTitle(); |
| 208 folderPath += '/'; | 208 folderPath += '/'; |
| 209 } | 209 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (!this.accept(uiSourceCode)) | 260 if (!this.accept(uiSourceCode)) |
| 261 return; | 261 return; |
| 262 | 262 |
| 263 var binding = Persistence.persistence.binding(uiSourceCode); | 263 var binding = Persistence.persistence.binding(uiSourceCode); |
| 264 if (!Runtime.experiments.isEnabled('persistence2') && binding && binding.net
work === uiSourceCode) | 264 if (!Runtime.experiments.isEnabled('persistence2') && binding && binding.net
work === uiSourceCode) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap(); | 267 var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap(); |
| 268 var path; | 268 var path; |
| 269 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) | 269 if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem) |
| 270 path = Bindings.FileSystemWorkspaceBinding.relativePath(uiSourceCode).slic
e(0, -1); | 270 path = Persistence.FileSystemWorkspaceBinding.relativePath(uiSourceCode).s
lice(0, -1); |
| 271 else | 271 else |
| 272 path = Common.ParsedURL.extractPath(uiSourceCode.url()).split('/').slice(1
, -1); | 272 path = Common.ParsedURL.extractPath(uiSourceCode.url()).split('/').slice(1
, -1); |
| 273 | 273 |
| 274 var project = uiSourceCode.project(); | 274 var project = uiSourceCode.project(); |
| 275 var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode); | 275 var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode); |
| 276 var frame = this._uiSourceCodeFrame(uiSourceCode); | 276 var frame = this._uiSourceCodeFrame(uiSourceCode); |
| 277 | 277 |
| 278 var folderNode = | 278 var folderNode = |
| 279 this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.orig
in(), path, isFromSourceMap); | 279 this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.orig
in(), path, isFromSourceMap); |
| 280 var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSou
rceCode); | 280 var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSou
rceCode); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 583 } |
| 584 | 584 |
| 585 /** | 585 /** |
| 586 * @param {!Workspace.Project} project | 586 * @param {!Workspace.Project} project |
| 587 * @param {string} path | 587 * @param {string} path |
| 588 */ | 588 */ |
| 589 _handleContextMenuExclude(project, path) { | 589 _handleContextMenuExclude(project, path) { |
| 590 var shouldExclude = window.confirm(Common.UIString('Are you sure you want to
exclude this folder?')); | 590 var shouldExclude = window.confirm(Common.UIString('Are you sure you want to
exclude this folder?')); |
| 591 if (shouldExclude) { | 591 if (shouldExclude) { |
| 592 UI.startBatchUpdate(); | 592 UI.startBatchUpdate(); |
| 593 project.excludeFolder(Bindings.FileSystemWorkspaceBinding.completeURL(proj
ect, path)); | 593 project.excludeFolder(Persistence.FileSystemWorkspaceBinding.completeURL(p
roject, path)); |
| 594 UI.endBatchUpdate(); | 594 UI.endBatchUpdate(); |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 | 597 |
| 598 /** | 598 /** |
| 599 * @param {!Workspace.UISourceCode} uiSourceCode | 599 * @param {!Workspace.UISourceCode} uiSourceCode |
| 600 */ | 600 */ |
| 601 _handleContextMenuDelete(uiSourceCode) { | 601 _handleContextMenuDelete(uiSourceCode) { |
| 602 var shouldDelete = window.confirm(Common.UIString('Are you sure you want to
delete this file?')); | 602 var shouldDelete = window.confirm(Common.UIString('Are you sure you want to
delete this file?')); |
| 603 if (shouldDelete) | 603 if (shouldDelete) |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 return this._treeElement; | 1392 return this._treeElement; |
| 1393 this._treeElement = this._createTreeElement(this._title, this); | 1393 this._treeElement = this._createTreeElement(this._title, this); |
| 1394 this.updateTitle(); | 1394 this.updateTitle(); |
| 1395 return this._treeElement; | 1395 return this._treeElement; |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 updateTitle() { | 1398 updateTitle() { |
| 1399 if (!this._treeElement || this._project.type() !== Workspace.projectTypes.Fi
leSystem) | 1399 if (!this._treeElement || this._project.type() !== Workspace.projectTypes.Fi
leSystem) |
| 1400 return; | 1400 return; |
| 1401 var absoluteFileSystemPath = | 1401 var absoluteFileSystemPath = |
| 1402 Bindings.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()) +
'/' + this._folderPath; | 1402 Persistence.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()
) + '/' + this._folderPath; |
| 1403 var hasMappedFiles = Runtime.experiments.isEnabled('persistence2') ? | 1403 var hasMappedFiles = Runtime.experiments.isEnabled('persistence2') ? |
| 1404 Persistence.persistence.filePathHasBindings(absoluteFileSystemPath) : | 1404 Persistence.persistence.filePathHasBindings(absoluteFileSystemPath) : |
| 1405 true; | 1405 true; |
| 1406 this._treeElement.listItemElement.classList.toggle('has-mapped-files', hasMa
ppedFiles); | 1406 this._treeElement.listItemElement.classList.toggle('has-mapped-files', hasMa
ppedFiles); |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 /** | 1409 /** |
| 1410 * @return {!TreeElement} | 1410 * @return {!TreeElement} |
| 1411 */ | 1411 */ |
| 1412 _createTreeElement(title, node) { | 1412 _createTreeElement(title, node) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 this.updateTitle(); | 1572 this.updateTitle(); |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 updateTitle() { | 1575 updateTitle() { |
| 1576 if (!this._treeElement || this._project.type() !== Workspace.projectTypes.Fi
leSystem) | 1576 if (!this._treeElement || this._project.type() !== Workspace.projectTypes.Fi
leSystem) |
| 1577 return; | 1577 return; |
| 1578 if (!Runtime.experiments.isEnabled('persistence2')) { | 1578 if (!Runtime.experiments.isEnabled('persistence2')) { |
| 1579 this._treeElement.listItemElement.classList.add('has-mapped-files'); | 1579 this._treeElement.listItemElement.classList.add('has-mapped-files'); |
| 1580 return; | 1580 return; |
| 1581 } | 1581 } |
| 1582 var fileSystemPath = Bindings.FileSystemWorkspaceBinding.fileSystemPath(this
._project.id()); | 1582 var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(t
his._project.id()); |
| 1583 var wasActive = this._treeElement.listItemElement.classList.contains('has-ma
pped-files'); | 1583 var wasActive = this._treeElement.listItemElement.classList.contains('has-ma
pped-files'); |
| 1584 var isActive = Persistence.persistence.filePathHasBindings(fileSystemPath); | 1584 var isActive = Persistence.persistence.filePathHasBindings(fileSystemPath); |
| 1585 if (wasActive === isActive) | 1585 if (wasActive === isActive) |
| 1586 return; | 1586 return; |
| 1587 this._treeElement.listItemElement.classList.toggle('has-mapped-files', isAct
ive); | 1587 this._treeElement.listItemElement.classList.toggle('has-mapped-files', isAct
ive); |
| 1588 if (isActive) | 1588 if (isActive) |
| 1589 this._treeElement.expand(); | 1589 this._treeElement.expand(); |
| 1590 else | 1590 else |
| 1591 this._treeElement.collapse(); | 1591 this._treeElement.collapse(); |
| 1592 } | 1592 } |
| 1593 | 1593 |
| 1594 /** | 1594 /** |
| 1595 * @param {string} title | 1595 * @param {string} title |
| 1596 * @override | 1596 * @override |
| 1597 */ | 1597 */ |
| 1598 setTitle(title) { | 1598 setTitle(title) { |
| 1599 this._title = title; | 1599 this._title = title; |
| 1600 if (this._treeElement) | 1600 if (this._treeElement) |
| 1601 this._treeElement.title = this._title; | 1601 this._treeElement.title = this._title; |
| 1602 } | 1602 } |
| 1603 }; | 1603 }; |
| OLD | NEW |