44import * as vscode from "vscode" ;
55import * as path from "path" ;
66import { loadTextFromFile , getExtensionContext } from "../utils" ;
7+ import { sendInfo , instrumentOperation } from "vscode-extension-telemetry-wrapper" ;
78
89let javaGettingStartedView : vscode . WebviewPanel | undefined ;
910
@@ -21,19 +22,28 @@ export async function javaGettingStartedCmdHandler(context: vscode.ExtensionCont
2122 retainContextWhenHidden : true
2223 } ) ;
2324
24- await initializeJavaGettingStartedView ( context , javaGettingStartedView , onDidDisposeWebviewPanel ) ;
25+ await initializeJavaGettingStartedView ( context , javaGettingStartedView , onDidDisposeWebviewPanel , operationId ) ;
2526}
2627
2728function onDidDisposeWebviewPanel ( ) {
2829 javaGettingStartedView = undefined ;
2930}
3031
31- async function initializeJavaGettingStartedView ( context : vscode . ExtensionContext , webviewPanel : vscode . WebviewPanel , onDisposeCallback : ( ) => void ) {
32+ async function initializeJavaGettingStartedView ( context : vscode . ExtensionContext , webviewPanel : vscode . WebviewPanel , onDisposeCallback : ( ) => void , operationId : string ) {
3233 webviewPanel . iconPath = vscode . Uri . file ( path . join ( context . extensionPath , "logo.lowres.png" ) ) ;
3334 const resourceUri = context . asAbsolutePath ( "./out/assets/getting-started/index.html" ) ;
3435 webviewPanel . webview . html = await loadTextFromFile ( resourceUri ) ;
3536
3637 context . subscriptions . push ( webviewPanel . onDidDispose ( onDisposeCallback ) ) ;
38+ context . subscriptions . push ( webviewPanel . webview . onDidReceiveMessage ( async ( e ) => {
39+ if ( e . command === "tabActivated" ) {
40+ let tabId = e . tabId ;
41+ sendInfo ( operationId , {
42+ infoType : "tabActivated" ,
43+ tabId : tabId
44+ } ) ;
45+ }
46+ } ) ) ;
3747}
3848
3949export class JavaGettingStartedViewSerializer implements vscode . WebviewPanelSerializer {
@@ -45,6 +55,8 @@ export class JavaGettingStartedViewSerializer implements vscode.WebviewPanelSeri
4555 }
4656
4757 javaGettingStartedView = webviewPanel ;
48- initializeJavaGettingStartedView ( getExtensionContext ( ) , webviewPanel , onDidDisposeWebviewPanel ) ;
58+ instrumentOperation ( "restoreGettingStartedView" , operationId => {
59+ initializeJavaGettingStartedView ( getExtensionContext ( ) , webviewPanel , onDidDisposeWebviewPanel , operationId ) ;
60+ } ) ( ) ;
4961 }
5062}
0 commit comments