Re: [Xswt-developer] XSWT Embedding error
Brought to you by:
dvorme
|
From: Olivier P. <ml....@fr...> - 2006-10-20 20:21:21
|
David,
Thank to your detailed walk through, I've been able to fix my problem=
.
I was hinted by the difference in API: you are using the=20
XSWT.create(flux).parse(shell) call, while I was using the=20
XSWT.create(shell, flux) one.
It turned out that I did not use the plugin xswt.jar archive, but=
=20
another jar I probably downloaded somewhere on sourceforge. Using the=
=20
plugin jar lead to the calling convention change and to a working pie=
ce=20
of code. Did I use an old jar using an obsolete xswt syntax or someth=
ing=20
similar?
Thanks anyway for your involvement.
Regards,
Olivier Parisy.
David J. Orme a =C3=A9crit :
> Apologies for the delay at getting back to you. I forgot I was goi=
ng=20
> to be out of town for the weekend. :-( But I've had a chance to tr=
y=20
> your example. My results follow:
>
> I created a new Plug-in project, added XSWT and SWT as dependencies=
,=20
> created a "com.cps.test" package, and copied XSWTTest from the=20
> com.swtworkbench.community.xswt.examples.newsyntax package of the X=
SWT=20
> plugin into the new project. For reference, this is the code I cop=
ied=20
> into the project:
>
> public class XSWTTest {
>
> public static void main(String[] args) throws IOException {
> Display display =3D new Display();
> Shell shell =3D new Shell(display);
> Map results =3D null;
>
> try {
> results =3D=20
> XSWT.create(XSWTTest.class.getResourceAsStream("Test.xswt"))
> .parse(shell);
> } catch (XSWTException e) {
> Logger.log().error(e, "Unable to parse XSWT file");
> }
>
> shell.setSize(600, 600);
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
> }
>
> I created an XSWT file named Test.xswt with your XSWT code right ne=
xt=20
> to the XSWTTest.java class. Then I right-clicked XSWTTest.java, ch=
ose=20
> "Run as > SWT Application" from the menu, and it worked fine.
>
> Hopefully, this is enough to get you running again too.
>
> You can do it using a regular Java project too, but then you have t=
o=20
> manually add the SWT libraries to the classpath, and so on.
>
> Please let me know if you can't get it going and I'll try to help.
>
>
> Best regards,
>
> Dave Orme
|