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 194349 - Renaming variable with "refactor" doesn't alter code within a GUI form
Summary: Renaming variable with "refactor" doesn't alter code within a GUI form
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: issues@guibuilder
Depends on:
Reported: 2011-01-14 14:19 UTC by aquaglow
Modified: 2011-11-07 15:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description aquaglow 2011-01-14 14:19:43 UTC
I use the "Post-Init code" etc. options of the Swing GUI designer when designing GUI's, to enable features not possible just with drag-and-drop.

However, I found when I renamed a variable within a POJO using "Ctrl+R" from:

public static final String tick = "\u2713";


public static final String TICK = "\u2713";

it didn't update the places I'd used the variable within the GUI's "Post-Init code" etc. I had to manually go through the places my project tree was showing errors, and update by hand.
Comment 1 MackSix 2011-11-04 16:28:29 UTC
This works ok for me in:

Product Version: NetBeans IDE Dev (Build 201111030600)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Comment 2 Jan Stola 2011-11-07 15:59:45 UTC
This issue is still valid.

> This works ok for me ...

It works when the renamed variable is in the form. It doesn't work when it is in another Java class.

The root of the problem seems to be in RefactoringPluginFactoryImpl.createInstance(). It ignores all renames of class elements outside form files - it performs explicit RefactoringInfo.isJavaFileOfForm(primaryFile) check.

This issue gets fixed when this check is commented out, but such a change also means much higher involvement of GUI Builder's refactoring plugin in rename refactorings. So, it is a risky change because it is not clear whether other parts of form.refactoring module can handle renames in non-form files correctly.

Hence, I am postponing this change to post-NB 7.1 builds.