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

Bug 349645

Summary: [1.7][typing] Update the indenter for try with resources
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: TextAssignee: Deepak Azad <deepakazad>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: amj87.iitr, daniel_megert, deepakazad
Version: 3.7Flags: daniel_megert: review+
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix + test none

Description Deepak Azad CLA 2011-06-17 01:50:34 EDT
Formatter has been updated for try with resources (see Bug 349008). Now Ctrl+I and Enter behave differently from the formatter and need to be updated.
------------------------------------------------------------------------
try (FileReader reader1 = new FileReader("file1");
					FileReader reader2 = new FileReader("file2");
					FileReader reader3 = new FileReader("file3");
					FileReader reader4 = new FileReader("file4");
					FileReader reader5 = new FileReader("file5")) {
				int ch;
				while ((ch = reader1.read()) != -1) {
					System.out.println(ch);
				}
			}
------------------------------------------------------------------------
Comment 1 Dani Megert CLA 2011-06-17 01:52:34 EDT
3.7.1 time permitting.
Comment 2 Deepak Azad CLA 2011-06-17 01:55:52 EDT
"FileReader reader2 = new FileReader("file2");" and subsequent resource
declarations are indented by 2 with respect to 'try' by the formatter, however
Ctrl+I does not indent them at all.
Comment 3 Deepak Azad CLA 2011-06-17 05:21:32 EDT
Created attachment 198169 [details]
fix + test
Comment 4 Deepak Azad CLA 2011-06-17 05:22:24 EDT
Dnai, the fix looks ok?
Comment 5 Dani Megert CLA 2011-06-21 11:59:27 EDT
The patch looks good. Please merge it with the patch from bug 348198 (this is also intended to go into 3.7.1 anyway) and commit both together into the beta branch.

Thanks.
Comment 6 Deepak Azad CLA 2011-06-22 01:04:17 EDT
Thanks for the review Dani! 

Committed to BETA_JAVA7.
Comment 7 Ayushman Jain CLA 2011-07-20 02:49:23 EDT
Verified using JDT feature patch v20110714-1300.