Feature Request: Encapsulate Field Quick Fix
Hi there
If I define a private field, I'm getting quick fix options to remove or
comment the field, but the obvious choice - encapsulate via property -
has to be selected via context menu if no shortcut has been defined
manually. Would love to see that in a future release.
Cheers,
Philipp
Please sign in to leave a comment.
On Fri, 27 Oct 2006 13:09:41 +0200, Philipp Sumi
<nospam@not.a.domain.xy> wrote:
>If I define a private field, I'm getting quick fix options to remove or
>comment the field, but the obvious choice - encapsulate via property -
>has to be selected via context menu if no shortcut has been defined
>manually. Would love to see that in a future release.
I think it is a design mandate that quick fixes do not require further
user input, and perform the refactoring immediately. They're "safe and
reliable".
Encapsulate doesn't really fit this model. I suppose you could have it
do something fixed like generate a public read/write property with an
auto-generated name, but the results will be hit or miss.
"Casey Barton" <a@b.com> schreef in bericht
news:ivj4k21m1auvvcal3lgkmfkrpl9ifm7atg@4ax.com...
>>If I define a private field, I'm getting quick fix options to remove or
>>comment the field, but the obvious choice - encapsulate via property -
>>has to be selected via context menu if no shortcut has been defined
>>manually. Would love to see that in a future release.
>
>
Alt+insert probably is the shortcut you're looking for. You indeed have to
make a few choices, so some aditional keystrokes are required. Note that
the auto-geneated names normally are OK. Provided you hav defined some
prefixing scheme, or if you use camel case to pascal case conversion for
going form a field to a property.
Regards,
Erwin
Alt-Insert still requires me to select the field on a list, even if the
cursor is on it. Furthermore, it doesn't copy the comment of the field
to the property and generates the code not among the other properties.
The "Encapsulate Field" functionality works much better in these areas
(look like they coded the same functionality twice), but as you already
mentioned, it requires additional user input.
Cheers,
Philipp
Hello Philipp,
There will be a quick fix that generates getter in such a case. Look forward
to 2.5 EAP.
Best regards,
Andrey Simanovsky
Hi Andrey
That's great news - I'm definitely looking forward to it :)
Hope it'll work like the "Encapsulate Field" functionality (copies
documentation, creates code near other properties) rather than the
property generation of the "Insert Code" feature.
btw: I'm getting a bit greedy here: How about two quick fixes (one for
getter, one for getter/setter)?
Cheers,
Philipp