Issue creating sample application (SWT Designer 7.0)

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

Issue creating sample application (SWT Designer 7.0)

Postby ksklein » Fri May 01, 2009 2:32 pm

Having just moved up to 7.0 I tried to create a basic sample project and application window

when i open designer mode and drop a label on the composite it gives me a parse error and the control doesn't "stick" to it position (form layout):

Parse Error:
com.instantiations.designer.core.utils.ast.ASTParser$ParseException: Null pointer access: The variable formData can only be null at this location Source: |formData|

Full source:
Code: Select all
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormData;
class SampleApp extends java.lang.Object {
org.eclipse.swt.widgets.Shell shell=(org.eclipse.swt.widgets.Shell) null;
org.eclipse.swt.widgets.Label label=(org.eclipse.swt.widgets.Label) null;
public static void main(java.lang.String[] p_0) {}
public void open() {}
public void createContents() {}
SampleApp(Object __wbp_param) {
    super();
    org.eclipse.swt.layout.FormData formData = (org.eclipse.swt.layout.FormData) null;
    formData.left = new org.eclipse.swt.layout.FormAttachment(0, 0);
}
}


If I reparse it will do that fine but the label is now not where I placed it, it jumps to the top left corner

Code generated:
Code: Select all
        this.label = new Label(this.shell, SWT.NONE);
        formData.left = new org.eclipse.swt.layout.FormAttachment(0, 0);
        this.label.setLayoutData(new FormData());
        this.label.setText("New Label");


which obviously isn't right -- it hasn't instantiate the formData variable, and to top it all of it doesn't even use it when setting the layout data.

Now if I fix the code how I want it to layout it will display in design mode properly:

Code: Select all
        this.label = new Label( this.shell, SWT.NONE );
        FormData formData = new FormData();
        formData.left = new FormAttachment( 0, 5 );
        formData.top = new FormAttachment( 0, 5 );
        this.label.setLayoutData( formData );
        this.label.setText( "New Label" );


But if I try to move the label (say to the top right corner) I get another parse exception (same one as before) and the code turned into this:
Code: Select all
        this.label = new Label( this.shell, SWT.NONE );
        FormData formData = new FormData();
        formData.right = new org.eclipse.swt.layout.FormAttachment(0, 0);
        formData.left = new FormAttachment( 0, 5 );
        formData.top = new FormAttachment( 0, 5 );
        this.label.setLayoutData( formData );
        this.label.setText( "New Label" );


thought this might be version issue with plugins, etc but (at least according to eclipse update) i am all good

== Support Details ==
Product: SWT Designer Professional
Version: 7.0.0.200904302323
Expected: Eclipse 3.4
Actual: Eclipse 3.4.0.v20080512
Actual Eclipse Build Name:
Actual Eclipse Build ID: M20090211-1700
IDE Actual Name: Eclipse
IDE Actual Version: 3.3.101.v200902111700
IDE Actual NL: en_US
Serial Number: XXXXXXXXXXXXXXXXXX
Activation Key: XXXXXXXXXXXXXXXXXXXX
Physical Address: 00-60-73-E0-AB-2E, HardwareAddress[00-30-1B-B8-ED-BA], HardwareAddress[02-60-73-E0-AB-2E]
Platform Product: Eclipse
Platform Version: 3.3.101.v200902111700
OS Name: Windows XP
OS Architecture: x86
OS Version: 5.1
ksklein
 
Posts: 4
Joined: Mon Sep 22, 2008 7:19 am

Re: Issue creating sample application (SWT Designer 7.0)

Postby Eric Clayberg » Fri May 01, 2009 4:15 pm

Do you have the Compiler "null pointer access" check set to error rather than warning?

Please try it again using the very latest SWT Designer v7.0 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

Re: Issue creating sample application (SWT Designer 7.0)

Postby ksklein » Mon May 04, 2009 7:30 am

yes I do. or rather did, since that seemed to do the trick.

is that something you guys are working on resolving? because I would like to be able to turn that back on for my projects.
ksklein
 
Posts: 4
Joined: Mon Sep 22, 2008 7:19 am

Re: Issue creating sample application (SWT Designer 7.0)

Postby Eric Clayberg » Mon May 04, 2009 9:08 am

ksklein wrote:yes I do. or rather did, since that seemed to do the trick.
is that something you guys are working on resolving? because I would like to be able to turn that back on for my projects.

It was already resolved last Friday (which was why I suggested using the latest SWT Designer 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

Re: Issue creating sample application (SWT Designer 7.0)

Postby ksklein » Tue May 05, 2009 9:37 am

Got it. It's working now. Thanks for the help.
ksklein
 
Posts: 4
Joined: Mon Sep 22, 2008 7:19 am

Re: Issue creating sample application (SWT Designer 7.0)

Postby Eric Clayberg » Wed May 06, 2009 6:46 pm

Glad its working for you.
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