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

Fix #88814

上级 71bf691b
......@@ -845,13 +845,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
}
getViewDescriptors(container: ViewContainer): ViewDescriptorCollection {
let viewDescriptorCollectionItem = this.viewDescriptorCollections.get(container);
if (!viewDescriptorCollectionItem) {
// Create and register the collection if does not exist
this.onDidRegisterViewContainer(container);
viewDescriptorCollectionItem = this.viewDescriptorCollections.get(container);
}
return viewDescriptorCollectionItem!.viewDescriptorCollection;
return this.getOrRegisterViewDescriptorCollection(container);
}
moveViews(views: IViewDescriptor[], viewContainer: ViewContainer): void {
......@@ -942,18 +936,28 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
}
private onDidRegisterViewContainer(viewContainer: ViewContainer): void {
const disposables = new DisposableStore();
const viewDescriptorCollection = disposables.add(new ViewDescriptorCollection(this.contextKeyService));
this.getOrRegisterViewDescriptorCollection(viewContainer);
}
this.onDidChangeActiveViews({ added: viewDescriptorCollection.activeViewDescriptors, removed: [] });
viewDescriptorCollection.onDidChangeActiveViews(changed => this.onDidChangeActiveViews(changed), this, disposables);
private getOrRegisterViewDescriptorCollection(viewContainer: ViewContainer): ViewDescriptorCollection {
let viewDescriptorCollection = this.viewDescriptorCollections.get(viewContainer)?.viewDescriptorCollection;
if (!viewDescriptorCollection) {
const disposables = new DisposableStore();
viewDescriptorCollection = disposables.add(new ViewDescriptorCollection(this.contextKeyService));
this.viewDescriptorCollections.set(viewContainer, { viewDescriptorCollection, disposable: disposables });
this.onDidChangeActiveViews({ added: viewDescriptorCollection.activeViewDescriptors, removed: [] });
viewDescriptorCollection.onDidChangeActiveViews(changed => this.onDidChangeActiveViews(changed), this, disposables);
const viewsToRegister = this.getViewsByContainer(viewContainer);
if (viewsToRegister.length) {
this.addViews(viewContainer, viewsToRegister);
this.viewDescriptorCollections.set(viewContainer, { viewDescriptorCollection, disposable: disposables });
const viewsToRegister = this.getViewsByContainer(viewContainer);
if (viewsToRegister.length) {
this.addViews(viewContainer, viewsToRegister);
}
}
return viewDescriptorCollection;
}
private onDidDeregisterViewContainer(viewContainer: ViewContainer): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册