scm: hide input box model from extension host

This commit is contained in:
Joao Moreno
2017-02-03 17:20:26 +01:00
parent d7382f0d55
commit 3eddf71678
11 changed files with 107 additions and 50 deletions

View File

@@ -110,13 +110,19 @@ export class MainThreadSCM extends MainThreadSCMShape {
private proxy: ExtHostSCMShape;
private providers: { [id: string]: MainThreadSCMProvider; } = Object.create(null);
private inputBoxListener: IDisposable;
constructor(
@IThreadService threadService: IThreadService,
@IInstantiationService private instantiationService: IInstantiationService
@IInstantiationService private instantiationService: IInstantiationService,
@ISCMService private scmService: ISCMService
) {
super();
this.proxy = threadService.get(ExtHostContext.ExtHostSCM);
this.inputBoxListener = this.scmService.inputBoxModel.onDidChangeContent(e => {
this.proxy.$onInputBoxValueChange(this.scmService.inputBoxModel.getValue());
});
}
$register(id: string, features: SCMProviderFeatures): void {
@@ -144,10 +150,15 @@ export class MainThreadSCM extends MainThreadSCMShape {
provider.$onChange(rawResourceGroups, count);
}
$setInputBoxValue(value: string): void {
this.scmService.inputBoxModel.setValue(value);
}
dispose(): void {
Object.keys(this.providers)
.forEach(id => this.providers[id].dispose());
this.providers = Object.create(null);
this.inputBoxListener = dispose(this.inputBoxListener);
}
}