Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 131668 - Renaming packages doesn't affect code in .form files
Renaming packages doesn't affect code in .form files
Product: guibuilder
Classification: Unclassified
Component: Code
All All
: P2 (vote)
: 6.x
Assigned To: issues@guibuilder
: 137880 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2008-03-31 22:44 UTC by ingof
Modified: 2008-07-11 16:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
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

*** This issue has been marked as a duplicate of 106831 ***
Comment 2 Tomas Pavek 2008-04-02 17:51:46 UTC
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.
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. ***

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