| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 }, | 196 }, |
| 197 | 197 |
| 198 /** | 198 /** |
| 199 * @param {string} path | 199 * @param {string} path |
| 200 */ | 200 */ |
| 201 removeFile: function(path) | 201 removeFile: function(path) |
| 202 { | 202 { |
| 203 this._project._removeFile(path); | 203 this._project._removeFile(path); |
| 204 }, | 204 }, |
| 205 | 205 |
| 206 reset: function() | |
| 207 { | |
| 208 this._project._reset(); | |
| 209 }, | |
| 210 | |
| 211 /** | 206 /** |
| 212 * @return {!WebInspector.Project} | 207 * @return {!WebInspector.Project} |
| 213 */ | 208 */ |
| 214 project: function() | 209 project: function() |
| 215 { | 210 { |
| 216 return this._project; | 211 return this._project; |
| 217 } | 212 } |
| 218 } | 213 } |
| 219 | 214 |
| 220 /** | 215 /** |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 var entry = this._uiSourceCodesMap[path]; | 292 var entry = this._uiSourceCodesMap[path]; |
| 298 var movedUISourceCode = this._uiSourceCodesList[this._uiSourceCodesList.
length - 1]; | 293 var movedUISourceCode = this._uiSourceCodesList[this._uiSourceCodesList.
length - 1]; |
| 299 this._uiSourceCodesList[entry.index] = movedUISourceCode; | 294 this._uiSourceCodesList[entry.index] = movedUISourceCode; |
| 300 var movedEntry = this._uiSourceCodesMap[movedUISourceCode.path()]; | 295 var movedEntry = this._uiSourceCodesMap[movedUISourceCode.path()]; |
| 301 movedEntry.index = entry.index; | 296 movedEntry.index = entry.index; |
| 302 this._uiSourceCodesList.splice(this._uiSourceCodesList.length - 1, 1); | 297 this._uiSourceCodesList.splice(this._uiSourceCodesList.length - 1, 1); |
| 303 delete this._uiSourceCodesMap[path]; | 298 delete this._uiSourceCodesMap[path]; |
| 304 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.U
ISourceCodeRemoved, entry.uiSourceCode); | 299 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.U
ISourceCodeRemoved, entry.uiSourceCode); |
| 305 }, | 300 }, |
| 306 | 301 |
| 307 _reset: function() | 302 _remove: function() |
| 308 { | 303 { |
| 309 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.P
rojectWillReset, this); | 304 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.P
rojectRemoved, this); |
| 310 this._uiSourceCodesMap = {}; | 305 this._uiSourceCodesMap = {}; |
| 311 this._uiSourceCodesList = []; | 306 this._uiSourceCodesList = []; |
| 312 }, | 307 }, |
| 313 | 308 |
| 314 /** | 309 /** |
| 315 * @return {!WebInspector.Workspace} | 310 * @return {!WebInspector.Workspace} |
| 316 */ | 311 */ |
| 317 workspace: function() | 312 workspace: function() |
| 318 { | 313 { |
| 319 return this._workspace; | 314 return this._workspace; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 this._fileSystemMapping = fileSystemMapping; | 541 this._fileSystemMapping = fileSystemMapping; |
| 547 /** @type {!Object.<string, !WebInspector.Project>} */ | 542 /** @type {!Object.<string, !WebInspector.Project>} */ |
| 548 this._projects = {}; | 543 this._projects = {}; |
| 549 this._hasResourceContentTrackingExtensions = false; | 544 this._hasResourceContentTrackingExtensions = false; |
| 550 } | 545 } |
| 551 | 546 |
| 552 WebInspector.Workspace.Events = { | 547 WebInspector.Workspace.Events = { |
| 553 UISourceCodeAdded: "UISourceCodeAdded", | 548 UISourceCodeAdded: "UISourceCodeAdded", |
| 554 UISourceCodeRemoved: "UISourceCodeRemoved", | 549 UISourceCodeRemoved: "UISourceCodeRemoved", |
| 555 UISourceCodeContentCommitted: "UISourceCodeContentCommitted", | 550 UISourceCodeContentCommitted: "UISourceCodeContentCommitted", |
| 556 ProjectWillReset: "ProjectWillReset" | 551 ProjectRemoved: "ProjectRemoved" |
| 557 } | 552 } |
| 558 | 553 |
| 559 WebInspector.Workspace.prototype = { | 554 WebInspector.Workspace.prototype = { |
| 560 /** | 555 /** |
| 561 * @return {!Array.<!WebInspector.UISourceCode>} | 556 * @return {!Array.<!WebInspector.UISourceCode>} |
| 562 */ | 557 */ |
| 563 unsavedSourceCodes: function() | 558 unsavedSourceCodes: function() |
| 564 { | 559 { |
| 565 function filterUnsaved(sourceCode) | 560 function filterUnsaved(sourceCode) |
| 566 { | 561 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 }, | 621 }, |
| 627 | 622 |
| 628 /** | 623 /** |
| 629 * @param {string} projectId | 624 * @param {string} projectId |
| 630 */ | 625 */ |
| 631 removeProject: function(projectId) | 626 removeProject: function(projectId) |
| 632 { | 627 { |
| 633 var project = this._projects[projectId]; | 628 var project = this._projects[projectId]; |
| 634 if (!project) | 629 if (!project) |
| 635 return; | 630 return; |
| 636 project._reset(); | |
| 637 delete this._projects[projectId]; | 631 delete this._projects[projectId]; |
| 632 project._remove(); |
| 638 }, | 633 }, |
| 639 | 634 |
| 640 /** | 635 /** |
| 641 * @param {string} projectId | 636 * @param {string} projectId |
| 642 * @return {!WebInspector.Project} | 637 * @return {!WebInspector.Project} |
| 643 */ | 638 */ |
| 644 project: function(projectId) | 639 project: function(projectId) |
| 645 { | 640 { |
| 646 return this._projects[projectId]; | 641 return this._projects[projectId]; |
| 647 }, | 642 }, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 return this._hasResourceContentTrackingExtensions; | 770 return this._hasResourceContentTrackingExtensions; |
| 776 }, | 771 }, |
| 777 | 772 |
| 778 __proto__: WebInspector.Object.prototype | 773 __proto__: WebInspector.Object.prototype |
| 779 } | 774 } |
| 780 | 775 |
| 781 /** | 776 /** |
| 782 * @type {!WebInspector.Workspace} | 777 * @type {!WebInspector.Workspace} |
| 783 */ | 778 */ |
| 784 WebInspector.workspace; | 779 WebInspector.workspace; |
| OLD | NEW |