提交 89fbf8c8 编写于 作者: J Johannes Rieken

Revert "hidden editor shouldn't listen to events, #9705"

first step in fixing #9892

This reverts commit 3f446e49.
上级 09a148d5
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
import {TPromise} from 'vs/base/common/winjs.base'; import {TPromise} from 'vs/base/common/winjs.base';
import {Dimension, Builder} from 'vs/base/browser/builder'; import {Dimension, Builder} from 'vs/base/browser/builder';
import objects = require('vs/base/common/objects'); import objects = require('vs/base/common/objects');
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {CodeEditorWidget} from 'vs/editor/browser/widget/codeEditorWidget'; import {CodeEditorWidget} from 'vs/editor/browser/widget/codeEditorWidget';
import {OptionsChangeEvent, EventType as WorkbenchEventType} from 'vs/workbench/common/events'; import {OptionsChangeEvent, EventType as WorkbenchEventType} from 'vs/workbench/common/events';
import {EditorInput, EditorOptions} from 'vs/workbench/common/editor'; import {EditorInput, EditorOptions} from 'vs/workbench/common/editor';
...@@ -36,7 +35,6 @@ import {Selection} from 'vs/editor/common/core/selection'; ...@@ -36,7 +35,6 @@ import {Selection} from 'vs/editor/common/core/selection';
export abstract class BaseTextEditor extends BaseEditor { export abstract class BaseTextEditor extends BaseEditor {
private editorControl: IEditor; private editorControl: IEditor;
private _editorContainer: Builder; private _editorContainer: Builder;
private _disposeOnInputChange: IDisposable[] = [];
constructor( constructor(
id: string, id: string,
...@@ -52,6 +50,11 @@ export abstract class BaseTextEditor extends BaseEditor { ...@@ -52,6 +50,11 @@ export abstract class BaseTextEditor extends BaseEditor {
@IThemeService private _themeService: IThemeService @IThemeService private _themeService: IThemeService
) { ) {
super(id, telemetryService); super(id, telemetryService);
this.toUnbind.push(this._eventService.addListener2(WorkbenchEventType.WORKBENCH_OPTIONS_CHANGED, (e) => this.onOptionsChanged(e)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.applyConfiguration(e.config)));
this.toUnbind.push(_themeService.onDidThemeChange(_ => this.onThemeChanged()));
} }
public get instantiationService(): IInstantiationService { public get instantiationService(): IInstantiationService {
...@@ -70,14 +73,6 @@ export abstract class BaseTextEditor extends BaseEditor { ...@@ -70,14 +73,6 @@ export abstract class BaseTextEditor extends BaseEditor {
return this._messageService; return this._messageService;
} }
private hookConfigurationListeners(): void {
if (this._disposeOnInputChange.length === 0) {
this._disposeOnInputChange.push(this._eventService.addListener2(WorkbenchEventType.WORKBENCH_OPTIONS_CHANGED, (e) => this.onOptionsChanged(e)));
this._disposeOnInputChange.push(this.configurationService.onDidUpdateConfiguration(e => this.applyConfiguration(e.config)));
this._disposeOnInputChange.push(this._themeService.onDidThemeChange(_ => this.onThemeChanged()));
}
}
protected applyConfiguration(configuration: IFilesConfiguration): void { protected applyConfiguration(configuration: IFilesConfiguration): void {
// Update Editor with configuration and editor settings // Update Editor with configuration and editor settings
...@@ -146,19 +141,11 @@ export abstract class BaseTextEditor extends BaseEditor { ...@@ -146,19 +141,11 @@ export abstract class BaseTextEditor extends BaseEditor {
} }
public setInput(input: EditorInput, options: EditorOptions): TPromise<void> { public setInput(input: EditorInput, options: EditorOptions): TPromise<void> {
this.hookConfigurationListeners();
return super.setInput(input, options).then(() => { return super.setInput(input, options).then(() => {
this.editorControl.updateOptions(this.getCodeEditorOptions()); // support input specific editor options this.editorControl.updateOptions(this.getCodeEditorOptions()); // support input specific editor options
}); });
} }
public clearInput(): void {
this._disposeOnInputChange = dispose(this._disposeOnInputChange);
return super.clearInput();
}
public setEditorVisible(visible: boolean, position: Position = null): void { public setEditorVisible(visible: boolean, position: Position = null): void {
// Pass on to Editor // Pass on to Editor
...@@ -191,8 +178,6 @@ export abstract class BaseTextEditor extends BaseEditor { ...@@ -191,8 +178,6 @@ export abstract class BaseTextEditor extends BaseEditor {
public dispose(): void { public dispose(): void {
dispose(this._disposeOnInputChange);
// Destroy Editor Control // Destroy Editor Control
this.editorControl.destroy(); this.editorControl.destroy();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册