| 10 | import { Webview } from './webview'; |
| 11 | |
| 12 | class WebviewPanel extends Webview implements IWebviewPanel { |
| 13 | private get panel(): vscodeWebviewPanel | undefined { |
| 14 | return this.webviewHost as vscodeWebviewPanel; |
| 15 | } |
| 16 | |
| 17 | private get panelOptions(): IWebviewPanelOptions { |
| 18 | return this.options as IWebviewPanelOptions; |
| 19 | } |
| 20 | |
| 21 | constructor( |
| 22 | fs: IFileSystem, |
| 23 | disposableRegistry: IDisposableRegistry, |
| 24 | panelOptions: IWebviewPanelOptions, |
| 25 | additionalRootPaths: Uri[] = [] |
| 26 | ) { |
| 27 | super(fs, disposableRegistry, panelOptions, additionalRootPaths); |
| 28 | } |
| 29 | |
| 30 | public async show(preserveFocus: boolean) { |
| 31 | await this.loadPromise; |
| 32 | if (!this.panel) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | if (preserveFocus) { |
| 37 | if (!this.panel.visible) { |
| 38 | this.panel.reveal(this.panel.viewColumn, preserveFocus); |
| 39 | } |
| 40 | } else { |
| 41 | if (!this.panel.active) { |
| 42 | this.panel.reveal(this.panel.viewColumn, preserveFocus); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | public close() { |
| 48 | if (this.panel) { |
| 49 | this.panel.dispose(); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | public get viewColumn(): ViewColumn | undefined { |
| 54 | return this.panel?.viewColumn; |
| 55 | } |
| 56 | |
| 57 | public isVisible(): boolean { |
| 58 | return this.panel ? this.panel.visible : false; |
| 59 | } |
| 60 | |
| 61 | public isActive(): boolean { |
| 62 | return this.panel ? this.panel.active : false; |
| 63 | } |
| 64 | |
| 65 | public setTitle(newTitle: string) { |
| 66 | this.panelOptions.title = newTitle; |
| 67 | if (this.panel) { |
| 68 | this.panel.title = newTitle; |
| 69 | } |
nothing calls this directly
no outgoing calls
no test coverage detected