| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingCreated, this._onBindingChanged, this); | 63 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingCreated, this._onBindingChanged, this); |
| 64 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingRemoved, this._onBindingChanged, this); | 64 WebInspector.persistence.addEventListener(WebInspector.Persistence.Events.Bi
ndingRemoved, this._onBindingChanged, this); |
| 65 | 65 |
| 66 WebInspector.targetManager.observeTargets(this); | 66 WebInspector.targetManager.observeTargets(this); |
| 67 this._resetWorkspace(WebInspector.workspace); | 67 this._resetWorkspace(WebInspector.workspace); |
| 68 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 WebInspector.NavigatorView.Types = { | 71 WebInspector.NavigatorView.Types = { |
| 71 Category: "category", | 72 Category: "category", |
| 72 Domain: "domain", | 73 Domain: "domain", |
| 73 File: "file", | 74 File: "file", |
| 74 FileSystem: "fs", | 75 FileSystem: "fs", |
| 75 FileSystemFolder: "fs-folder", | 76 FileSystemFolder: "fs-folder", |
| 76 Frame: "frame", | 77 Frame: "frame", |
| 77 NetworkFolder: "nw-folder", | 78 NetworkFolder: "nw-folder", |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 /** | 124 /** |
| 124 * @param {!WebInspector.ContextMenu} contextMenu | 125 * @param {!WebInspector.ContextMenu} contextMenu |
| 125 */ | 126 */ |
| 126 WebInspector.NavigatorView.appendAddFolderItem = function(contextMenu) | 127 WebInspector.NavigatorView.appendAddFolderItem = function(contextMenu) |
| 127 { | 128 { |
| 128 function addFolder() | 129 function addFolder() |
| 129 { | 130 { |
| 130 WebInspector.isolatedFileSystemManager.addFileSystem(); | 131 WebInspector.isolatedFileSystemManager.addFileSystem(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 var addFolderLabel = WebInspector.UIString.capitalize("Add ^folder to ^works
pace"); | 134 var addFolderLabel = WebInspector.UIString("Add folder to workspace"); |
| 134 contextMenu.appendItem(addFolderLabel, addFolder); | 135 contextMenu.appendItem(addFolderLabel, addFolder); |
| 135 } | 136 } |
| 136 | 137 |
| 137 /** | 138 /** |
| 138 * @param {!WebInspector.ContextMenu} contextMenu | 139 * @param {!WebInspector.ContextMenu} contextMenu |
| 139 * @param {string=} path | 140 * @param {string=} path |
| 140 */ | 141 */ |
| 141 WebInspector.NavigatorView.appendSearchItem = function(contextMenu, path) | 142 WebInspector.NavigatorView.appendSearchItem = function(contextMenu, path) |
| 142 { | 143 { |
| 143 function searchPath() | 144 function searchPath() |
| 144 { | 145 { |
| 145 WebInspector.AdvancedSearchView.openSearch("", path.trim()); | 146 WebInspector.AdvancedSearchView.openSearch("", path.trim()); |
| 146 } | 147 } |
| 147 | 148 |
| 148 var searchLabel = WebInspector.UIString.capitalize("Search in ^folder"); | 149 var searchLabel = WebInspector.UIString("Search in folder"); |
| 149 if (!path || !path.trim()) { | 150 if (!path || !path.trim()) { |
| 150 path = "*"; | 151 path = "*"; |
| 151 searchLabel = WebInspector.UIString.capitalize("Search in ^all ^files"); | 152 searchLabel = WebInspector.UIString("Search in all files"); |
| 152 } | 153 } |
| 153 contextMenu.appendItem(searchLabel, searchPath); | 154 contextMenu.appendItem(searchLabel, searchPath); |
| 154 } | 155 } |
| 155 | 156 |
| 156 WebInspector.NavigatorView.prototype = { | 157 WebInspector.NavigatorView.prototype = { |
| 157 /** | 158 /** |
| 158 * @param {!WebInspector.Event} event | 159 * @param {!WebInspector.Event} event |
| 159 */ | 160 */ |
| 160 _onBindingChanged: function(event) | 161 _onBindingChanged: function(event) |
| 161 { | 162 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 * @param {!WebInspector.Workspace} workspace | 200 * @param {!WebInspector.Workspace} workspace |
| 200 */ | 201 */ |
| 201 _resetWorkspace: function(workspace) | 202 _resetWorkspace: function(workspace) |
| 202 { | 203 { |
| 203 this._workspace = workspace; | 204 this._workspace = workspace; |
| 204 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, this._uiSourceCodeAdded, this); | 205 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeAdded, this._uiSourceCodeAdded, this); |
| 205 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeRemoved, this._uiSourceCodeRemoved, this); | 206 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC
odeRemoved, this._uiSourceCodeRemoved, this); |
| 206 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRe
moved, this._projectRemoved.bind(this), this); | 207 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRe
moved, this._projectRemoved.bind(this), this); |
| 207 }, | 208 }, |
| 208 | 209 |
| 209 wasShown: function() | |
| 210 { | |
| 211 if (this._loaded) | |
| 212 return; | |
| 213 this._loaded = true; | |
| 214 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)
); | |
| 215 }, | |
| 216 | |
| 217 /** | 210 /** |
| 218 * @param {!WebInspector.UISourceCode} uiSourceCode | 211 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 219 * @return {boolean} | 212 * @return {boolean} |
| 220 */ | 213 */ |
| 221 accept: function(uiSourceCode) | 214 accept: function(uiSourceCode) |
| 222 { | 215 { |
| 223 return !uiSourceCode.isFromServiceProject(); | 216 return !uiSourceCode.isFromServiceProject(); |
| 224 }, | 217 }, |
| 225 | 218 |
| 226 /** | 219 /** |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 461 |
| 469 return (prettyURL || projectOrigin); | 462 return (prettyURL || projectOrigin); |
| 470 }, | 463 }, |
| 471 | 464 |
| 472 /** | 465 /** |
| 473 * @param {!WebInspector.UISourceCode} uiSourceCode | 466 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 474 * @param {boolean=} select | 467 * @param {boolean=} select |
| 475 */ | 468 */ |
| 476 revealUISourceCode: function(uiSourceCode, select) | 469 revealUISourceCode: function(uiSourceCode, select) |
| 477 { | 470 { |
| 478 var binding = WebInspector.persistence.binding(uiSourceCode); | |
| 479 if (binding && binding.network === uiSourceCode) | |
| 480 uiSourceCode = binding.fileSystem; | |
| 481 var node = this._uiSourceCodeNodes.get(uiSourceCode); | 471 var node = this._uiSourceCodeNodes.get(uiSourceCode); |
| 482 if (!node) | 472 if (!node) |
| 483 return; | 473 return; |
| 484 if (this._scriptsTree.selectedTreeElement) | 474 if (this._scriptsTree.selectedTreeElement) |
| 485 this._scriptsTree.selectedTreeElement.deselect(); | 475 this._scriptsTree.selectedTreeElement.deselect(); |
| 486 this._lastSelectedUISourceCode = uiSourceCode; | 476 this._lastSelectedUISourceCode = uiSourceCode; |
| 487 node.reveal(select); | 477 node.reveal(select); |
| 488 }, | 478 }, |
| 489 | 479 |
| 490 /** | 480 /** |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 this._subfolderNodes.clear(); | 539 this._subfolderNodes.clear(); |
| 550 this._frameNodes.clear(); | 540 this._frameNodes.clear(); |
| 551 this._rootNode.reset(); | 541 this._rootNode.reset(); |
| 552 }, | 542 }, |
| 553 | 543 |
| 554 /** | 544 /** |
| 555 * @param {!Event} event | 545 * @param {!Event} event |
| 556 */ | 546 */ |
| 557 handleContextMenu: function(event) | 547 handleContextMenu: function(event) |
| 558 { | 548 { |
| 559 var contextMenu = new WebInspector.ContextMenu(event); | |
| 560 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); | |
| 561 contextMenu.show(); | |
| 562 }, | 549 }, |
| 563 | 550 |
| 564 /** | 551 /** |
| 565 * @param {!WebInspector.Project} project | 552 * @param {!WebInspector.Project} project |
| 566 * @param {string} path | 553 * @param {string} path |
| 567 * @param {!WebInspector.UISourceCode=} uiSourceCode | 554 * @param {!WebInspector.UISourceCode=} uiSourceCode |
| 568 */ | 555 */ |
| 569 _handleContextMenuCreate: function(project, path, uiSourceCode) | 556 _handleContextMenuCreate: function(project, path, uiSourceCode) |
| 570 { | 557 { |
| 571 this.create(project, path, uiSourceCode); | 558 this.create(project, path, uiSourceCode); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 */ | 596 */ |
| 610 handleFileContextMenu: function(event, uiSourceCode) | 597 handleFileContextMenu: function(event, uiSourceCode) |
| 611 { | 598 { |
| 612 var contextMenu = new WebInspector.ContextMenu(event); | 599 var contextMenu = new WebInspector.ContextMenu(event); |
| 613 contextMenu.appendApplicableItems(uiSourceCode); | 600 contextMenu.appendApplicableItems(uiSourceCode); |
| 614 contextMenu.appendSeparator(); | 601 contextMenu.appendSeparator(); |
| 615 | 602 |
| 616 var project = uiSourceCode.project(); | 603 var project = uiSourceCode.project(); |
| 617 if (project.type() === WebInspector.projectTypes.FileSystem) { | 604 if (project.type() === WebInspector.projectTypes.FileSystem) { |
| 618 var parentURL = uiSourceCode.parentURL(); | 605 var parentURL = uiSourceCode.parentURL(); |
| 619 contextMenu.appendItem(WebInspector.UIString.capitalize("Rename\u202
6"), this._handleContextMenuRename.bind(this, uiSourceCode)); | 606 contextMenu.appendItem(WebInspector.UIString("Rename\u2026"), this._
handleContextMenuRename.bind(this, uiSourceCode)); |
| 620 contextMenu.appendItem(WebInspector.UIString.capitalize("Make a ^cop
y\u2026"), this._handleContextMenuCreate.bind(this, project, parentURL, uiSource
Code)); | 607 contextMenu.appendItem(WebInspector.UIString("Make a copy\u2026"), t
his._handleContextMenuCreate.bind(this, project, parentURL, uiSourceCode)); |
| 621 contextMenu.appendItem(WebInspector.UIString.capitalize("Delete"), t
his._handleContextMenuDelete.bind(this, uiSourceCode)); | 608 contextMenu.appendItem(WebInspector.UIString("Delete"), this._handle
ContextMenuDelete.bind(this, uiSourceCode)); |
| 622 contextMenu.appendSeparator(); | 609 contextMenu.appendSeparator(); |
| 623 } | 610 } |
| 624 | 611 |
| 625 contextMenu.show(); | 612 contextMenu.show(); |
| 626 }, | 613 }, |
| 627 | 614 |
| 628 /** | 615 /** |
| 629 * @param {!Event} event | 616 * @param {!Event} event |
| 630 * @param {!WebInspector.NavigatorFolderTreeNode} node | 617 * @param {!WebInspector.NavigatorFolderTreeNode} node |
| 631 */ | 618 */ |
| 632 handleFolderContextMenu: function(event, node) | 619 handleFolderContextMenu: function(event, node) |
| 633 { | 620 { |
| 634 var path = node._folderPath; | 621 var path = node._folderPath; |
| 635 var project = node._project; | 622 var project = node._project; |
| 636 | 623 |
| 637 var contextMenu = new WebInspector.ContextMenu(event); | 624 var contextMenu = new WebInspector.ContextMenu(event); |
| 638 | 625 |
| 639 WebInspector.NavigatorView.appendSearchItem(contextMenu, path); | 626 WebInspector.NavigatorView.appendSearchItem(contextMenu, path); |
| 640 contextMenu.appendSeparator(); | 627 contextMenu.appendSeparator(); |
| 641 | 628 |
| 642 if (project && project.type() === WebInspector.projectTypes.FileSystem)
{ | 629 if (project.type() !== WebInspector.projectTypes.FileSystem) |
| 643 contextMenu.appendItem(WebInspector.UIString.capitalize("New ^file")
, this._handleContextMenuCreate.bind(this, project, path)); | 630 return; |
| 644 if (node instanceof WebInspector.NavigatorFolderTreeNode) | 631 |
| 645 contextMenu.appendItem(WebInspector.UIString.capitalize("Exclude
^folder"), this._handleContextMenuExclude.bind(this, project, path)); | 632 contextMenu.appendItem(WebInspector.UIString("New file"), this._handleCo
ntextMenuCreate.bind(this, project, path)); |
| 646 } | 633 contextMenu.appendItem(WebInspector.UIString("Exclude folder"), this._ha
ndleContextMenuExclude.bind(this, project, path)); |
| 647 contextMenu.appendSeparator(); | |
| 648 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); | |
| 649 | 634 |
| 650 function removeFolder() | 635 function removeFolder() |
| 651 { | 636 { |
| 652 var shouldRemove = window.confirm(WebInspector.UIString("Are you sur
e you want to remove this folder?")); | 637 var shouldRemove = window.confirm(WebInspector.UIString("Are you sur
e you want to remove this folder?")); |
| 653 if (shouldRemove) | 638 if (shouldRemove) |
| 654 project.remove(); | 639 project.remove(); |
| 655 } | 640 } |
| 656 | 641 |
| 657 if (project && project.type() === WebInspector.projectTypes.FileSystem)
{ | 642 contextMenu.appendSeparator(); |
| 658 var removeFolderLabel = WebInspector.UIString.capitalize("Remove ^fo
lder from ^workspace"); | 643 WebInspector.NavigatorView.appendAddFolderItem(contextMenu); |
| 659 contextMenu.appendItem(removeFolderLabel, removeFolder); | 644 if (node instanceof WebInspector.NavigatorGroupTreeNode) |
| 660 } | 645 contextMenu.appendItem(WebInspector.UIString("Remove folder from wor
kspace"), removeFolder); |
| 661 | 646 |
| 662 contextMenu.show(); | 647 contextMenu.show(); |
| 663 }, | 648 }, |
| 664 | 649 |
| 665 /** | 650 /** |
| 666 * @param {!WebInspector.UISourceCode} uiSourceCode | 651 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 667 * @param {boolean} deleteIfCanceled | 652 * @param {boolean} deleteIfCanceled |
| 668 */ | 653 */ |
| 669 rename: function(uiSourceCode, deleteIfCanceled) | 654 rename: function(uiSourceCode, deleteIfCanceled) |
| 670 { | 655 { |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 1321 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 1337 }, | 1322 }, |
| 1338 | 1323 |
| 1339 /** | 1324 /** |
| 1340 * @param {boolean=} select | 1325 * @param {boolean=} select |
| 1341 */ | 1326 */ |
| 1342 reveal: function(select) | 1327 reveal: function(select) |
| 1343 { | 1328 { |
| 1344 this.parent.populate(); | 1329 this.parent.populate(); |
| 1345 this.parent.treeNode().expand(); | 1330 this.parent.treeNode().expand(); |
| 1346 this._treeElement.reveal(); | 1331 this._treeElement.reveal(true); |
| 1347 if (select) | 1332 if (select) |
| 1348 this._treeElement.select(true); | 1333 this._treeElement.select(true); |
| 1349 }, | 1334 }, |
| 1350 | 1335 |
| 1351 /** | 1336 /** |
| 1352 * @param {function(boolean)=} callback | 1337 * @param {function(boolean)=} callback |
| 1353 */ | 1338 */ |
| 1354 rename: function(callback) | 1339 rename: function(callback) |
| 1355 { | 1340 { |
| 1356 if (!this._treeElement) | 1341 if (!this._treeElement) |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 return; | 1618 return; |
| 1634 this._treeElement.listItemElement.classList.toggle("has-mapped-files", i
sActive); | 1619 this._treeElement.listItemElement.classList.toggle("has-mapped-files", i
sActive); |
| 1635 if (isActive) | 1620 if (isActive) |
| 1636 this._treeElement.expand(); | 1621 this._treeElement.expand(); |
| 1637 else | 1622 else |
| 1638 this._treeElement.collapse(); | 1623 this._treeElement.collapse(); |
| 1639 }, | 1624 }, |
| 1640 | 1625 |
| 1641 __proto__: WebInspector.NavigatorTreeNode.prototype | 1626 __proto__: WebInspector.NavigatorTreeNode.prototype |
| 1642 } | 1627 } |
| OLD | NEW |