| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 this._navigatorGroupByFolderSetting = Common.moduleSetting('navigatorGroupBy
Folder'); | 56 this._navigatorGroupByFolderSetting = Common.moduleSetting('navigatorGroupBy
Folder'); |
| 57 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); | 57 this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.
bind(this)); |
| 58 | 58 |
| 59 this._initGrouping(); | 59 this._initGrouping(); |
| 60 SDK.targetManager.addModelListener( | 60 SDK.targetManager.addModelListener( |
| 61 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); | 61 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this
._frameNavigated, this); |
| 62 SDK.targetManager.addModelListener( | 62 SDK.targetManager.addModelListener( |
| 63 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameDetached, this.
_frameDetached, this); | 63 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameDetached, this.
_frameDetached, this); |
| 64 | 64 |
| 65 if (Runtime.experiments.isEnabled('persistence2')) { | 65 Persistence.persistence.addEventListener(Persistence.Persistence.BindingChan
gedEvent, this._onBindingChanged, this); |
| 66 Persistence.persistence.addEventListener( | |
| 67 Persistence.Persistence.Events.BindingCreated, this._onBindingChanged,
this); | |
| 68 Persistence.persistence.addEventListener( | |
| 69 Persistence.Persistence.Events.BindingRemoved, this._onBindingChanged,
this); | |
| 70 } else { | |
| 71 Persistence.persistence.addEventListener( | |
| 72 Persistence.Persistence.Events.BindingCreated, this._onBindingCreated,
this); | |
| 73 Persistence.persistence.addEventListener( | |
| 74 Persistence.Persistence.Events.BindingRemoved, this._onBindingRemoved,
this); | |
| 75 } | |
| 76 SDK.targetManager.addEventListener(SDK.TargetManager.Events.NameChanged, thi
s._targetNameChanged, this); | 66 SDK.targetManager.addEventListener(SDK.TargetManager.Events.NameChanged, thi
s._targetNameChanged, this); |
| 77 | 67 |
| 78 SDK.targetManager.observeTargets(this); | 68 SDK.targetManager.observeTargets(this); |
| 79 this._resetWorkspace(Workspace.workspace); | 69 this._resetWorkspace(Workspace.workspace); |
| 80 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); | 70 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); |
| 81 } | 71 } |
| 82 | 72 |
| 83 /** | 73 /** |
| 84 * @param {!TreeElement} treeElement | 74 * @param {!TreeElement} treeElement |
| 85 */ | 75 */ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 149 |
| 160 var result; | 150 var result; |
| 161 if (typeWeight1 > typeWeight2) | 151 if (typeWeight1 > typeWeight2) |
| 162 return 1; | 152 return 1; |
| 163 if (typeWeight1 < typeWeight2) | 153 if (typeWeight1 < typeWeight2) |
| 164 return -1; | 154 return -1; |
| 165 return treeElement1.titleAsText().compareTo(treeElement2.titleAsText()); | 155 return treeElement1.titleAsText().compareTo(treeElement2.titleAsText()); |
| 166 } | 156 } |
| 167 | 157 |
| 168 /** | 158 /** |
| 169 * @param {!Common.Event} event | 159 * @param {!Persistence.Persistence.BindingChangedEvent} event |
| 170 */ | |
| 171 _onBindingCreated(event) { | |
| 172 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); | |
| 173 this._removeUISourceCode(binding.network); | |
| 174 } | |
| 175 | |
| 176 /** | |
| 177 * @param {!Common.Event} event | |
| 178 */ | |
| 179 _onBindingRemoved(event) { | |
| 180 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); | |
| 181 this._addUISourceCode(binding.network); | |
| 182 } | |
| 183 | |
| 184 /** | |
| 185 * @param {!Common.Event} event | |
| 186 */ | 160 */ |
| 187 _onBindingChanged(event) { | 161 _onBindingChanged(event) { |
| 188 var binding = /** @type {!Persistence.PersistenceBinding} */ (event.data); | 162 if (!Runtime.experiments.isEnabled('persistence2')) { |
| 163 if (event.created) |
| 164 this._removeUISourceCode(event.binding.network); |
| 165 else |
| 166 this._addUISourceCode(event.binding.network); |
| 167 return; |
| 168 } |
| 189 | 169 |
| 190 // Update UISourceCode titles. | 170 // Update UISourceCode titles. |
| 191 var networkNode = this._uiSourceCodeNodes.get(binding.network); | 171 var networkNode = this._uiSourceCodeNodes.get(event.binding.network); |
| 192 if (networkNode) | 172 if (networkNode) |
| 193 networkNode.updateTitle(); | 173 networkNode.updateTitle(); |
| 194 var fileSystemNode = this._uiSourceCodeNodes.get(binding.fileSystem); | 174 var fileSystemNode = this._uiSourceCodeNodes.get(event.binding.fileSystem); |
| 195 if (fileSystemNode) | 175 if (fileSystemNode) |
| 196 fileSystemNode.updateTitle(); | 176 fileSystemNode.updateTitle(); |
| 197 | 177 |
| 198 // Update folder titles. | 178 // Update folder titles. |
| 199 var pathTokens = Persistence.FileSystemWorkspaceBinding.relativePath(binding
.fileSystem); | 179 var pathTokens = Persistence.FileSystemWorkspaceBinding.relativePath(event.b
inding.fileSystem); |
| 200 var folderPath = ''; | 180 var folderPath = ''; |
| 201 for (var i = 0; i < pathTokens.length - 1; ++i) { | 181 for (var i = 0; i < pathTokens.length - 1; ++i) { |
| 202 folderPath += pathTokens[i]; | 182 folderPath += pathTokens[i]; |
| 203 var folderId = | 183 var folderId = this._folderNodeId( |
| 204 this._folderNodeId(binding.fileSystem.project(), null, null, binding.f
ileSystem.origin(), folderPath); | 184 event.binding.fileSystem.project(), null, null, event.binding.fileSyst
em.origin(), folderPath); |
| 205 var folderNode = this._subfolderNodes.get(folderId); | 185 var folderNode = this._subfolderNodes.get(folderId); |
| 206 if (folderNode) | 186 if (folderNode) |
| 207 folderNode.updateTitle(); | 187 folderNode.updateTitle(); |
| 208 folderPath += '/'; | 188 folderPath += '/'; |
| 209 } | 189 } |
| 210 | 190 |
| 211 // Update fileSystem root title. | 191 // Update fileSystem root title. |
| 212 var fileSystemRoot = this._rootNode.child(binding.fileSystem.project().id())
; | 192 var fileSystemRoot = this._rootNode.child(event.binding.fileSystem.project()
.id()); |
| 213 if (fileSystemRoot) | 193 if (fileSystemRoot) |
| 214 fileSystemRoot.updateTitle(); | 194 fileSystemRoot.updateTitle(); |
| 215 } | 195 } |
| 216 | 196 |
| 217 /** | 197 /** |
| 218 * @override | 198 * @override |
| 219 */ | 199 */ |
| 220 focus() { | 200 focus() { |
| 221 this._scriptsTree.focus(); | 201 this._scriptsTree.focus(); |
| 222 } | 202 } |
| (...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 /** | 1574 /** |
| 1595 * @param {string} title | 1575 * @param {string} title |
| 1596 * @override | 1576 * @override |
| 1597 */ | 1577 */ |
| 1598 setTitle(title) { | 1578 setTitle(title) { |
| 1599 this._title = title; | 1579 this._title = title; |
| 1600 if (this._treeElement) | 1580 if (this._treeElement) |
| 1601 this._treeElement.title = this._title; | 1581 this._treeElement.title = this._title; |
| 1602 } | 1582 } |
| 1603 }; | 1583 }; |
| OLD | NEW |