JFace Viewers in Foms

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

JFace Viewers in Foms

Postby dfayerma » Fri Jan 21, 2005 5:31 am

I'm having problems using JFace Viewers with Forms.

I first create my Table control using the
toolkit and then create a checkbox table viewer passing the table in the constructor.
The Designer does not understand this concept.

If I comment the creation of the Viewer, the form is displayed successfully in the design view. As soon as I uncomment the creation of the viewer, the Parsing error is displayed.
I tried 3.00 and 3.0.1 versions with the same result.

In general, even if it works, it does not seem right that I have to create the viewer manually in code to use the toolkit table creation.

Here is the source code snipet:
table = toolkit.createTable(client, SWT.HIDE_SELECTION | SWT.CHECK);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.addControlListener(new TableControlListener());

final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setResizable(false);
tableColumn.setWidth(-1);
tableColumn.setText("Questions");

// Table viewer
//tableViewer = new CheckboxTableViewer(table);

The error stack trace:
!STACK 0
java.lang.ClassCastException
at com.swtdesigner.model.swt.jface.viewer.CheckboxTableViewerInfo.acceptAsParent(SourceFile:32)
at com.swtdesigner.model.parser.JavaInfoParser.isParentAndChild(SourceFile:792)
at com.swtdesigner.model.parser.JavaInfoParser.findParentFor(SourceFile:710)
at com.swtdesigner.model.parser.JavaInfoParser.getRootNodes(SourceFile:321)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(SourceFile:726)
....
dfayerma
 
Posts: 30
Joined: Mon Sep 20, 2004 10:51 am
Location: Boston, USA

Re: JFace Viewers in Foms

Postby Eric Clayberg » Fri Jan 21, 2005 6:28 am

dfayerma wrote:I first create my Table control using the toolkit and then create a checkbox table viewer passing the table in the constructor. The Designer does not understand this concept.

That's right. Designer has never supported adapting a viewer to an existing table.

If you want to create a CheckboxTableViewer, you should use the entry from the JFace Viewers palette (which is still available when editing an Eclipse Form).

Turn the border style off for the viewer and the border will then be drawn by the toolkit.
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 dfayerma » Fri Jan 21, 2005 6:50 am

Designer has never supported adapting a viewer to an existing table


Eric,
Before it did not allow to adapt viewer to the table through the designer but it did not break if it is done manually in the code.

I understand that I can adapt an object to the toolkit as a work around the designer limitations but I don't think it is a good programming practice.

Currently toolkit just removes the border, but going forward there may be other customizations that are done in the toolkit (like making headers flat etc.).
Are you planning to fix the parser to at least understand the viewers adapted to existing widgets?[/quote]
dfayerma
 
Posts: 30
Joined: Mon Sep 20, 2004 10:51 am
Location: Boston, USA

Postby Eric Clayberg » Fri Jan 21, 2005 7:26 pm

dfayerma wrote:Are you planning to fix the parser to at least understand the viewers adapted to existing widgets?

Try the latest v3.0.1 build (2005.01.21). Your example code will now work as you have written it.
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 dfayerma » Sat Jan 22, 2005 3:07 am

Thanks a lot.
The example is now parsed successfully but it looks like a corrupted jar problem again:
Clicking on any component in the designer causes an error.

java.lang.VerifyError: (class: com/swtdesigner/model/properties/EventsProperty, method: ensureHandlerAndOpen signature: (Lcom/swtdesigner/model/properties/beans/EventSetDescriptor;Lcom/swtdesigner/model/properties/beans/MethodDescriptor;)V) Stack size too large
at com.swtdesigner.model.swt.forms.control.FormsExpandableCompositeInfo.createEventsProperty(SourceFile:113)
at com.swtdesigner.model.swt.widgets.control.ControlInfo.getPropertyList(SourceFile:119)
at com.swtdesigner.model.swt.widgets.composite.AbstractCompositeInfo.getPropertyList(SourceFile:58)
at com.swtdesigner.model.swt.widgets.composite.CompositeInfo.getPropertyList(SourceFile:32)
at com.swtdesigner.model.swt.forms.control.FormsExpandableCompositeInfo.getPropertyList(SourceFile:117)
at com.swtdesigner.model.swt.forms.control.FormsSectionInfo.getPropertyList(SourceFile:88)
at com.swtdesigner.model.JavaInfo.getProperties(SourceFile:974)
at com.swtdesigner.model.JavaInfo.getNonEventProperties(SourceFile:1012)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.showJavaInfoInPropertyTable(SourceFile:660)
dfayerma
 
Posts: 30
Joined: Mon Sep 20, 2004 10:51 am
Location: Boston, USA

Postby Eric Clayberg » Sat Jan 22, 2005 6:12 am

dfayerma wrote:The example is now parsed successfully but it looks like a corrupted jar problem again

Yes. Try it again now.
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 1 guest