提交 f498f7df 编写于 作者: S Sandeep Somavarapu

Extension: Make open extension a service

上级 26f73817
......@@ -116,7 +116,7 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
chain(this.list.onSelectionChange)
.map(e => e.elements[0])
.filter(e => !!e)
.on(this.openExtension, this, this.disposables);
.on(this.extensionsWorkbenchService.open, this, this.disposables);
return TPromise.as(null);
}
......@@ -296,11 +296,6 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
.then(result => new PagedModel(result));
}
private openExtension(extension: IExtension): void {
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
.done(null, err => this.onError(err));
}
private onEnter(): void {
this.list.setSelection(...this.list.getFocus());
}
......
......@@ -368,6 +368,11 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
});
}
open(extension: IExtension): void {
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
.done(null, err => this.onError(err));
}
private fromGallery(gallery: IGalleryExtension): Extension {
const installedByGalleryId = index(this.installed, e => e.local.metadata ? e.local.metadata.id : '');
const id = gallery.id;
......@@ -620,15 +625,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
const extension = result.firstPage[0];
this.openExtension(extension);
this.open(extension);
});
}
private openExtension(extension: IExtension): void {
this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension))
.done(null, err => this.onError(err));
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册