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 131668

Summary: Renaming packages doesn't affect code in .form files
Product: guibuilder Reporter: ingof <ingof>
Component: CodeAssignee: issues@guibuilder <issues>
Status: VERIFIED FIXED    
Severity: blocker    
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description ingof 2008-03-31 22:44:29 UTC
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....
Comment 1 Jan Stola 2008-04-01 13:31:02 UTC
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 ***
Comment 2 Tomas Pavek 2008-04-02 17:51:46 UTC
Reopening...
Comment 3 Tomas Pavek 2008-04-02 17:53:17 UTC
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.

http://hg.netbeans.org/main/rev/1fe49081055a
Comment 4 kate 2008-04-08 10:07:54 UTC
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)
Comment 5 Tomas Pavek 2008-07-11 16:25:02 UTC
*** Issue 137880 has been marked as a duplicate of this issue. ***