netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

#4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch

Open Chris2011 opened this issue 3 years ago • 1 comments
trafficstars

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.

Please bare with me and my knowledge of the stuff. Unfortunately I dunno why the if statement was implemented, that I removed from JavaElementFoldVisitor but this prevents it from adding folding rectangle to those blocks. This is the only line that I need to change in general but, now I changed the method code block to general code-blocks because now it is not only for methods anymore.

Before:

image

After:

image

It works for the mentioned blocks, but switch is still missing.

Chris2011 avatar Jul 28 '22 20:07 Chris2011

wanted to suggest to add a test case for it but the code folding tests don't work anyway and probably haven't been run for a long time, so I suppose its fine ;)

mbien avatar Jul 30 '22 12:07 mbien

Ok, I see the failing build is related to my code changes. Will try to fix them first.

Chris2011 avatar Oct 26 '22 08:10 Chris2011

So everything is back green. Thx to @mbien. @sdedic can you please have a look again :)

Chris2011 avatar Oct 28 '22 18:10 Chris2011

lets wait for #4931 before merging this. Since this PR enables the tests of java.editor

mbien avatar Nov 06 '22 21:11 mbien

Sure, thx for the info.

Chris2011 avatar Nov 06 '22 22:11 Chris2011

@Chris2011 would be good to rebase this PR so we get a fresh CI run on the new config.

Should we move this to NB18? what do you think?

mbien avatar Jan 14 '23 10:01 mbien

@Chris2011 would be good to rebase this PR so we get a fresh CI run on the new config.

Should we move this to NB18? what do you think?

We can move this to NB18, but I'm still waiting for feedback what I should do now. I dunno whether I still should change smth or we need to have a discussion about this. I dunno unfortunately.

Chris2011 avatar Jan 15 '23 12:01 Chris2011

Hey @sdedic for now I hope that I understood what you mean so I changed the mapping in the deprecated Java Editor Lib to the method block and hope that this is what you requested.

Chris2011 avatar May 06 '23 15:05 Chris2011

To test the old implementation, if necessary, do anyone know an old Platform Application, using the old Java Editor Lib to test my stuff?

Chris2011 avatar May 06 '23 20:05 Chris2011