| 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.SplitView} | 33 * @extends {WebInspector.SplitWidget} |
| 34 * @param {!WebInspector.FileSystemModel.FileSystem} fileSystem | 34 * @param {!WebInspector.FileSystemModel.FileSystem} fileSystem |
| 35 */ | 35 */ |
| 36 WebInspector.FileSystemView = function(fileSystem) | 36 WebInspector.FileSystemView = function(fileSystem) |
| 37 { | 37 { |
| 38 WebInspector.SplitView.call(this, true, false, "fileSystemViewSplitViewState
"); | 38 WebInspector.SplitWidget.call(this, true, false, "fileSystemViewSplitViewSta
te"); |
| 39 this.element.classList.add("file-system-view", "storage-view"); | 39 this.element.classList.add("file-system-view", "storage-view"); |
| 40 | 40 |
| 41 var vbox = new WebInspector.VBox(); | 41 var vbox = new WebInspector.VBox(); |
| 42 vbox.element.classList.add("sidebar"); | 42 vbox.element.classList.add("sidebar"); |
| 43 this._directoryTree = new TreeOutline(); | 43 this._directoryTree = new TreeOutline(); |
| 44 this._directoryTree.element.classList.add("outline-disclosure", "filesystem-
directory-tree"); | 44 this._directoryTree.element.classList.add("outline-disclosure", "filesystem-
directory-tree"); |
| 45 vbox.element.appendChild(this._directoryTree.element); | 45 vbox.element.appendChild(this._directoryTree.element); |
| 46 this.setSidebarView(vbox); | 46 this.setSidebarWidget(vbox); |
| 47 | 47 |
| 48 var rootItem = new WebInspector.FileSystemView.EntryTreeElement(this, fileSy
stem.root); | 48 var rootItem = new WebInspector.FileSystemView.EntryTreeElement(this, fileSy
stem.root); |
| 49 rootItem.expanded = true; | 49 rootItem.expanded = true; |
| 50 this._directoryTree.appendChild(rootItem); | 50 this._directoryTree.appendChild(rootItem); |
| 51 this._visibleView = null; | 51 this._visibleView = null; |
| 52 | 52 |
| 53 this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Refresh"), "refresh-toolbar-item"); | 53 this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Refresh"), "refresh-toolbar-item"); |
| 54 this._refreshButton.setVisible(true); | 54 this._refreshButton.setVisible(true); |
| 55 this._refreshButton.addEventListener("click", this._refresh, this); | 55 this._refreshButton.addEventListener("click", this._refresh, this); |
| 56 | 56 |
| 57 this._deleteButton = new WebInspector.ToolbarButton(WebInspector.UIString("D
elete"), "delete-toolbar-item"); | 57 this._deleteButton = new WebInspector.ToolbarButton(WebInspector.UIString("D
elete"), "delete-toolbar-item"); |
| 58 this._deleteButton.setVisible(true); | 58 this._deleteButton.setVisible(true); |
| 59 this._deleteButton.addEventListener("click", this._confirmDelete, this); | 59 this._deleteButton.addEventListener("click", this._confirmDelete, this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 WebInspector.FileSystemView.prototype = { | 62 WebInspector.FileSystemView.prototype = { |
| 63 /** | 63 /** |
| 64 * @return {!Array.<!WebInspector.ToolbarItem>} | 64 * @return {!Array.<!WebInspector.ToolbarItem>} |
| 65 */ | 65 */ |
| 66 toolbarItems: function() | 66 toolbarItems: function() |
| 67 { | 67 { |
| 68 return [this._refreshButton, this._deleteButton]; | 68 return [this._refreshButton, this._deleteButton]; |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @type {!WebInspector.View} | 72 * @type {!WebInspector.Widget} |
| 73 */ | 73 */ |
| 74 get visibleView() | 74 get visibleView() |
| 75 { | 75 { |
| 76 return this._visibleView; | 76 return this._visibleView; |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * @param {!WebInspector.View} view | 80 * @param {!WebInspector.Widget} view |
| 81 */ | 81 */ |
| 82 showView: function(view) | 82 showView: function(view) |
| 83 { | 83 { |
| 84 if (this._visibleView === view) | 84 if (this._visibleView === view) |
| 85 return; | 85 return; |
| 86 if (this._visibleView) | 86 if (this._visibleView) |
| 87 this._visibleView.detach(); | 87 this._visibleView.detach(); |
| 88 this._visibleView = view; | 88 this._visibleView = view; |
| 89 this.setMainView(view); | 89 this.setMainWidget(view); |
| 90 }, | 90 }, |
| 91 | 91 |
| 92 _refresh: function() | 92 _refresh: function() |
| 93 { | 93 { |
| 94 this._directoryTree.firstChild().refresh(); | 94 this._directoryTree.firstChild().refresh(); |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 _confirmDelete: function() | 97 _confirmDelete: function() |
| 98 { | 98 { |
| 99 if (confirm(WebInspector.UIString("Are you sure you want to delete the s
elected entry?"))) | 99 if (confirm(WebInspector.UIString("Are you sure you want to delete the s
elected entry?"))) |
| 100 this._delete(); | 100 this._delete(); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 _delete: function() | 103 _delete: function() |
| 104 { | 104 { |
| 105 this._directoryTree.selectedTreeElement.deleteEntry(); | 105 this._directoryTree.selectedTreeElement.deleteEntry(); |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 __proto__: WebInspector.SplitView.prototype | 108 __proto__: WebInspector.SplitWidget.prototype |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * @constructor | 112 * @constructor |
| 113 * @extends {TreeElement} | 113 * @extends {TreeElement} |
| 114 * @param {!WebInspector.FileSystemView} fileSystemView | 114 * @param {!WebInspector.FileSystemView} fileSystemView |
| 115 * @param {!WebInspector.FileSystemModel.Entry} entry | 115 * @param {!WebInspector.FileSystemModel.Entry} entry |
| 116 */ | 116 */ |
| 117 WebInspector.FileSystemView.EntryTreeElement = function(fileSystemView, entry) | 117 WebInspector.FileSystemView.EntryTreeElement = function(fileSystemView, entry) |
| 118 { | 118 { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 }, | 236 }, |
| 237 | 237 |
| 238 _deletionCompleted: function() | 238 _deletionCompleted: function() |
| 239 { | 239 { |
| 240 if (this._entry != this._entry.fileSystem.root) | 240 if (this._entry != this._entry.fileSystem.root) |
| 241 this.parent.refresh(); | 241 this.parent.refresh(); |
| 242 }, | 242 }, |
| 243 | 243 |
| 244 __proto__: TreeElement.prototype | 244 __proto__: TreeElement.prototype |
| 245 } | 245 } |
| OLD | NEW |