@@ -21,15 +21,19 @@ class JavaLanguageClient extends AutoLanguageClient {
2121 getGrammarScopes ( ) { return [ 'source.java' ] }
2222 getLanguageName ( ) { return 'Java' }
2323 getServerName ( ) { return 'Eclipse JDT' }
24+ getRootConfigurationKey ( ) { return 'ide-java.server' }
25+ mapConfigurationObject ( configuration ) { return { java : configuration } }
2426
2527 constructor ( ) {
2628 super ( )
2729 this . statusElement = document . createElement ( 'span' )
2830 this . statusElement . className = 'inline-block'
2931
3032 this . commands = {
31- 'java.ignoreIncompleteClasspath' : ( ) => { atom . config . set ( 'ide-java.errors.incompleteClasspathSeverity' , 'ignore' ) } ,
32- 'java.ignoreIncompleteClasspath.help' : ( ) => { shell . openExternal ( 'https://github.com/atom/ide-java/wiki/Incomplete-Classpath-Warning' ) }
33+ 'java.ignoreIncompleteClasspath' : ( ) => {
34+ atom . config . set ( 'ide-java.server.errors.incompleteClasspath.severity' , 'ignore' )
35+ } ,
36+ 'java.ignoreIncompleteClasspath.help' : ( ) => { shell . openExternal ( 'https://github.com/atom/ide-java/wiki/Incomplete-Classpath-Warning' ) } ,
3337 }
3438 }
3539
@@ -196,7 +200,7 @@ class JavaLanguageClient extends AutoLanguageClient {
196200
197201 preInitialization ( connection ) {
198202 connection . onCustom ( 'language/status' , ( e ) => this . updateStatusBar ( `${ e . type . replace ( / ^ S t a r t e d $ / , '' ) } ${ e . message } ` ) )
199- connection . onCustom ( 'language/actionableNotification' , this . actionableNotification . bind ( this ) )
203+ connection . onCustom ( 'language/actionableNotification' , ( notification ) => this . actionableNotification ( notification , connection ) )
200204 }
201205
202206 getInitializeParams ( projectPath , process ) {
@@ -205,11 +209,7 @@ class JavaLanguageClient extends AutoLanguageClient {
205209 params . initializationOptions = { } ;
206210 }
207211 params . initializationOptions . bundles = this . collectJavaExtensions ( ) ;
208- params . initializationOptions . settings = {
209- java : {
210- "java.signatureHelp.enabled" : true
211- }
212- }
212+ params . initializationOptions . settings = atom . config . get ( this . getRootConfigurationKey ( ) )
213213 return params ;
214214 }
215215
@@ -246,39 +246,23 @@ class JavaLanguageClient extends AutoLanguageClient {
246246 }
247247 }
248248
249- actionableNotification ( notification ) {
250- if ( notification . message . startsWith ( 'Classpath is incomplete.' ) ) {
251- switch ( atom . config . get ( 'ide-java.errors.incompleteClasspathSeverity' ) ) {
252- case 'ignore' : return
253- case 'error' : {
254- notification . severity = 1
255- break
256- }
257- case 'warning' : {
258- notification . severity = 2
259- break
260- }
261- case 'info' : {
262- notification . severity = 3
263- break
264- }
265- }
266- }
267-
249+ actionableNotification ( notification , connection ) {
268250 const options = { dismissable : true , detail : this . getServerName ( ) }
269251 if ( Array . isArray ( notification . commands ) ) {
270- options . buttons = notification . commands . map ( c => ( { text : c . title , onDidClick : ( e ) => onActionableButton ( e , c . command ) } ) )
271- // TODO: Deal with the actions
252+ options . buttons = notification . commands . map ( command => ( {
253+ text : command . title ,
254+ onDidClick : ( ) => onActionableButton ( command )
255+ } ) )
272256 }
273257
274258 const notificationDialog = this . createNotification ( notification . severity , notification . message , options )
275259
276- const onActionableButton = ( event , commandName ) => {
277- const commandFunction = this . commands [ commandName ]
260+ const onActionableButton = ( command ) => {
261+ const commandFunction = this . commands [ command . command ]
278262 if ( commandFunction != null ) {
279- commandFunction ( )
263+ commandFunction ( command , connection )
280264 } else {
281- console . log ( `Unknown actionableNotification command '${ commandName } '` )
265+ console . log ( `Unknown actionableNotification command '${ command . command } '` )
282266 }
283267 notificationDialog . dismiss ( )
284268 }
0 commit comments