Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 567678

Summary: Missing Quick assist "convert to switch expression"
Product: [Eclipse Project] JDT Reporter: Sarika Sinha <sarika.sinha>
Component: UIAssignee: Jeff Johnston <jjohnstn>
Status: VERIFIED FIXED QA Contact: Jeff Johnston <jjohnstn>
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.17   
Target Milestone: 4.18 M3   
Hardware: All   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/170524
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=3c566615c90fac5d8c1a73b83246724438b68470
Whiteboard: 4.18M2
Bug Depends on:    
Bug Blocks: 545342    

Description Sarika Sinha CLA 2020-10-07 10:41:04 EDT
I20201007-0600

Taking out the details from Bug 545342#c9

2 scenarios when I get only 1 quick assist as "Convert to method" and "Convert to switch expression" is missing:
1. If I select till ";" which ends the switch statement.
2. If I select the code by dragging from down to up.


Cleanup adds extra ";"
Comment 1 Jeff Johnston CLA 2020-10-08 19:42:40 EDT
Problem is due to the covering node being passed to the quick assist being the Block rather than the SwitchStatement itself.  Additional code is required to find the Block statement being referenced by the context start position.  This scenario occurs if the white-space on the line of the switch statement is included in the selection.
Comment 2 Eclipse Genie CLA 2020-10-08 19:50:15 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/170524
Comment 4 Jeff Johnston CLA 2020-10-15 17:34:48 EDT
Released for 4.18M2
Comment 5 Jeff Johnston CLA 2020-11-17 15:27:57 EST
Verified for 4.18M3 using I20201117-0600 build