Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 174314 - Refactor doesn't refactor GUI-builder's generated code
Refactor doesn't refactor GUI-builder's generated code
Status: RESOLVED DUPLICATE of bug 106831
Product: guibuilder
Classification: Unclassified
Component: Code
6.x
Macintosh Mac OS X
: P3 (vote)
: TBD
Assigned To: issues@guibuilder
issues@guibuilder
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-11 20:00 UTC by vbeffa
Modified: 2009-10-13 12:05 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vbeffa 2009-10-11 20:00:03 UTC
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.
Comment 1 Ivan Sidorkin 2009-10-11 20:14:47 UTC
reproducible with 6.8 M2
Comment 2 Jan Pokorsky 2009-10-12 11:03:27 UTC
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.
Comment 3 Tomas Pavek 2009-10-12 15:05:33 UTC
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?
Comment 4 vbeffa 2009-10-12 15:25:00 UTC
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?
Comment 5 Tomas Pavek 2009-10-12 15:50:28 UTC
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.

See also:
http://wiki.netbeans.org/GUIBuilderRefactoring
Comment 6 vbeffa 2009-10-12 17:01:42 UTC
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.
Comment 7 Tomas Pavek 2009-10-13 12:05:12 UTC
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 ***


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