| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 * @return {boolean} | 59 * @return {boolean} |
| 60 */ | 60 */ |
| 61 filePathMatchesFileQuery: function(filePath) { } | 61 filePathMatchesFileQuery: function(filePath) { } |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * @constructor | 65 * @constructor |
| 66 * @param {string} parentPath | 66 * @param {string} parentPath |
| 67 * @param {string} name | 67 * @param {string} name |
| 68 * @param {string} originURL | 68 * @param {string} originURL |
| 69 * @param {string} url | |
| 70 * @param {!WebInspector.ResourceType} contentType | 69 * @param {!WebInspector.ResourceType} contentType |
| 71 */ | 70 */ |
| 72 WebInspector.FileDescriptor = function(parentPath, name, originURL, url, content
Type) | 71 WebInspector.FileDescriptor = function(parentPath, name, originURL, contentType) |
| 73 { | 72 { |
| 74 this.parentPath = parentPath; | 73 this.parentPath = parentPath; |
| 75 this.name = name; | 74 this.name = name; |
| 76 this.originURL = originURL; | 75 this.originURL = originURL; |
| 77 this.url = url; | |
| 78 this.contentType = contentType; | 76 this.contentType = contentType; |
| 79 } | 77 } |
| 80 | 78 |
| 81 /** | 79 /** |
| 82 * @interface | 80 * @interface |
| 83 * @extends {WebInspector.EventTarget} | 81 * @extends {WebInspector.EventTarget} |
| 84 */ | 82 */ |
| 85 WebInspector.ProjectDelegate = function() { } | 83 WebInspector.ProjectDelegate = function() { } |
| 86 | 84 |
| 87 WebInspector.ProjectDelegate.Events = { | 85 WebInspector.ProjectDelegate.Events = { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 setFileContent: function(path, newContent, callback) { }, | 128 setFileContent: function(path, newContent, callback) { }, |
| 131 | 129 |
| 132 /** | 130 /** |
| 133 * @return {boolean} | 131 * @return {boolean} |
| 134 */ | 132 */ |
| 135 canRename: function() { }, | 133 canRename: function() { }, |
| 136 | 134 |
| 137 /** | 135 /** |
| 138 * @param {string} path | 136 * @param {string} path |
| 139 * @param {string} newName | 137 * @param {string} newName |
| 140 * @param {function(boolean, string=, string=, string=, !WebInspector.Resour
ceType=)} callback | 138 * @param {function(boolean, string=, string=, !WebInspector.ResourceType=)}
callback |
| 141 */ | 139 */ |
| 142 rename: function(path, newName, callback) { }, | 140 rename: function(path, newName, callback) { }, |
| 143 | 141 |
| 144 /** | 142 /** |
| 145 * @param {string} path | 143 * @param {string} path |
| 146 * @param {function()=} callback | 144 * @param {function()=} callback |
| 147 */ | 145 */ |
| 148 refresh: function(path, callback) { }, | 146 refresh: function(path, callback) { }, |
| 149 | 147 |
| 150 /** | 148 /** |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 * @param {!WebInspector.Event} event | 274 * @param {!WebInspector.Event} event |
| 277 */ | 275 */ |
| 278 _fileAdded: function(event) | 276 _fileAdded: function(event) |
| 279 { | 277 { |
| 280 var fileDescriptor = /** @type {!WebInspector.FileDescriptor} */ (event.
data); | 278 var fileDescriptor = /** @type {!WebInspector.FileDescriptor} */ (event.
data); |
| 281 var path = fileDescriptor.parentPath ? fileDescriptor.parentPath + "/" +
fileDescriptor.name : fileDescriptor.name; | 279 var path = fileDescriptor.parentPath ? fileDescriptor.parentPath + "/" +
fileDescriptor.name : fileDescriptor.name; |
| 282 var uiSourceCode = this.uiSourceCode(path); | 280 var uiSourceCode = this.uiSourceCode(path); |
| 283 if (uiSourceCode) | 281 if (uiSourceCode) |
| 284 return; | 282 return; |
| 285 | 283 |
| 286 uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.parent
Path, fileDescriptor.name, fileDescriptor.originURL, fileDescriptor.url, fileDes
criptor.contentType); | 284 uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.parent
Path, fileDescriptor.name, fileDescriptor.originURL, fileDescriptor.contentType)
; |
| 287 | 285 |
| 288 this._uiSourceCodesMap.set(path, {uiSourceCode: uiSourceCode, index: thi
s._uiSourceCodesList.length}); | 286 this._uiSourceCodesMap.set(path, {uiSourceCode: uiSourceCode, index: thi
s._uiSourceCodesList.length}); |
| 289 this._uiSourceCodesList.push(uiSourceCode); | 287 this._uiSourceCodesList.push(uiSourceCode); |
| 290 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.U
ISourceCodeAdded, uiSourceCode); | 288 this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.U
ISourceCodeAdded, uiSourceCode); |
| 291 }, | 289 }, |
| 292 | 290 |
| 293 /** | 291 /** |
| 294 * @param {!WebInspector.Event} event | 292 * @param {!WebInspector.Event} event |
| 295 */ | 293 */ |
| 296 _fileRemoved: function(event) | 294 _fileRemoved: function(event) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 * @return {boolean} | 405 * @return {boolean} |
| 408 */ | 406 */ |
| 409 canRename: function() | 407 canRename: function() |
| 410 { | 408 { |
| 411 return this._projectDelegate.canRename(); | 409 return this._projectDelegate.canRename(); |
| 412 }, | 410 }, |
| 413 | 411 |
| 414 /** | 412 /** |
| 415 * @param {!WebInspector.UISourceCode} uiSourceCode | 413 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 416 * @param {string} newName | 414 * @param {string} newName |
| 417 * @param {function(boolean, string=, string=, string=, !WebInspector.Resour
ceType=)} callback | 415 * @param {function(boolean, string=, string=, !WebInspector.ResourceType=)}
callback |
| 418 */ | 416 */ |
| 419 rename: function(uiSourceCode, newName, callback) | 417 rename: function(uiSourceCode, newName, callback) |
| 420 { | 418 { |
| 421 if (newName === uiSourceCode.name()) { | 419 if (newName === uiSourceCode.name()) { |
| 422 callback(true, uiSourceCode.name(), uiSourceCode.networkURL(), uiSou
rceCode.originURL(), uiSourceCode.contentType()); | 420 callback(true, uiSourceCode.name(), uiSourceCode.originURL(), uiSour
ceCode.contentType()); |
| 423 return; | 421 return; |
| 424 } | 422 } |
| 425 | 423 |
| 426 this._projectDelegate.rename(uiSourceCode.path(), newName, innerCallback
.bind(this)); | 424 this._projectDelegate.rename(uiSourceCode.path(), newName, innerCallback
.bind(this)); |
| 427 | 425 |
| 428 /** | 426 /** |
| 429 * @param {boolean} success | 427 * @param {boolean} success |
| 430 * @param {string=} newName | 428 * @param {string=} newName |
| 431 * @param {string=} newURL | |
| 432 * @param {string=} newOriginURL | 429 * @param {string=} newOriginURL |
| 433 * @param {!WebInspector.ResourceType=} newContentType | 430 * @param {!WebInspector.ResourceType=} newContentType |
| 434 * @this {WebInspector.Project} | 431 * @this {WebInspector.Project} |
| 435 */ | 432 */ |
| 436 function innerCallback(success, newName, newURL, newOriginURL, newConten
tType) | 433 function innerCallback(success, newName, newOriginURL, newContentType) |
| 437 { | 434 { |
| 438 if (!success || !newName) { | 435 if (!success || !newName) { |
| 439 callback(false); | 436 callback(false); |
| 440 return; | 437 return; |
| 441 } | 438 } |
| 442 var oldPath = uiSourceCode.path(); | 439 var oldPath = uiSourceCode.path(); |
| 443 var newPath = uiSourceCode.parentPath() ? uiSourceCode.parentPath()
+ "/" + newName : newName; | 440 var newPath = uiSourceCode.parentPath() ? uiSourceCode.parentPath()
+ "/" + newName : newName; |
| 444 var value = /** @type {!{uiSourceCode: !WebInspector.UISourceCode, i
ndex: number}} */ (this._uiSourceCodesMap.get(oldPath)); | 441 var value = /** @type {!{uiSourceCode: !WebInspector.UISourceCode, i
ndex: number}} */ (this._uiSourceCodesMap.get(oldPath)); |
| 445 this._uiSourceCodesMap.set(newPath, value); | 442 this._uiSourceCodesMap.set(newPath, value); |
| 446 this._uiSourceCodesMap.delete(oldPath); | 443 this._uiSourceCodesMap.delete(oldPath); |
| 447 callback(true, newName, newURL, newOriginURL, newContentType); | 444 callback(true, newName, newOriginURL, newContentType); |
| 448 } | 445 } |
| 449 }, | 446 }, |
| 450 | 447 |
| 451 /** | 448 /** |
| 452 * @param {string} path | 449 * @param {string} path |
| 453 * @param {function()=} callback | 450 * @param {function()=} callback |
| 454 */ | 451 */ |
| 455 refresh: function(path, callback) | 452 refresh: function(path, callback) |
| 456 { | 453 { |
| 457 this._projectDelegate.refresh(path, callback); | 454 this._projectDelegate.refresh(path, callback); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 return this._hasResourceContentTrackingExtensions; | 732 return this._hasResourceContentTrackingExtensions; |
| 736 }, | 733 }, |
| 737 | 734 |
| 738 __proto__: WebInspector.Object.prototype | 735 __proto__: WebInspector.Object.prototype |
| 739 } | 736 } |
| 740 | 737 |
| 741 /** | 738 /** |
| 742 * @type {!WebInspector.Workspace} | 739 * @type {!WebInspector.Workspace} |
| 743 */ | 740 */ |
| 744 WebInspector.workspace; | 741 WebInspector.workspace; |
| OLD | NEW |