44import { provideReactWrapper } from '@microsoft/fast-react-wrapper' ;
55import * as webviewUI from "@vscode/webview-ui-toolkit" ;
66import * as React from "react" ;
7- import { encodeCommandUriWithTelemetry } from '../../utils/webview' ;
87import { JavaRuntimeEntry } from "../types" ;
9- import { onWillBrowseForJDK } from './vscode.api' ;
8+ import { onWillBrowseForJDK , onWillRunCommandFromWebview } from './vscode.api' ;
109
1110const REQUIRED_JDK_VERSION = 17 ;
1211const { wrap } = provideReactWrapper ( React ) ;
@@ -25,8 +24,7 @@ interface State {
2524export class ToolingJDKPanel extends React . Component < Props , State > {
2625 render = ( ) => {
2726 const { javaHomeError } = this . props ;
28- const downloadJDKCommand = encodeCommandUriWithTelemetry ( "java.runtime" , "download" , "java.installJdk" ) ;
29-
27+
3028 return (
3129 < div className = "container" >
3230 < h1 > Configure Runtime for Language Server</ h1 >
@@ -39,7 +37,7 @@ export class ToolingJDKPanel extends React.Component<Props, State> {
3937 { this ?. state ?. isDirty && < Button > < a href = "command:workbench.action.reloadWindow" > Reload</ a > </ Button > }
4038 </ div >
4139 < div className = "jdk-action" >
42- < Button appearance = "secondary" > < a href = { downloadJDKCommand } > Install a < b > New JDK</ b > </ a > </ Button >
40+ < Button appearance = "secondary" onClick = { this . onClickInstallButton } > < a href = "#" > Install a < b > New JDK</ b > </ a > </ Button >
4341 </ div >
4442 </ div >
4543 ) ;
@@ -49,4 +47,8 @@ export class ToolingJDKPanel extends React.Component<Props, State> {
4947 onWillBrowseForJDK ( ) ;
5048 this . setState ( { isDirty : true } ) ;
5149 }
50+
51+ onClickInstallButton = ( ) => {
52+ onWillRunCommandFromWebview ( "java.runtime" , "download" , "java.installJdk" ) ;
53+ }
5254}
0 commit comments