2222import * as vscode from 'vscode' ;
2323import { homedir } from 'os' ;
2424import { l10n } from '../localiser' ;
25- import { getConfiguration } from '../configurations/handlers' ;
25+ import { getConfigurationValue , updateConfigurationValue } from '../configurations/handlers' ;
2626import { configKeys } from '../configurations/configuration' ;
2727
28-
29-
30-
31-
3228class RunConfigurationNodeProvider implements vscode . TreeDataProvider < vscode . TreeItem > {
3329
3430 private _onDidChangeTreeData : vscode . EventEmitter < vscode . TreeItem | undefined | null > = new vscode . EventEmitter < vscode . TreeItem | undefined | null > ( ) ;
@@ -70,7 +66,7 @@ class RunConfigurationNode extends vscode.TreeItem {
7066
7167 this . settingsKey = settingsKey ;
7268
73- this . value = this . getConfig ( ) . get ( this . settingsKey ) ;
69+ this . value = getConfigurationValue ( this . settingsKey ) ;
7470 this . updateNode ( ) ;
7571 }
7672
@@ -96,29 +92,24 @@ class RunConfigurationNode extends vscode.TreeItem {
9692
9793 setValue ( value : string | undefined ) {
9894 this . value = value ;
99- this . getConfig ( ) . update ( this . settingsKey , this . value , vscode . workspace . name || vscode . workspace . workspaceFile ? null : true ) ;
95+ updateConfigurationValue ( this . settingsKey , this . value , vscode . workspace . name || vscode . workspace . workspaceFile ? null : true ) ;
10096 this . updateNode ( ) ;
10197 }
10298
10399 updateNode ( reload ?: boolean ) {
104100 if ( reload ) {
105- this . value = this . getConfig ( ) . get ( this . settingsKey ) as string ;
101+ this . value = getConfigurationValue ( this . settingsKey ) as string ;
106102 }
107103 this . description = this . value ? this . value : l10n . value ( "jdk.extension.runConfig.default.label" ) ;
108104 this . tooltip = `${ this . label } ${ this . description } ` ;
109105 runConfigurationNodeProvider . refresh ( ) ;
110106 }
111-
112- getConfig ( ) : vscode . WorkspaceConfiguration {
113- return getConfiguration ( configKeys . runConfig ) ;
114- }
115-
116107}
117108
118109class ArgumentsNode extends RunConfigurationNode {
119110
120111 constructor ( ) {
121- super ( l10n . value ( "jdk.extension.runConfig.arguments.label" ) , l10n . value ( "jdk.extension.runConfig.arguments.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "foo bar" } ) , 'arguments' ) ;
112+ super ( l10n . value ( "jdk.extension.runConfig.arguments.label" ) , l10n . value ( "jdk.extension.runConfig.arguments.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "foo bar" } ) , configKeys . runConfigArguments ) ;
122113 }
123114
124115}
@@ -127,7 +118,7 @@ export const argumentsNode = new ArgumentsNode();
127118class VMOptionsNode extends RunConfigurationNode {
128119
129120 constructor ( ) {
130- super ( l10n . value ( "jdk.extension.runConfig.vmoptions.label" ) , l10n . value ( "jdk.extension.runConfig.vmoptions.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "-Xmx512m -Xms256m" } ) , 'vmOptions' ) ;
121+ super ( l10n . value ( "jdk.extension.runConfig.vmoptions.label" ) , l10n . value ( "jdk.extension.runConfig.vmoptions.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "-Xmx512m -Xms256m" } ) , configKeys . runConfigVmOptions ) ;
131122 }
132123
133124}
@@ -136,7 +127,7 @@ export const vmOptionsNode = new VMOptionsNode();
136127class EnvironmentVariablesNode extends RunConfigurationNode {
137128
138129 constructor ( ) {
139- super ( l10n . value ( "jdk.extension.runConfig.env.label" ) , l10n . value ( "jdk.extension.runConfig.env.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "var1=one, varTwo=2" } ) , 'env' ) ;
130+ super ( l10n . value ( "jdk.extension.runConfig.env.label" ) , l10n . value ( "jdk.extension.runConfig.env.prompt" ) , l10n . value ( "jdk.extension.runConfig.example.label" , { data : "var1=one, varTwo=2" } ) , configKeys . runConfigEnv ) ;
140131 }
141132
142133}
@@ -145,7 +136,7 @@ export const environmentVariablesNode = new EnvironmentVariablesNode();
145136class WorkingDirectoryNode extends RunConfigurationNode {
146137
147138 constructor ( ) {
148- super ( l10n . value ( "jdk.extension.runConfig.wrkdir.label" ) , l10n . value ( "jdk.extension.runConfig.wrkdir.prompt" ) , WorkingDirectoryNode . getExample ( ) , 'cwd' ) ;
139+ super ( l10n . value ( "jdk.extension.runConfig.wrkdir.label" ) , l10n . value ( "jdk.extension.runConfig.wrkdir.prompt" ) , WorkingDirectoryNode . getExample ( ) , configKeys . runConfigCwd ) ;
149140 }
150141
151142 static getExample ( ) : string {
0 commit comments