Chromium Code Reviews| 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 * * 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 this._workingCopy = this._workingCopyGetter(); | 432 this._workingCopy = this._workingCopyGetter(); |
| 433 delete this._workingCopyGetter; | 433 delete this._workingCopyGetter; |
| 434 } | 434 } |
| 435 if (this.isDirty()) | 435 if (this.isDirty()) |
| 436 return this._workingCopy; | 436 return this._workingCopy; |
| 437 return this._content; | 437 return this._content; |
| 438 } | 438 } |
| 439 | 439 |
| 440 resetWorkingCopy() { | 440 resetWorkingCopy() { |
| 441 this._innerResetWorkingCopy(); | 441 this._innerResetWorkingCopy(); |
| 442 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); | 442 this._fireWorkingCopyChanged(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 _innerResetWorkingCopy() { | 445 _innerResetWorkingCopy() { |
| 446 delete this._workingCopy; | 446 delete this._workingCopy; |
| 447 delete this._workingCopyGetter; | 447 delete this._workingCopyGetter; |
| 448 } | 448 } |
| 449 | 449 |
| 450 /** | 450 /** |
| 451 * @param {string} newWorkingCopy | 451 * @param {string} newWorkingCopy |
| 452 */ | 452 */ |
| 453 setWorkingCopy(newWorkingCopy) { | 453 setWorkingCopy(newWorkingCopy) { |
| 454 this._workingCopy = newWorkingCopy; | 454 this._workingCopy = newWorkingCopy; |
| 455 delete this._workingCopyGetter; | 455 delete this._workingCopyGetter; |
| 456 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); | 456 this._fireWorkingCopyChanged(); |
| 457 this._project.workspace().dispatchEventToListeners( | |
| 458 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this}); | |
| 459 } | 457 } |
| 460 | 458 |
| 461 setWorkingCopyGetter(workingCopyGetter) { | 459 setWorkingCopyGetter(workingCopyGetter) { |
| 462 this._workingCopyGetter = workingCopyGetter; | 460 this._workingCopyGetter = workingCopyGetter; |
| 461 this._fireWorkingCopyChanged(); | |
| 462 } | |
| 463 | |
| 464 _fireWorkingCopyChanged() { | |
|
dgozman
2016/11/23 22:24:41
_workingCopyChanged
lushnikov
2016/11/23 23:27:15
Done.
| |
| 465 this._removeAllMessages(); | |
| 463 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); | 466 this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChang ed); |
| 464 this._project.workspace().dispatchEventToListeners( | 467 this._project.workspace().dispatchEventToListeners( |
| 465 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this}); | 468 Workspace.Workspace.Events.WorkingCopyChanged, {uiSourceCode: this}); |
| 466 } | 469 } |
| 467 | 470 |
| 468 removeWorkingCopyGetter() { | 471 removeWorkingCopyGetter() { |
| 469 if (!this._workingCopyGetter) | 472 if (!this._workingCopyGetter) |
| 470 return; | 473 return; |
| 471 this._workingCopy = this._workingCopyGetter(); | 474 this._workingCopy = this._workingCopyGetter(); |
| 472 delete this._workingCopyGetter; | 475 delete this._workingCopyGetter; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 } | 591 } |
| 589 | 592 |
| 590 /** | 593 /** |
| 591 * @param {!Workspace.UISourceCode.Message} message | 594 * @param {!Workspace.UISourceCode.Message} message |
| 592 */ | 595 */ |
| 593 removeMessage(message) { | 596 removeMessage(message) { |
| 594 if (this._messages.remove(message)) | 597 if (this._messages.remove(message)) |
| 595 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); | 598 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); |
| 596 } | 599 } |
| 597 | 600 |
| 598 removeAllMessages() { | 601 _removeAllMessages() { |
| 599 var messages = this._messages; | 602 var messages = this._messages; |
| 600 this._messages = []; | 603 this._messages = []; |
| 601 for (var message of messages) | 604 for (var message of messages) |
| 602 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); | 605 this.dispatchEventToListeners(Workspace.UISourceCode.Events.MessageRemoved , message); |
| 603 } | 606 } |
| 604 | 607 |
| 605 /** | 608 /** |
| 606 * @param {number} lineNumber | 609 * @param {number} lineNumber |
| 607 * @param {string} type | 610 * @param {string} type |
| 608 * @param {?} data | 611 * @param {?} data |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 Workspace.UISourceCodeMetadata = class { | 946 Workspace.UISourceCodeMetadata = class { |
| 944 /** | 947 /** |
| 945 * @param {?Date} modificationTime | 948 * @param {?Date} modificationTime |
| 946 * @param {?number} contentSize | 949 * @param {?number} contentSize |
| 947 */ | 950 */ |
| 948 constructor(modificationTime, contentSize) { | 951 constructor(modificationTime, contentSize) { |
| 949 this.modificationTime = modificationTime; | 952 this.modificationTime = modificationTime; |
| 950 this.contentSize = contentSize; | 953 this.contentSize = contentSize; |
| 951 } | 954 } |
| 952 }; | 955 }; |
| OLD | NEW |