This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250740 - Introduce Field on local variable is unintuitive
Summary: Introduce Field on local variable is unintuitive
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-26 15:40 UTC by swpalmer
Modified: 2015-04-07 12:41 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2015-02-26 15:40:12 UTC
Select a local variable where it is declared:

e.g.

Button button = new Button(); // <-- select 'button'

Go to the Refactor menu and select Introduce->Field...

A dialog appears stating "Invalid Selection".  This is counter intuitive and should be corrected.  The obvious expectation of the user is that they wish to make the local variable a field variable.
Comment 1 swpalmer 2015-02-26 15:47:08 UTC
I also can't find any mention of the 'Introduce Field' refactoring in the documentation. Searching the help for "refactor introduce field" produces many results, none of which appear to have anything to do with this refactoring.  I simply don't know how to use this refactoring because it doesn't do what I expect and I can't find out how it is supposed to be used.
Comment 2 swpalmer 2015-02-26 15:55:31 UTC
After reading this
http://docs.oracle.com/cd/E50453_01/doc.80/e50452/build_japps.htm#NBDAG592

I tried selecting the entire statement and it worked.  I don't think that is very intuitive, as it is only the variable that is relevant, not the initialization.