Refactoring is very difficult in these cases because I have to go back to the "Customize Code" window in the form's Design view and refactor there, where
there is only one narrow line of editor space and the code-completion dialog doesn't even work properly.
The refactoring feature should just handle renaming generated code.
reproducible with 6.8 M2
The guarded code is under control of the module which generated it. In this case it is the form module and its
refactoring plugin(s). Reassigning.
This is supposed to work (with exception of some unsupported cases).
So what exactly is not working for you? Can you attach a sample project or describe an exact example of refactoring
that does not work?
This bug was confirmed by the reassigner, so I don't see what the issue is. It never works. Any test case will show this. Variables or method calls inside the
form's generated initComponents() method never get renamed. Have you tried this and seen it working?
I've just created a new JFrame form, added a button to it and doubleclick it to create an event handler method. In
that method I typed code jButton1.setEnabled(false); Then I invoked Rename on jButton1 and changed it to "myButton"
and it was correctly renamed in the guarded code.
Another case: I created a JPanel form which I compiled and added to the JFrame form as a custom component. Then I
renamed the component class - and it was correctly updated in the JFrame form as well.
So yes, I've tried and seen it working ;).
However, there really can be cases that don't work, or some conditions that cause something is not working. That's why
I'm asking for an exact reproducible test case.
You've misunderstood the bug. Click on a component in Design view and open its Model property by clicking on the ... in the Properties window. On the
dialog that pops up, select Custom code from the pull-down menu. You now have one line of text to enter code for setting the model. Whatever you enter
here doesn't get refactored. This is important because I refactor a lot and I always have to go back to my components' models and update the code in the
dialog manually. Similarly if I've created some custom post-initialization code (either by right-clicking on the component and selecting Customize Code or by
going to the Code section of the Properties window).
This really needs to work because I spend more time refactoring than a simple search and replace would take.
Ok, so you set 'model' property via custom code and type some method call. That's the case not working for you (the
method call is not changed when you rename the method).
In the current state, the refatoring of user edited custom code is limited; only some changes are reflected - renames of
component fields used in the form, and changes in class names. Methods renames are not supported (yet).
A workaround for you could be to write the entire property setter in source editor, e.g. after initComponents() call in
constructor. Then refactoring will work fine for you.
*** This issue has been marked as a duplicate of 106831 ***