| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 constructor(fileSystemWorkspaceBinding, isolatedFileSystem, workspace) { | 191 constructor(fileSystemWorkspaceBinding, isolatedFileSystem, workspace) { |
| 192 var fileSystemPath = isolatedFileSystem.path(); | 192 var fileSystemPath = isolatedFileSystem.path(); |
| 193 var id = Persistence.FileSystemWorkspaceBinding.projectId(fileSystemPath); | 193 var id = Persistence.FileSystemWorkspaceBinding.projectId(fileSystemPath); |
| 194 console.assert(!workspace.project(id)); | 194 console.assert(!workspace.project(id)); |
| 195 var displayName = fileSystemPath.substr(fileSystemPath.lastIndexOf('/') + 1)
; | 195 var displayName = fileSystemPath.substr(fileSystemPath.lastIndexOf('/') + 1)
; |
| 196 | 196 |
| 197 super(workspace, id, Workspace.projectTypes.FileSystem, displayName); | 197 super(workspace, id, Workspace.projectTypes.FileSystem, displayName); |
| 198 | 198 |
| 199 this._fileSystem = isolatedFileSystem; | 199 this._fileSystem = isolatedFileSystem; |
| 200 this._fileSystemBaseURL = this._fileSystem.path() + '/'; | 200 this._fileSystemBaseURL = this._fileSystem.path() + '/'; |
| 201 this._fileSystemParentURL = this._fileSystemBaseURL.substr(0, fileSystemPath
.lastIndexOf('/') + 1); |
| 201 this._fileSystemWorkspaceBinding = fileSystemWorkspaceBinding; | 202 this._fileSystemWorkspaceBinding = fileSystemWorkspaceBinding; |
| 202 this._fileSystemPath = fileSystemPath; | 203 this._fileSystemPath = fileSystemPath; |
| 203 | 204 |
| 204 workspace.addProject(this); | 205 workspace.addProject(this); |
| 205 this.populate(); | 206 this.populate(); |
| 206 } | 207 } |
| 207 | 208 |
| 208 /** | 209 /** |
| 209 * @return {string} | 210 * @return {string} |
| 210 */ | 211 */ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 * @param {string} newContent | 299 * @param {string} newContent |
| 299 * @param {function(?string)} callback | 300 * @param {function(?string)} callback |
| 300 */ | 301 */ |
| 301 setFileContent(uiSourceCode, newContent, callback) { | 302 setFileContent(uiSourceCode, newContent, callback) { |
| 302 var filePath = this._filePathForUISourceCode(uiSourceCode); | 303 var filePath = this._filePathForUISourceCode(uiSourceCode); |
| 303 this._fileSystem.setFileContent(filePath, newContent, callback.bind(this, ''
)); | 304 this._fileSystem.setFileContent(filePath, newContent, callback.bind(this, ''
)); |
| 304 } | 305 } |
| 305 | 306 |
| 306 /** | 307 /** |
| 307 * @override | 308 * @override |
| 309 * @param {!Workspace.UISourceCode} uiSourceCode |
| 310 * @return {string} |
| 311 */ |
| 312 fullDisplayName(uiSourceCode) { |
| 313 var baseURL = |
| 314 /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem}*/ (uiSour
ceCode.project())._fileSystemParentURL; |
| 315 return uiSourceCode.url().substring(baseURL.length); |
| 316 } |
| 317 |
| 318 /** |
| 319 * @override |
| 308 * @return {boolean} | 320 * @return {boolean} |
| 309 */ | 321 */ |
| 310 canRename() { | 322 canRename() { |
| 311 return true; | 323 return true; |
| 312 } | 324 } |
| 313 | 325 |
| 314 /** | 326 /** |
| 315 * @override | 327 * @override |
| 316 * @param {!Workspace.UISourceCode} uiSourceCode | 328 * @param {!Workspace.UISourceCode} uiSourceCode |
| 317 * @param {string} newName | 329 * @param {string} newName |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; | 559 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; |
| 548 uiSourceCode.checkContentUpdated(); | 560 uiSourceCode.checkContentUpdated(); |
| 549 } | 561 } |
| 550 | 562 |
| 551 dispose() { | 563 dispose() { |
| 552 this.removeProject(); | 564 this.removeProject(); |
| 553 } | 565 } |
| 554 }; | 566 }; |
| 555 | 567 |
| 556 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi
nding.Metadata'); | 568 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi
nding.Metadata'); |
| OLD | NEW |