Bug 259064

Summary: [quick assist] convert for-loop to while (and back)
Product: [Eclipse Project] JDT Reporter: Thorbjørn Ravn Andersen <thorbjoern>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Thorbjørn Ravn Andersen CLA 2008-12-17 03:26:01 EST
Build ID: jdt:  M20080709-0800 (myeclipse 7.0)

Steps To Reproduce:
1. enter "for(int i = 0; i < 10; i++) {System.out.println(i);}"
2. place cursor on "for"
3. quickfix should suggest "refactor to int i=0; while(i<10) {System.out.println(i); i++;}"


More information:
the structure "for(a; b; c) {d}" should be changed to
"a; while(b) {d; c}" and reformatted.
Comment 1 Thorbjørn Ravn Andersen CLA 2008-12-17 04:27:50 EST
I don't believe that "and back" is an option, as you would need to indicate what a and c would be in order to do this accurately.

Converting a "while (b) {d}" to "for(;b;) {d}" should be easy though :)