Bug 177655 - [content assist] Code completion should provide constructor that sets existing fields
Summary: [content assist] Code completion should provide constructor that sets existin...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P4 enhancement with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 202470
Blocks:
  Show dependency tree
 
Reported: 2007-03-15 16:37 EDT by Felix Berger CLA
Modified: 2008-04-23 09:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.