#117391 get view by id

This commit is contained in:
Sandeep Somavarapu 2021-02-24 12:31:16 +01:00
parent 5e16cc37c6
commit f6e68f4b4e
2 changed files with 12 additions and 0 deletions

View file

@ -255,6 +255,17 @@ export class ViewsService extends Disposable implements IViewsService {
return null;
}
getViewWithId<T extends IView>(id: string): T | null {
const viewContainer = this.viewDescriptorService.getViewContainerByViewId(id);
if (viewContainer) {
const viewPaneContainer: IViewPaneContainer | undefined = this.viewPaneContainers.get(viewContainer.id);
if (viewPaneContainer) {
return viewPaneContainer.getView(id) as T;
}
}
return null;
}
async openView<T extends IView>(id: string, focus?: boolean): Promise<T | null> {
const viewContainer = this.viewDescriptorService.getViewContainerByViewId(id);
if (!viewContainer) {

View file

@ -557,6 +557,7 @@ export interface IViewsService {
openView<T extends IView>(id: string, focus?: boolean): Promise<T | null>;
closeView(id: string): void;
getActiveViewWithId<T extends IView>(id: string): T | null;
getViewWithId<T extends IView>(id: string): T | null;
getViewProgressIndicator(id: string): IProgressIndicator | undefined;
}