Bug 35870 - Getter/Setter dialog improvements
Summary: Getter/Setter dialog improvements
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M1   Edit
Assignee: Randy Faust CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 13958 15840 24681 26592 32483 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-31 11:20 EST by Martin Aeschlimann CLA
Modified: 2003-06-06 09:13 EDT (History)
10 users (show)

See Also:


Attachments
proposed fixes. (36.36 KB, patch)
2003-04-28 04:22 EDT, Randy Faust CLA
no flags Details | Diff
earlier patch file contains extraneous code (32.55 KB, patch)
2003-04-28 04:45 EDT, Randy Faust CLA
no flags Details | Diff
proposed enhancements. (47.44 KB, patch)
2003-05-06 06:39 EDT, Randy Faust CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-03-31 11:20:45 EST
bug report collecting all improvement suggestions for the getter/setter dialog
Comment 1 Martin Aeschlimann CLA 2003-03-31 11:21:11 EST
*** Bug 26592 has been marked as a duplicate of this bug. ***
Comment 2 Martin Aeschlimann CLA 2003-04-01 05:32:33 EST
*** Bug 10858 has been marked as a duplicate of this bug. ***
Comment 3 Martin Aeschlimann CLA 2003-04-01 05:33:02 EST
*** Bug 32483 has been marked as a duplicate of this bug. ***
Comment 4 Martin Aeschlimann CLA 2003-04-01 05:39:29 EST
*** Bug 13958 has been marked as a duplicate of this bug. ***
Comment 5 Martin Aeschlimann CLA 2003-04-01 05:47:34 EST
*** Bug 15840 has been marked as a duplicate of this bug. ***
Comment 6 Martin Aeschlimann CLA 2003-04-01 05:59:17 EST
*** Bug 18757 has been marked as a duplicate of this bug. ***
Comment 7 Alex Blewitt CLA 2003-04-02 07:48:42 EST
It would have been much better to say that this bug depends on all of these 
others, rather than they are duplicates.

There is no information in here to what the bug reports actually are; this bug 
could have been created as a super-bug by depending on the others, and thus 
seen a dependency tree. Marking them as duplicates indicates they are all the 
same solution, which they may not be.

--> bug 26592 said

In the 'Generate getter/setters' method, there are buttons to select all and 
dselect all. It would be useful to have two other buttons; select read methods 
and select write methods. That way, it would be easy to create a read-only 
object that multiple fields but with no set methods.

Of course, this can be done manually at the moment by only selecting the getter 
methods, but having a button to just select the read only methods would be 
useful.

Comment 8 Martin Aeschlimann CLA 2003-04-02 08:27:32 EST
The plan is to implement all these issues at once. 
Comment 9 Martin Aeschlimann CLA 2003-04-11 10:24:20 EDT
*** Bug 24681 has been marked as a duplicate of this bug. ***
Comment 10 Randy Faust CLA 2003-04-28 04:22:19 EDT
Created attachment 4712 [details]
proposed fixes.

Enhancements in patch:
- adds "select all getters" and "select all setters" buttons
- adds toggle for sorting the methods alphabetically into class
- creates set/get pairs instead of all sets/all gets
- adds options for final, static, public, private, protected, default, abstract

- methods are entered at current cursor position

To Do:
- better support for entering methods at current cursor position (should jump
to next method using GoToNextPreviousMemberAction)
- support for entering into file after current element location when selected
in Java outline view

Also To Explore:
- add autogeneration of JUnit tests
- lazy creation for complex types in getter (using templates?)
Comment 11 Randy Faust CLA 2003-04-28 04:45:43 EDT
Created attachment 4713 [details]
earlier patch file contains extraneous code
Comment 12 Randy Faust CLA 2003-05-06 06:39:15 EDT
Created attachment 4793 [details]
proposed enhancements.

- adds option for sorting alphabetically
- adds option for sorting by set/get pairs
- adds visibilities: public, private, protected, default
- adds modifiers: final, native, synchronized
- adds option to enter new methods at cursor location when applicable
- adds option to enter new methods at chosen existing method location
- cleans up dialog L&F
- fixes consistency of labels/titles in dialog

TODO:
- use templates for method construction
- remove body of methods marked as native
Comment 13 Martin Aeschlimann CLA 2003-05-07 04:40:30 EDT
patch released > 20030506
Comment 14 Martin Aeschlimann CLA 2003-06-05 09:43:51 EDT
almost all proposals are now implemented in 3.0 M1

- sort order of the create method either by getter/setter pair or getter then
setters
- insertion point (initialized to cursor position when invoked from the editor's
context menu)
- select visibility
- code template for getter/setter body (on Code Generation preference page)
(user can configure it to lazy initialization or add asserts for setters)
- select all getters / all setters

Please speak up if some request were forgotten (please open a new bug report)
Comment 15 Randy Hudson CLA 2003-06-05 13:26:27 EDT
Could you elaborate on the sorting that was implemented. Bug 10858 requested 
that the added method be sorted among existing methods, not sorted among 
themselves.
Comment 16 Martin Aeschlimann CLA 2003-06-06 03:39:28 EDT
they are sorted among themselves and inserted at a single insert position.
No plans to sort in existing methods.
Comment 17 Alex Blewitt CLA 2003-06-06 07:10:18 EDT
I concur that this fix does not address Bug 32483 or 10858. These bugs should be
reopened since they are not part of the fix (and is one of the problems of
marking bugs as duplicates when they are not in fact duplicates, but a grouping
mechanism).

I think that it would be desirable (bug 10858) to re-sort members after adding
existing ones, though not mandatory. Perhaps it would be desirable to have an
auto-sort checkbox defined in the preferenecs where modifications (specifically
addition of members) could automatically re-sort members as defined by the 
'Sort Members' option.

Whether the sort members would benefit from grouping getter/setters is probably
the subject of a new bug, should anyone wish to raise that.
Comment 18 Randy Hudson CLA 2003-06-06 09:13:02 EDT
I agree with Alex.  I fail to see the point of sorting only the small number of 
methods that are being added.  Also, why would the sorting options here be 
different that the sorting options for the "Sort Member" action.  If someone 
wants to group getter and setters, then they probably want to do it everywhere.

I'm reopening bug 10858. CC if interested.