ContentViewer Exception

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

ContentViewer Exception

Postby brianonorio » Fri Nov 07, 2003 12:13 am

Whenever I add a JFace viewer, I get the following error:

org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: ContentViewer must have a content provider when input is set.
at org.eclipse.jface.util.Assert.isTrue(Assert.java:168)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:229)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:983)
at gui.GUI.main(GUI.java:149)
Exception in thread "main"

I think I may be missing a jar. For the record, I have swt, jface, runtime, and boot all in the build path. What could be causing this error?
brianonorio
 

Re: ContentViewer Exception

Postby Eric Clayberg » Fri Nov 07, 2003 5:14 am

brianonorio wrote:Whenever I add a JFace viewer, I get the following error:

org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: ContentViewer must have a content provider when input is set.
at org.eclipse.jface.util.Assert.isTrue(Assert.java:168)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:229)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:983)
at gui.GUI.main(GUI.java:149)
Exception in thread "main"

I think I may be missing a jar. For the record, I have swt, jface, runtime, and boot all in the build path. What could be causing this error?

Have you created a content provider for the viewer? The error appears to be cause by not having set a content provider for the viewer. If you haven't created one, this exception would be the expected result at runtime.
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 brianonorio » Fri Nov 07, 2003 9:01 pm

Can I do that with SWT Deisgner? If not, can you give me a pointer about what exactly the Content Provider is?
brianonorio
 

Postby Eric Clayberg » Sat Nov 08, 2003 5:44 am

brianonorio wrote:Can I do that with SWT Deisgner?

Yes. Double-click on the "contentProvider" field for the viewer to create a default implementation which you can then modify as necessary.

brianonorio wrote: If not, can you give me a pointer about what exactly the Content Provider is?

In order to use JFace viewers, you need to understand content providers, label providers, filters and sorters. Here are some relevant articles:

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: Google [Bot] and 1 guest