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.
Hi, I can have some custom creation code for some component on a frame. For example: class MyPanel extends JPanel { MyParamClass param1; MyPanel() { param1 = new MyParamClass(); initComponents(); } private void initComponents() { MyLabel lab1 = new MyLabel(param1); } } Here "param1" value inside "MyLabel lab1 = new MyLabel(param1);" construction is set as custom creation code for the lab1 component in the UI Designer view. If I refactor param1 field, changing its name to param21 for example, the non-editable initialization code inside initComponents() method will not change - the new "MyLabel(param1)" call would remain the same and I will receive compilation error here (as "MyParamClass param1;" declaration is now changed to "MyParamClass param2;") - I have to open UI Designer and change custom creation code there manually to fix this. Also to continue this issue with non-editable area and custom UI creation code - it is not very comfortable to edit custom creation code inside UI Designer - by opening modal dialog for each code part for each ui element. I think this could be done inside source code editor without switching off the non-editable state of the whole initComponents() method. The initComponent() method section could be non-editable in the whole, but would have active areas (highlighted by another color), by clicking on which the custom code editor dialog would pop up for the selected section. For the above example, the line below line: MyLabel lab1 = new MyLabel(param1); would be splitted to sections: non-editable: "MyLabel lab1 = new MyLabel(" highlighted area: "param1" non-editable: ");" By clicking on "param1" section the described dialog would popup and would allow to change the "param1" to any other text ("param21" for example like in case with refactoring).
The refactoring of guarded sections inside form files is handled by the form module. Reassigning.
*** This issue has been marked as a duplicate of 106831 ***
Not all refactorings work in the custom code in guarded blocks, but such a simple renaming should work. I've just tried the described case in current 6.5 dev build and it works for me - the custom creation is updated to the new field name properly. This could have been fixed after 6.1. As for the editing inside initComponents - yes, it would be nice, but it would be quite complicated to implement. The main problem is that we don't really know how the code maps back to the GUI elements and attributes - to interpret what to do when you click somewhere in the code. If we knew this, we would be quite close to full 2-way editing. Note that you don't have to "open modal dialog for each code part for each ui element". There is "Customize Code" action in context menu opening a dialog where you can edit all custom code for selected component and can select other components without leaving the dialog.