Community
Participate
Working Groups
When I have Java code such as in the editor Foo f = new Foo(true, false, true); and I STRG-Click on "Foo" on the right hand side the IDE jumps directly to the constructor. If I have an enum: public enum Bar { CASE_A(true,false), CASE_B(false,true); Bar(boolean a, boolean b) { ... } } and I STRG-Click on "CASE_A" then Eclipse does not jump to the constructor. There is currently no way to jump directly to the corresponding enum constructor. This is in particular a problem when you have enums with many elements and different constructors. In my case I have several huge enums with different constructors and it is really inconvenient that this standard Eclipse behavior simply does not work the same way on enums.
I understand your expectation and s.t. like this is surely desirable. Just to explain the status quo: in your example "CASE_A" is not a reference to a constructor but the declaration of an enum constant. Ctrl+click, OTOH, normally applies on references only, not declarations. If we directly associate selecting "CASE_A" with the constructor, then javadoc hover would no longer work here. The argument list is the only syntax hinting at some constructor invocation being construed behind the scenes. We have precendents where we fake a reference, like the "->" and "::" tokens. Technically this would suggest to make the "(" clickable, but users probably wont find this. So, there is no *trivial* answer to this.
Note that my main problem is that there is currently no way to jump to the constructor. If this would be possible somehow (context menu, clicking on the "(" or something else) it would still be a huge improvement.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/177708
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/177708 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=1b2de80562feebd4ac6d1d610892e7954e8dd835
Released for 4.20M1
Verified for 4.20M1 using I20210406-0600 build
Thank you for fixing this - can't wait for the next Eclipse version :-)