Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 187375 - PHP rename refactoring has been disabled
PHP rename refactoring has been disabled
Product: php
Classification: Unclassified
Component: Editor
PC Linux
: P3 with 1 vote (vote)
: 7.1
Assigned To: Ondrej Brejla
Depends on:
  Show dependency treegraph
Reported: 2010-06-09 09:17 UTC by rjt
Modified: 2011-09-26 14:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

Replacing the refctoring submenu with the simple rename action (1.20 KB, patch)
2010-06-29 07:40 UTC, Vitezslav Stejskal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rjt 2010-06-09 09:17:27 UTC
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!
Comment 1 xantiva 2010-06-12 20:43:58 UTC
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)
Comment 2 rmatous 2010-06-28 15:36:14 UTC
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.
Comment 3 rjt 2010-06-28 15:49:39 UTC
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?
Comment 4 Vitezslav Stejskal 2010-06-29 07:40:21 UTC
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.
Comment 5 Vitezslav Stejskal 2010-06-29 07:48:43 UTC
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'.
Comment 6 rjt 2010-06-29 09:40:11 UTC
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?
Comment 7 Filip Zamboj 2010-09-15 12:31:45 UTC
batch reassigning
Comment 8 Ondrej Brejla 2011-09-26 14:34:24 UTC
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.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo