Unable to modify generated code

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Unable to modify generated code

Postby Julien » Thu Jan 20, 2005 8:31 am

Hello,

My problem is the following:

I have a panel containing multiple components, including an other panel in CardLayout.
When I open this class in Designer, I get two errors for the two subpanels of the cardlayout:

Designer Internal Error: UNNAMED.MyFirstSubPanel
Designer Internal Error: UNNAMED.MySecondSubPanel
(though these two classes exist and are located in the same package)

Then, when I try to edit any component properties, I have also these errors, and an exception:

com.swtdesigner.properties.PropertyException: java.lang.NullPointerException
at com.swtdesigner.model.swing.component.ComponentBeanInfo.prepareControl(SourceFile:479)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(SourceFile:5566)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(SourceFile:5544)
at com.swtdesigner.model.JavaInfo.unlockNotify(SourceFile:5517)
......

I also have an "info" message containing most of my Java code.

This class compiles and works properly with no error.

I am using Window Builder Pro 3.0.0 build on 2004.12.22 for Eclipse 3.0.0
Julien
 

Re: Unable to modify generated code

Postby Eric Clayberg » Thu Jan 20, 2005 11:09 am

Julien wrote:Designer Internal Error: UNNAMED.MyFirstSubPanel
Designer Internal Error: UNNAMED.MySecondSubPanel
(though these two classes exist and are located in the same package)

Don't use the default package. In particular, don't place custom components in the default package.

Julien wrote:I am using Window Builder Pro 3.0.0 build on 2004.12.22 for Eclipse 3.0.0

Alternatively, you can use the latest v3.0.1 build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby Julien » Fri Jan 21, 2005 2:42 am

Moving it all to a dedicated package did not fix anything, bu I found the reason of the bug:

Window Builder does not like this declaration:

String[] myString = { "a", "b", }; // note the last comma
JComboBox cb = new JComboBox( myString );

Though this is OK for Eclipse and Java, window builder forces me to declare the array as

String[] myString = { "a", "b" };
Julien
 

Postby Eric Clayberg » Fri Jan 21, 2005 4:41 am

Julien wrote:Moving it all to a dedicated package did not fix anything, bu I found the reason of the bug:

Window Builder does not like this declaration:

String[] myString = { "a", "b", }; // note the last comma
JComboBox cb = new JComboBox( myString );

Though this is OK for Eclipse and Java, window builder forces me to declare the array as

String[] myString = { "a", "b" };

WB doesn't "force" you to do that. The only time WB would ever care about that would be if you had turned on the "Enable diagnostic checking" option. You should not turn that option on unless we tell you to do so for some specific support-related reason. That option flags any differences between the actual source and the source regenerated by the Eclipse parser. The Eclipse parser ignores extraneous characters (like your extra comma or an unnecessary semi-colon) so those are not regenerated. Diagnostic checking catches any malformed Java code (even if it is strictly legal).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby Julien » Fri Jan 21, 2005 5:30 am

Thanks for this answer. The option was unfortunately turned on on my system, and disabling it solved the problem.
Julien
 


Return to Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest