facebook

.form file not linked to .java file (no code generation)

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #263049 Reply

    tdonahue
    Member

    This problem is very similar to http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-14415.html

    Changes made in the ‘Designer’ view do not get reflected in the corresponding .java file.

    Yes, the .java and .form files are in the same package with the same name (I made sure by changing the name of the .java file and then opening the .form file; this gives the error ‘no java file associated…’).

    The preview button shows the changes correctly.

    Creating, deleting, renaming, moving components in the ‘Designer’ view and then saving cause no changes to be made to the .java file. Said another way, the .java file is not being touched.

    As an aside, before upgrading to 5.1, I needed to start eclipse with the 1.5 jvm. This resulted in a cmd window being displayed while Eclipse was running. Every now and then, an error was thrown to the cmd window output saying something about ‘guarded section, the code cannot be regenerated.’ I tried to find the same the error message by checking the .metadata/log as well as the PDE error log view (they are one and the same i believe) or starting Eclipse with a .bat file. I haven’t been able to reproduce the error message in 5.1. My guess is that this problem is related to this kind of error?

    Previously, the only way to get around this guarded code error was to revert to a stable state of the .form/.java file. Sometimes this meant starting from scratch…

    Also, other .form/.java pairs in my workspace function correctly, I am only having a problem with a particular one.

    System info:
    I used the full stack install.
    I am compiling my project with 1.6 RC1

    
    *** Date: 
    Tuesday, December 5, 2006 11:57:26 AM EST
    
    ** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_08
    
    
    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 5.1.0 GA
    Build id: 20061111-5.1.0-GA
    
    
    *** Eclipse details:
    MyEclipse Enterprise Workbench
    
    Version: 5.1.0 GA
    Build id: 20061111-5.1.0-GA
    
    
    
    
    Eclipse Graphical Editing Framework
    
    Version: 3.2.1.v20060921
    Build id: 20060921-1617
    
    
    Eclipse Plug-in Development Environment
    
    Version: 3.2.1.r321_v20060823-6vYLLdQ3Nk8DrFG
    Build id: M20060921-0945
    
    
    Eclipse Platform
    
    Version: 3.2.1.r321_v20060921-b_XVA-INSQSyMtx
    Build id: M20060921-0945
    
    
    Eclipse RCP
    
    Version: 3.2.1.r321_v20060801-2ekW2BxmcpPUOoq
    Build id: M20060921-0945
    
    
    Eclipse Java Development Tools
    
    Version: 3.2.1.r321_v20060905-R4CM1Znkvre9wC-
    Build id: M20060921-0945
    
    
    Eclipse Project SDK
    
    Version: 3.2.1.r321_v20060801-tQ1w49KnTArT0FZ
    Build id: M20060921-0945
    
    
    
    
    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\Program Files\MyEclipse Enterprise Workbench 5.1.0 GA\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    8f0_788
    -vm
    C:\Program Files\MyEclipse Enterprise Workbench 5.1.0 GA\jre\bin\javaw.exe
    

    Thanks

    #263121 Reply

    Riyad Kalla
    Member

    I needed to start eclipse with the 1.5 jvm. This resulted in a cmd window being displayed while Eclipse was running.

    Just for future reference you can get around this by using the “javaw” executable instead of the “java” executable, it won’t show a console.

    Every now and then, an error was thrown to the cmd window output saying something about ‘guarded section, the code cannot be regenerated.’

    Yes this is exactly what is going on. The designer uses markers to indicate to itself where difference parts of the file are generated and can be regenerated every time you save. If the format of these markers or expected position changes, it gets confused and dies.

    I just helped a gentleman with this and repaired his file for him. If you’d like to send me a small Java project with your file and form in it, I’d be happy to try and repair it for you. For future reference, what I do is create a new form of the same type, and add a few of the same constructs in it that the original form has (like 1 listener and maybe something else), then using the new working form as a guide, I go through the old form’s .java file and make sure the GEN-BEGIN/GEN-START and GEN-FINISH/GEN-END markers are all in the right place, like above a method, inside a bracket, etc. Sometimes it can be the littlest thing.

    Then after you get it working, change the form in some way then save it, if it’s working, it will re-gen all the generated Java code for you. IF it doesn’t re-gen, then there is still something wrong.

    We are working on improving this situation to not be so trial-and-error. Sorry for that headache.

    #263153 Reply

    tdonahue
    Member

    Well I feel very silly,

    //GEN-END:variables

    had migrated to the front of the .java file (perhaps a code-monkey copy/paste error…). I am very relieved that the entire file wasn’t hosed.

    Thanks for your help and the javaw tip.

    We are working on improving this situation to not be so trial-and-error. Sorry for that headache.

    Might I recommend a stronger mechanism than sticking //GEN-BEGIN tags in the code? While Netbeans doesn’t allow you to modify the generated code (I wonder if you can modify the //GEN tags, or maybe they stick them after the //editor fold tags), in an Eclipse world copy/pastes and ctrl+shift+F can lead to a Very Bad State in a Matisse generated class.

    I would also recommend a note somewhere (in this forum, in releases notes, in Matisse class comments) to let developers know that the code generation is dependent on the placement of the //GEN tags. While it seems like Common Sense 101 now, I would have never guessed that is the problem before.

    Thanks again,
    Tyler

    #263158 Reply

    Riyad Kalla
    Member

    Tyler,
    All your suggestions are spot on with what we are working on at the moment. I’m going to be adding some notes to the FAQ, and our M4M guys are going to be enhancing/adding validators to point out problems based on the markers to hopefully avoid this “what the hell is going on?” moment in the future.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: .form file not linked to .java file (no code generation)

You must be logged in to post in the forum log in