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 167026 - Automatic Data Generated by Form Utility Does Not Follow Package refractoring
Summary: Automatic Data Generated by Form Utility Does Not Follow Package refractoring
Status: RESOLVED WORKSFORME
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-13 04:18 UTC by jiminitaur
Modified: 2009-10-06 16:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
I copied the text out of the code editor before I deleted the file (11.22 KB, text/plain)
2009-06-13 04:20 UTC, jiminitaur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jiminitaur 2009-06-13 04:18:36 UTC
I reinstalled netbeans and ported in my old projects.

One of the class files in the projects was a JFrame that I had built using Matisse.  Within the JFrame were classes
which extended JComboBox and JPanel.  Both of these classes were stored in a package called FD (for field data).  The
JFrame class was in another package.

I refractored the name of FD to FieldData, and all the the FieldData components still work together, however, the JFrame
class would not compile (and halted compile on the whole project) because the package name in the section that says:

// Variables declaration - do not modify

still said FD

Since I cannot edit this section manually, I had to try and delete the components and reinsert them from their newly
named package.  This didn't work.  When I did this however, I got a red error icon next to the following section.

    private FieldData.Components.ComboBox.FD_ComboBox fD_ComboBox1;
    private FieldData.Components.Table.FD_SaveTable fD_SaveTable1;
    private FieldData.Components.Table.FD_SaveTable fD_SaveTable2;

The tooltip for the error told me that the package FieldData.Component didn't exist which I know was baloney because I
just dropped a file into the GUI editor from it.

I tried deleting all three imports and retyping them and the red icon changed to a yellow fixit suggestion icon.

My only options were to create new Fields and Methods in FieldData.Main with components.

I wish I could supply more useful info, but I already deleted the file out of frustration and need to move on.  I think
its clear though, that automatic code portions from the GUI editor need to be refractored properly.  Since this made my
file unusable and led it not recognize classes in the same project for import, I filed it as P1.

As a side note, I tried rebooting my computer and the IDE, and neither course of action fixed the situation.
Comment 1 jiminitaur 2009-06-13 04:20:16 UTC
Created attachment 83530 [details]
I copied the text out of the code editor before I deleted the file
Comment 2 Marian Mirilovic 2009-06-13 21:09:11 UTC
Tried in NB 6.7 RC3, JDK6u14 and cannot reproduce:
- run IDE with new userdir
- created J2SE Project
- created package FD
- created new "Bean Form" - extend javax.swing.JComboBox -> name MyComboBox
- compile this file
- created new JFrame in another package
- added MyComboBox into JFrame in design mode
- refactored FD packge to FieldData
- tried to open JFrame in design mode
-> design Error dialog risen ... so compiled MyComboBox once again
-> everything works as expected (honestly there are some problems in design mode - see issue 167044 .. but code itself
is correct)
Comment 3 Tomas Pavek 2009-06-16 10:45:54 UTC
So you had originally in the JFrame components named:
    private FD.Components.ComboBox.FD_ComboBox fD_ComboBox1;
    private FD.Components.Table.FD_SaveTable fD_SaveTable1;
    private FD.Components.Table.FD_SaveTable fD_SaveTable2;

and then renamed FD folder to FieldData. That did not change the decalred fields in the code, so you deleted the 
components in the GUI builder and added them again? I don't understand what the mentioned FieldData.Main was...

So what exactly was package structure in this setup - is FieldData.Components.ComboBox a package and FD_ComboBox the 
java class? So the rename you made was actually not a rename of package but rename of a parent dir of several packages?
Comment 4 jiminitaur 2009-06-17 17:18:56 UTC
tpavek-

Package Structure:

Yes, FieldData.Components.ComboBox is the package and FD_ComboBox is the class.  The same scheme applies for
FD_SaveTable.  I'm not an expert on how the pacakage structure works, but I assumed that FieldData qualified as a
package in its own right and Components and Main were technically 'sub-packages' or something along that line.  Either
way, I renamed the parent of several packages (which worked fine everywhere except for the matisse form in question).

I should have explained about FieldData.Main to before.  FieldData.Main.FieldData is the data class, that the components
in FieldData.Components.* are designed to work with.  

I didn't take a screenshot of the fixit suggestions so I wrote that part of the error to the best of my recollection.

In retrospect, I'm sure it asked me if I wanted to create a new class "Components" in FieldData.Main, however, there
were two options, both of which were not correct, and I can remember what the other one was.

mmrilovic-

I'm using 6.5 with latest updates, so maybe its just a problem with my build.  Although, something I noticed in your
process is that you created a Bean Form, and I just created a java class file and extended JComboBox and JPanel
(FD_SaveTable is actually a panel that configures a table inside of it, and allows saving to a file with a method call).
 I added the extended class file to the pallet then dropped it onto the form from the pallet.  I don't know much about
beans, so I don't know if that makes a difference, but I'm thinking maybe there's a difference in the template that
would account for why one works and the other doesn't.  I'm not at a workstation where I can check it out, but I will later.
Comment 5 Tomas Pavek 2009-06-17 18:10:59 UTC
Thanks for info.

We should check if GUI builder reacts properly on root folder rename (it's different than package rename). That might 
be the problem. It also might work now and not in 6.5 since there were some related fixes in 6.7.
Comment 6 Tomas Pavek 2009-06-22 17:42:30 UTC
I've just tried this with 6.7. Created 2 packages: com.my.components and com.my.forms. In components package I created a
JPanel component which I added to a JFrame form created in forms packages. Then in Files view I renamed 'com' to 'org' -
and this worked correctly (i.e. changes in both packages were reflected). I tend to think this was fixed during 6.7
development.

Would be great if you could verify it works in current 6.7 for you, or describe a step by step scenario that does not
work in 6.7.
Comment 7 Tomas Pavek 2009-10-06 16:05:03 UTC
No more info provided, it looks like working now (likely fixed since 6.5). Please let us know if you see the problem
again - preferentially in a latest release or milestone build.