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

5 comments
Comment actions Permalink

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.

0
Comment actions Permalink


"Casey Barton" <a@b.com> schreef in bericht
news:ivj4k21m1auvvcal3lgkmfkrpl9ifm7atg@4ax.com...

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.


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


0
Comment actions Permalink

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.


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

0
Comment actions Permalink

Hello Philipp,

There will be a quick fix that generates getter in such a case. Look forward
to 2.5 EAP.

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

Best regards,
Andrey Simanovsky


0
Comment actions Permalink

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




0

Please sign in to leave a comment.