Revert "improve revert logic for untitled"

This reverts commit 0256f00d8d.
This commit is contained in:
Benjamin Pasero
2016-06-06 11:39:27 +02:00
parent 8a9ddea7f9
commit 2d33d752cd
11 changed files with 31 additions and 50 deletions

View File

@@ -58,7 +58,7 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
}
private registerListeners(): void {
this.toUnbind.push(this.eventService.addListener2(WorkbenchEventType.UNTITLED_FILE_SAVED, (e: UntitledEditorEvent) => this.onDirtyStateChange(e)));
this.toUnbind.push(this.eventService.addListener2(WorkbenchEventType.UNTITLED_FILE_DELETED, (e: UntitledEditorEvent) => this.onDirtyStateChange(e)));
this.toUnbind.push(this.eventService.addListener2(WorkbenchEventType.UNTITLED_FILE_DIRTY, (e: UntitledEditorEvent) => this.onDirtyStateChange(e)));
}
@@ -97,9 +97,7 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
}
public revert(): TPromise<boolean> {
this.cachedModel.revert();
return TPromise.as(true);
return this.textFileService.revert(this.resource);
}
public suggestFileName(): string {
@@ -181,15 +179,15 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
public dispose(): void {
// Listeners
dispose(this.toUnbind);
// Model
if (this.cachedModel) {
this.cachedModel.dispose();
this.cachedModel = null;
}
// Listeners
dispose(this.toUnbind);
super.dispose();
}
}