| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * @param {!Common.Event} event | 116 * @param {!Common.Event} event |
| 117 */ | 117 */ |
| 118 _workingCopyChanged(event) { | 118 _workingCopyChanged(event) { |
| 119 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); | 119 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); |
| 120 this._scriptSnippetEdited(uiSourceCode); | 120 this._scriptSnippetEdited(uiSourceCode); |
| 121 } | 121 } |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {string} url | 124 * @param {!Workspace.UISourceCode} uiSourceCode |
| 125 */ | 125 */ |
| 126 deleteScriptSnippet(url) { | 126 deleteScriptSnippet(uiSourceCode) { |
| 127 var uiSourceCode = this._project.uiSourceCodeForURL(url); | |
| 128 if (!uiSourceCode) | |
| 129 return; | |
| 130 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ''; | 127 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ''; |
| 131 var snippet = this._snippetStorage.snippetForId(snippetId); | 128 var snippet = this._snippetStorage.snippetForId(snippetId); |
| 132 if (!snippet) | 129 if (!snippet) |
| 133 return; | 130 return; |
| 134 this._snippetStorage.deleteSnippet(snippet); | 131 this._snippetStorage.deleteSnippet(snippet); |
| 135 this._removeBreakpoints(uiSourceCode); | 132 this._removeBreakpoints(uiSourceCode); |
| 136 this._releaseSnippetScript(uiSourceCode); | 133 this._releaseSnippetScript(uiSourceCode); |
| 137 delete this._uiSourceCodeForSnippetId[snippet.id]; | 134 delete this._uiSourceCodeForSnippetId[snippet.id]; |
| 138 this._snippetIdForUISourceCode.remove(uiSourceCode); | 135 this._snippetIdForUISourceCode.remove(uiSourceCode); |
| 139 this._project.removeFile(snippet.name); | 136 this._project.removeFile(snippet.name); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 * @param {?string} name | 602 * @param {?string} name |
| 606 * @param {string} content | 603 * @param {string} content |
| 607 * @param {function(?Workspace.UISourceCode)} callback | 604 * @param {function(?Workspace.UISourceCode)} callback |
| 608 */ | 605 */ |
| 609 createFile(url, name, content, callback) { | 606 createFile(url, name, content, callback) { |
| 610 callback(this._model.createScriptSnippet(content)); | 607 callback(this._model.createScriptSnippet(content)); |
| 611 } | 608 } |
| 612 | 609 |
| 613 /** | 610 /** |
| 614 * @override | 611 * @override |
| 615 * @param {string} url | 612 * @param {!Workspace.UISourceCode} uiSourceCode |
| 616 */ | 613 */ |
| 617 deleteFile(url) { | 614 deleteFile(uiSourceCode) { |
| 618 this._model.deleteScriptSnippet(url); | 615 this._model.deleteScriptSnippet(uiSourceCode); |
| 619 } | 616 } |
| 620 }; | 617 }; |
| 621 | 618 |
| 622 /** | 619 /** |
| 623 * @type {!Snippets.ScriptSnippetModel} | 620 * @type {!Snippets.ScriptSnippetModel} |
| 624 */ | 621 */ |
| 625 Snippets.scriptSnippetModel = new Snippets.ScriptSnippetModel(Workspace.workspac
e); | 622 Snippets.scriptSnippetModel = new Snippets.ScriptSnippetModel(Workspace.workspac
e); |
| OLD | NEW |