Bug 177655

Summary: [content assist] Code completion should provide constructor that sets existing fields
Product: [Eclipse Project] JDT Reporter: Felix Berger <bflat1>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P4 CC: daniel_megert, martinae
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 202470    
Bug Blocks:    

Description Felix Berger CLA 2007-03-15 16:37:12 EDT
Besides the default constructor that is offered as a completion option when you invoke the completion insdie a class and outside of a any method, it'd be very usefull if also a construct was shown that sets the existing fields in the class.
Comment 1 Dani Megert CLA 2007-03-16 02:57:22 EDT
There's a quick assist for that, right Martin?
Comment 2 Felix Berger CLA 2007-03-16 10:46:56 EDT
There is also a dialog accessible from the Source menu that generates a constructor from the fields, but it would be convenient to just have it in the completion.

If I'm not mistaken the quick fix "Assign parameter to field" does it the other way around. If you don't have the fields yet and after you've written the constructor you can move the cursor on parameters of the constructor and generate the setting code and the fields necessary.
Comment 3 Martin Aeschlimann CLA 2007-04-02 10:38:07 EDT
Having this in content assist makes sense too (as a second proposal). Dani, I know I implemented that proposal once, but I think it should better be in the jdt-text inbox.
Comment 4 Dani Megert CLA 2007-04-02 10:43:06 EDT
>Dani, I know I implemented that proposal once
So, it's there already?
Comment 5 Martin Aeschlimann CLA 2007-04-13 10:59:24 EDT
The 'create constructor' proposal is there already. But just for default constructors. The suggestion would be to add a second one with a parameter per field.
Comment 6 Dani Megert CLA 2008-02-01 03:46:57 EST

*** This bug has been marked as a duplicate of bug 202470 ***
Comment 7 Dani Megert CLA 2008-02-01 03:47:36 EST
Wanted to mark as dependent - not dup.
Comment 8 Dani Megert CLA 2008-04-23 09:20:05 EDT
Not for 3.4.