Code generation

The Visual Editor for Java is a source centric editor that reads and writes the .java source file. This round tripping between the Visual Editor and the source is done incrementally so that as you make a change to a Java bean the source is changed, and likewise as you change the source the Java bean is changed.

When the Visual Editor for Java is closed the only file that is persisted in Eclipse is the .java file. There is no additional file that stores metadata so that changes can be made to the file in another editor, such as the Java Editor from VisualAge, and these will be reflected in the Visual Editor when it is next opened. When the Visual Editor for Java is opened to determine the initial state of the Java beans the file is parsed and analyzed for certain patterns. These are used to create a model of the Java beans and their initial property settings and any relationships between them. You can make modifications to the source and see these reflected in the Java beans' model as long as the source still adheres to the recognized patterns.

Incremental round tripping of source code changes

As you change the contents of the .java source file with the Java Visual Editor open, it performs incremental analysis of the changes to determine how the change affects the Java beans. These changes can be made in the source editor embedded within the Visual Editor, or within another editor open on the same file within Eclipse. When a change has occurred, it then synchronizes these changes with the model of the Java beans displayed in the Design view, the Java Beans view and the Properties view. If the change is limited to the contents of a single method's arguments, then the single property is updated in the model of the Java bean.

If the change is outside a method or within multiple methods, then the contents of the entire file are reparsed. This reparsing is done using background threads. So, you should not see any decrease in the performance of typing code into the Java source view. If a situation occurs where the model of the Java beans is out of step with the source code for any reason, then you can click the reload button, located in the bottom right corner of the status line.

Related concepts
Code synchronization
Source code patterns
Externalized strings
Style of generated source
Metadata and migrating from VisualAge for Java
Event handling

(C) Copyright IBM Corporation 2000, 2003. All Rights Reserved.