Data Binding with classes from Eclipse project build path

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

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

Data Binding with classes from Eclipse project build path

Postby StefanFromm » Mon Jan 14, 2008 12:41 am

I want to develop a SWT/JFace client which accesses a server via a web service. I'd like to reuse the data model classes from server. So I packed them into a JAR and included that JAR into the build path of the client Eclipse project. In a client-side dialog class I declared the field and getters/setters:

Code: Select all
public class AddressDetails extends TitleAreaDialog
{
  private Address _address;
  ...
}


The dialog contains text fields each of class org.eclipse.swt.widgets.Text. In the property bindings.text of each text field I click the "..."-button, but the address field does not appear in the list of available beans. Only when I implement an Address class in the same Eclipse project and assign this new class as the type, the address field appears. What's the reason? Are there any other workarounds?

I am working with Eclipse 3.3.1.1 (Build M20071023-1652) and SWT Designer Eclipse plugin 6.5.1.
StefanFromm
 
Posts: 4
Joined: Mon Jan 14, 2008 12:02 am

Re: Data Binding with classes from Eclipse project build path

Postby Eric Clayberg » Mon Jan 14, 2008 11:34 am

Sounds like a classpath problem.

When we tried this, it worked fine, so we will need to see a test case and yoru complete Eclipse ".log" file.
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

Re: Data Binding with classes from Eclipse project build path

Postby StefanFromm » Mon Jan 14, 2008 10:35 pm

I sent an email to the wb-support mail address. The files were too large (10MB) to attach them to this forum.

BTW: I'm using Java JDK 1.6.0_03.
StefanFromm
 
Posts: 4
Joined: Mon Jan 14, 2008 12:02 am

Re: Data Binding with classes from Eclipse project build path

Postby Eric Clayberg » Wed Jan 16, 2008 2:49 pm

StefanFromm wrote:I sent an email to the wb-support mail address. The files were too large (10MB) to attach them to this forum.

Please send a small, self-contained example that illustrates the problem.

The projects you sent were far too large to make any sense of and would not compile due to hard coded classpath dependencies from our own system.
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

Re: Data Binding with classes from Eclipse project build path

Postby StefanFromm » Tue Jan 22, 2008 4:11 am

Sorry for the huge email. So once again.

In the attachment now there is a small Eclipse project defining the build path via ECLIPSE_HOME variable. In my last try I only used the wizard to create a new SWT/JFace Java project. This wizard initializes the classpath with absolute references to JAR archives. This time I manually changed all generated dependencies to variable based dependencies, after the wizard had run.

Inside the Eclipse project there is a lib subdirectory, where the Address class is contained in a JAR. This JAR is part of the build path, too.

When closing and opening the Eclipse project, the classpath error occurs in the Eclipse log file. It is also contained in the attached file.
Attachments
classpath-test.zip
Eclipse log file and JFace project with application window
(9.22 KiB) Downloaded 97 times
StefanFromm
 
Posts: 4
Joined: Mon Jan 14, 2008 12:02 am

Re: Data Binding with classes from Eclipse project build path

Postby Eric Clayberg » Tue Jan 22, 2008 6:55 am

We tried your test case on multiple machines on our end and it worked fine...

Image

In fact, the only problem we saw is that your Address class uses protected accessors which prevents Designer from seeing those properties. Converting them to public accessors makes all of the properties show up...

Image

Since you are seeing a local ClassNotFoundException issue, I would look at other possible causes for that such as JDK mismatch between Eclipse itself and JDK used to compile your jar. For example, if your jar was compiled with JDK 1.5 and you are running Eclipse using JDK 1.4, Eclipse won't be able to load the class files from that jar (which can masquerade as a ClassNotFoundException problem).
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

Re: Data Binding with classes from Eclipse project build path

Postby StefanFromm » Tue Jan 22, 2008 11:17 pm

I had the jar compiled for JDK 1.6, but Eclipse was running with JDK 1.5.

I validated two changes from this starting point:
  • Changing the jar version to 1.5 in an Eclipse VM 1.5 environment made it working.
  • Changing the Eclipse VM version to 1.6 keeping the jar VM version at 1.6 made it also working
Thank you very much for your quick and helpful answers!
StefanFromm
 
Posts: 4
Joined: Mon Jan 14, 2008 12:02 am

Re: Data Binding with classes from Eclipse project build path

Postby Eric Clayberg » Wed Jan 23, 2008 3:44 am

That is good news. I was hoping that was the issue as I was out of any other ideas. ;-)
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


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests