Re: [Xswt-developer] XSWT Embedding error
Brought to you by:
dvorme
|
From: David J. O. <dj...@co...> - 2006-10-16 02:08:55
|
Apologies for the delay at getting back to you. I forgot I was going to be out of town for the weekend. :-( But I've had a chance to try your example. My results follow:
I created a new Plug-in project, added XSWT and SWT as dependencies, created a "com.cps.test" package, and copied XSWTTest from the com.swtworkbench.community.xswt.examples.newsyntax package of the XSWT plugin into the new project. For reference, this is the code I copied into the project:
public class XSWTTest {
public static void main(String[] args) throws IOException {
Display display = new Display();
Shell shell = new Shell(display);
Map results = null;
try {
results = 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 next to the XSWTTest.java class. Then I right-clicked XSWTTest.java, chose "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 to 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
----- Original Message -----
From: Olivier Parisy <ml....@fr...>
To: xsw...@li...
Sent: Monday, October 9, 2006 4:07:01 PM GMT-0600
Subject: [Xswt-developer] XSWT Embedding error
Hi,
I successfully designed a small xswt layout using the XSWT preview plugin:
<?xml version="1.0" encoding="UTF-8"?>
<xswt xmlns:x="http://sweet_swt.sf.net/xswt">
<import xmlns="http://sweet_swt.sf.net/xswt">
<package name="java.lang"/>
<package name="org.eclipse.swt.widgets"/>
<package name="org.eclipse.swt.layout"/>
<package name="org.eclipse.swt.graphics"/>
</import>
<layout x:class="gridLayout" marginHeight="0" marginWidth="0"
numColumns="1"/>
<x:children>
<composite>
<layoutData x:class="gridData"
grabExcessHorizontalSpace="true" grabExcessVerticalSpace="true"
horizontalAlignment="GridData.FILL" verticalAlignment="GridData.FILL"/>
<layout x:class="formLayout" marginHeight="0"
marginWidth="0"/>
<label text="Link Entry Editor" x:id="title">
<layoutData x:class="formData">
<top x:p0="0" offset="5"/>
<left x:p0="0" offset="5"/>
</layoutData>
</label>
<!-- (...) -->
</composite>
</x:children>
</xswt>
I am now trying to embed it in an java program, but at execution time, I
get the following error:
com.swtworkbench.community.xswt.XSWTException: Property/method/field not
found: label
Row:14, Column:59
at
com.swtworkbench.community.xswt.XSWT.processNodeProperty(XSWT.java:1125)
at com.swtworkbench.community.xswt.XSWT.processSubNodes(XSWT.java:1040)
at com.swtworkbench.community.xswt.XSWT.processChild(XSWT.java:727)
at
com.swtworkbench.community.xswt.XSWT.processChildControls(XSWT.java:681)
at com.swtworkbench.community.xswt.XSWT.processXSWTNode(XSWT.java:655)
at
com.swtworkbench.community.xswt.XSWT.processTopLevelElement(XSWT.java:627)
at com.swtworkbench.community.xswt.XSWT.parse(XSWT.java:378)
at com.swtworkbench.community.xswt.XSWT.create(XSWT.java:254)
at tray.LinkWindow2.<init>(LinkWindow2.java:21)
As I understand it, this mean the <label> tag has not been recognized as
an SWT widget, and is hence considered ad either a property, method or
field of <composite>. Which of course it is not.
Any hint?
My invokation code is:
InputStream flux =
getClass().getResourceAsStream("/forms/linkeditor2.xswt");
results = XSWT.create(shell, flux);
I imported the following jars in my project:
- swt and associated native library
- xswt.jar
- xmlpull_1_1_3_1.jar
- kxml2-min.jar
Regards,
Olivier Parisy.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xswt-developer mailing list
Xsw...@li...
https://lists.sourceforge.net/lists/listinfo/xswt-developer
|