提交 41843042 编写于 作者: B Benjamin Pasero

restoreViewlet => openViewlet

上级 4ceac6b8
......@@ -278,7 +278,7 @@ export class Workbench implements IPartService {
viewletRestoreStopWatch = StopWatch.create();
const viewletTimerEvent = timer.start(timer.Topic.STARTUP, strings.format('[renderer] open viewlet {0}', viewletIdToRestore));
compositeAndEditorPromises.push(this.viewletService.restoreViewlet(viewletIdToRestore).then(() => {
compositeAndEditorPromises.push(this.viewletService.openViewlet(viewletIdToRestore).then(() => {
viewletTimerEvent.stop();
viewletRestoreStopWatch.stop();
}));
......
......@@ -25,12 +25,6 @@ export interface IViewletService {
*/
openViewlet(id: string, focus?: boolean): TPromise<IViewlet>;
/**
* Restores a viewlet during startup.
* If the viewlet to restore is external, delay restoration until extensions finish loading.
*/
restoreViewlet(id: string): TPromise<IViewlet>;
/**
* Toggles a viewlet with the given identifier.
*/
......
......@@ -69,27 +69,22 @@ export class ViewletService implements IViewletService {
}
public openViewlet(id: string, focus?: boolean): TPromise<IViewlet> {
return this.sidebarPart.openViewlet(id, focus);
}
public restoreViewlet(id: string): TPromise<IViewlet> {
const shouldFocus = false;
// Built in viewlets do not need to wait for extensions to be loaded
const builtInViewletIds = this.getBuiltInViewlets().map(v => v.id);
const isBuiltInViewlet = builtInViewletIds.indexOf(id) !== -1;
if (isBuiltInViewlet) {
return this.sidebarPart.openViewlet(id, shouldFocus);
return this.sidebarPart.openViewlet(id, focus);
}
// Extension viewlets need to be loaded first which can take time
return this.extensionViewletsLoaded.then(() => {
if (this.viewletRegistry.getViewlet(id)) {
return this.sidebarPart.openViewlet(id, shouldFocus);
return this.sidebarPart.openViewlet(id, focus);
}
// Fallback to default viewlet if extension viewlet is still not found (e.g. uninstalled)
return this.sidebarPart.openViewlet(this.viewletRegistry.getDefaultViewletId(), shouldFocus);
return this.sidebarPart.openViewlet(this.viewletRegistry.getDefaultViewletId(), focus);
});
}
......
......@@ -112,10 +112,6 @@ class TestViewletService implements IViewletService {
return TPromise.as(null);
}
public restoreViewlet(id: string): TPromise<IViewlet> {
return TPromise.as(null);
}
public toggleViewlet(id: string): void {
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册