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 229018

Summary: name of constant can not be entered
Product: java Reporter: ma.schroed
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal CC: markiewb, ralphbenjamin
Priority: P2    
Version: 7.3.1   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:

Description ma.schroed 2013-04-25 14:23:37 UTC
When I want to change a local variable to a constant I can not enter a new name in the text field of the dialog box. So I have to do an extra step by renaming the constant.

However if I create a constant out of an argument for a method, I can change the name.

Sample:

//name of the constant can be changed
foo.setText("Some important Text"); 

//name of the constant has to be changed in an extra step
String arg = "Some important Text";
foo.setText(arg);

I would like to do it in one step.
Comment 1 Jiri Prox 2013-04-25 15:28:39 UTC
Same for Introduce Field

To reproduce it is important to call the action from the Refactoring menu with no selection in editor. Invoking as hint works fine
Comment 2 Ralph Ruijs 2013-04-25 15:36:50 UTC
(In reply to comment #1)
> Same for Introduce Field
> To reproduce it is important to call the action from the Refactoring menu with
> no selection in editor. Invoking as hint works fine

Jirka, can you describe both scenarios in more detail? How it works currently is as-designed, but both should work exactly the same.
Comment 3 Jiri Prox 2013-04-25 15:44:34 UTC
Steps to reproduce (thanks to Jirka Kovalsky):
1) have a code:
int number = 4;
2) put cursor behind '4'
3) call Refactoring -> Introduce -> Constant
4) from the popup - select 'int number = 4;'

-> the name is not editable

Now I found that the invoking as hint behaves exactly the same (when the whole line is selected).