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