| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 contextMenu.appendSeparator(); | 236 contextMenu.appendSeparator(); |
| 237 contextMenu.appendItem(Common.UIString('Save as...'), this._handleSaveAs.bin
d(this, uiSourceCode)); | 237 contextMenu.appendItem(Common.UIString('Save as...'), this._handleSaveAs.bin
d(this, uiSourceCode)); |
| 238 contextMenu.show(); | 238 contextMenu.show(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 /** | 241 /** |
| 242 * @param {!Workspace.UISourceCode} uiSourceCode | 242 * @param {!Workspace.UISourceCode} uiSourceCode |
| 243 */ | 243 */ |
| 244 _handleEvaluateSnippet(uiSourceCode) { | 244 _handleEvaluateSnippet(uiSourceCode) { |
| 245 var executionContext = UI.context.flavor(SDK.ExecutionContext); | 245 var executionContext = UI.context.flavor(SDK.ExecutionContext); |
| 246 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets || !ex
ecutionContext) | 246 if (!executionContext) |
| 247 return; | 247 return; |
| 248 Snippets.scriptSnippetModel.evaluateScriptSnippet(executionContext, uiSource
Code); | 248 Snippets.scriptSnippetModel.evaluateScriptSnippet(executionContext, uiSource
Code); |
| 249 } | 249 } |
| 250 | 250 |
| 251 /** | 251 /** |
| 252 * @param {!Workspace.UISourceCode} uiSourceCode | 252 * @param {!Workspace.UISourceCode} uiSourceCode |
| 253 */ | 253 */ |
| 254 _handleSaveAs(uiSourceCode) { | 254 _handleSaveAs(uiSourceCode) { |
| 255 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets) | 255 if (uiSourceCode.project().type() !== Workspace.projectTypes.Snippets) |
| 256 return; | 256 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 270 this.create(Snippets.scriptSnippetModel.project(), ''); | 270 this.create(Snippets.scriptSnippetModel.project(), ''); |
| 271 } | 271 } |
| 272 | 272 |
| 273 /** | 273 /** |
| 274 * @override | 274 * @override |
| 275 */ | 275 */ |
| 276 sourceDeleted(uiSourceCode) { | 276 sourceDeleted(uiSourceCode) { |
| 277 this._handleRemoveSnippet(uiSourceCode); | 277 this._handleRemoveSnippet(uiSourceCode); |
| 278 } | 278 } |
| 279 }; | 279 }; |
| OLD | NEW |