One of the features that led me to switch from using Eclipse was the rename refactoring support for PHP files - it's really useful even if it only works within a single file. As of NB6.9 this feature has been turned-off - I now see "The Rename refactoring cannot be applied in this context."
Please restore this really useful feature!
Not only with Linux, also with Windows. But, only the context menu entry seems to be "disabled". A double click on a variable, <Ctrl>+<R> and the refactoring works.
Product Version: NetBeans IDE 6.9 RC2 (Build 201005312001)
Java: 1.6.0_20; Java HotSpot(TM) Client VM 16.3-b01
System: Windows XP version 5.1 running on x86; Cp1252; de_DE (nb)
instant rename(csl) and rename refactoring(refactoring) => two implementations the same shortcut Ctrl+R. PHP doesn't support refactoring yet, just instant rename. Pressing Ctrl+R invokes instant rename and it works, menu item Refactoring->Rename doesn't work whereas one would expect instant rename to be invoked also.
Please let me know, how should be fixed in php code.
Well, I'd quite like to see 'Rename in place' or some similarly named option added to the context menu (wasn't it there before?). I think it should be named sufficiently differently to Refactor->Rename so that it's obvious that the functions are different.
I also think that if refactoring isn't yet supported for PHP the Refactor context menu item should either be disabled or removed.
Ctrl-R doesn't work for me because I'm using jVi, which intercepts Ctrl-R as 'Redo'. Which function do I need to change the key mapping for to get the instant rename functionality?
Created attachment 100475 [details]
Replacing the refctoring submenu with the simple rename action
Radku, either use the attached patch, which simply replaces the "Refactor" submenu in the editor's popup menu with "Rename" action or implement RefactoringPlugin for rename, which will delegate to php's instant-rename.
In general, all refactorings are done through the refactoring actions implemented/provided by refactoring plugins for each particular language. The 'Instant Rename' action is a shortcut for renaming simple things such as local variables, etc. Languages may or may not support this shortcut (eg. it's handy for user to have this, but it may not be possible/easy to implement in some languages). If a language provides 'Instant Rename' the action is registered in the editor's keymap with the *same* shortcut as for the full rename refactoring. That is, if a user hits Ctrl+R in the editor and 'Instant Rename' is available (eg. implemented and applicable in the current context) the editor will perform 'Instant rename'. Otherwise the full rename refactoring will be used.
We intentionally do not want to distinguish these two operations. From the user point of view the rename is always the rename - and the IDE decides what version of it is the most appropriate in a given situation.
As for the shortcut, it can be customized in Tools-Options > Keymap, search for 'instant rename' or just 'rename'.
OK, if all is working well it makes sense to hide the fact that there a different implementations from the user: it's only in this situation that the difference becomes apparent.
As a site note: mapping Ctrl-Shift-R to "'Rename' - 'Refactoring'" causes the same error message to appear - I've had to map to "'Rename' - 'Other'" to get the desired functionality. If the intention is to hide the different implementations from the user then shouldn't there be just one function called 'Rename' in the function list?
Rename refactoring has been changed a lot so I'm not sure, if your problem is still valid in a current implementation. If it does, don't hesitate to reopen this issue and provide us fresh information about "what's bad". Thanks a lot.