When using the refactor action "rename" the refactoring doesn't seem to affect code entered in
the Swing GUI builder under the "code" tab.
While the source file is refactored the code entered in the pop up dialog and stored in the corresponding .form file
isn' refactored. This means that at the moment something other (such as a button text) is changed in the GUI editor the
changes made in the source file by the refactoring are reverted. The source file is then broken and can only be fixed by
changing the code manually via the dialog or editing the .form file outside Netbeans.
Steps to reproduce:
-Create a package "foo"
-Create a class "Bar" in that package with a method "public void test()" or whatever
-Create a package "playground"
-Create a new JFrame Form in that package
-In the "design" view of the GUI editor drag a new button onto the form
-Select the button and go the the code tab of the properties view
-Click on the "..." button of "Post-Creation Code" to bring up the dialog
-In the dialog enter "new foo.Bar().test();
-In the project Navigator select the "foo" package and chose "Refactor..Rename" from the context menu
-Now go back to the GUI Editor and change the label of the button
The code is now broken since it was regenerated from the .form file and refactoring didn't touch it.
The refactoring works fine when changing a class name, though....
This is one of unsupported use-cases in the current implementation of refactoring. Refactoring of embedded user-code is
only partially supported by now. See http://wiki.netbeans.org/GUIBuilderRefactoring
*** This issue has been marked as a duplicate of 106831 ***
Found a way to fix this easily. The package rename was not processed in the .form file if the affected form was not in
the renamed package.
verified in dev build 200804060002
Product Version: NetBeans IDE Dev (Build 200804060002)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
*** Issue 137880 has been marked as a duplicate of this issue. ***