Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » org.eclipse.e4.xwt.XWTException
org.eclipse.e4.xwt.XWTException [message #571002] Thu, 18 March 2010 19:04 Go to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello,

I have this example from the test examples:

<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:j="clr-namespace:test.ui"
xmlns:x="http://www.eclipse.org/xwt">
<Composite.layout>
<GridLayout numColumns="1" />
</Composite.layout>
<Section name="Section" x:style="Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED "
text="Section Two">
<Section.client>
<Label name="Section.Label" text="test" />
</Section.client>
</Section>
</Composite>

with the following code-behind:

package snippets.e4.forms;

import java.net.URL;

import org.eclipse.e4.xwt.IConstants;
import org.eclipse.e4.xwt.XWT;

public class Section
{
public static void main( String[] args )
{

URL url = Section.class.getResource( Section.class.getSimpleName() + IConstants.XWT_EXTENSION_SUFFIX );

try
{
XWT.open( url );
}
catch( Exception e )
{
e.printStackTrace();
}
}
}

Running the code-behind throws this exception:

org.eclipse.e4.xwt.XWTException: Type Section is not found.
at org.eclipse.e4.xwt.XWTLoader.getMetaclass(XWTLoader.java:899 )
at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource Loader.java:419)
at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource Loader.java:648)
at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource Loader.java:449)
at org.eclipse.e4.xwt.javabean.ResourceLoader.createCLRElement( ResourceLoader.java:353)
at org.eclipse.e4.xwt.internal.core.Core.createCLRElement(Core. java:606)
at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:646)
at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:633)
at org.eclipse.e4.xwt.XWTLoader.loadWithOptions(XWTLoader.java: 835)
at org.eclipse.e4.xwt.XWTLoader$1.run(XWTLoader.java:768)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.e4.xwt.XWTLoader.open(XWTLoader.java:762)
at org.eclipse.e4.xwt.XWTLoader.open(XWTLoader.java:714)
at org.eclipse.e4.xwt.XWT.open(XWT.java:411)
at snippets.e4.forms.Section.main(Section.java:17)


A similar exception is thown for all my forms.

My dependencies in e4 are:

javax.inject;bundle-version="1.0.0",
org.eclipse.core.resources;bundle-version="3.6.0",
org.eclipse.core.runtime;bundle-version="3.6.0",
org.eclipse.swt;bundle-version="3.6.0",
org.eclipse.core.databinding;bundle-version="1.3.0",
org.eclipse.core.databinding.beans;bundle-version="1.2.0",
org.eclipse.jface;bundle-version="3.6.0",
org.eclipse.jface.databinding;bundle-version="1.4.0",
org.eclipse.e4.ui.services;bundle-version="0.9.1",
org.eclipse.e4.ui.workbench;bundle-version="0.9.1",
org.eclipse.e4.core.services;bundle-version="0.9.1",
org.eclipse.e4.ui.workbench.swt;bundle-version="0.9.1",
org.eclipse.core.databinding.property;bundle-version="1.2.100 ",
org.eclipse.e4.ui.css.core;bundle-version="0.9.0",
org.w3c.css.sac;bundle-version="1.3.0",
org.eclipse.e4.core.commands;bundle-version="0.9.0",
org.eclipse.e4.ui.bindings;bundle-version="0.9.0",
org.junit4;bundle-version="4.7.0",
org.eclipse.e4.xwt;bundle-version="0.9.1",
com.ibm.icu;bundle-version="4.2.1",
org.eclipse.e4.xwt.tests;bundle-version="0.9.1",
org.eclipse.e4.xwt.forms;bundle-version="0.9.1",
org.eclipse.ui.forms;bundle-version="3.5.0"

I don't know exactly why the xwt and swt form packages are not being recognized.

Similarl, the form fails to be displayed in the XWT editor.


Any help will be appreciated.

Thanks
Re: org.eclipse.e4.xwt.XWTException [message #571024 is a reply to message #571002] Thu, 18 March 2010 21:43 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
I'm not 100% sure, but as I understand source, only flags from SWT class can be used without qualifier, for all other style constants you have to use package/class qualifier. See example below.

Note, however, that Section is created without FormToolkit, so looks not very good. Would be good to have support for static/instance factories in XWT.

<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt"
xmlns:p1="clr-namespace:org.eclipse.ui.forms.widgets">
<Shell.layout>
<RowLayout/>
</Shell.layout>
<p1:Section text="My Section title" x:Style="(p1:Section).EXPANDED | (p1:Section).TWISTIE | (p1:Section).TITLE_BAR">
<p1:Section.layoutData>
<RowData width="330" height="248"/>
</p1:Section.layoutData>
<Section.client>
<Button text="test"/>
</Section.client>
</p1:Section>
</Shell>
--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #571039 is a reply to message #571002] Fri, 19 March 2010 00:25 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You need org.eclipse.e4.xwt.forms plugin. You can find examples in the
package org.eclipse.e4.xwt.test.forms

Regards
yves
"St Clair Clarke" <st_clair@flowja.com> wrote in message
news:hnttfe$g3b$1@build.eclipse.org...
> Hello,
>
> I have this example from the test examples:
>
> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
> xmlns:j="clr-namespace:test.ui"
> xmlns:x="http://www.eclipse.org/xwt">
> <Composite.layout>
> <GridLayout numColumns="1" />
> </Composite.layout>
> <Section name="Section"
> x:style="Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED "
> text="Section Two">
> <Section.client>
> <Label name="Section.Label" text="test" />
> </Section.client>
> </Section>
> </Composite>
>
> with the following code-behind:
>
> package snippets.e4.forms;
>
> import java.net.URL;
>
> import org.eclipse.e4.xwt.IConstants;
> import org.eclipse.e4.xwt.XWT;
>
> public class Section
> {
> public static void main( String[] args )
> {
> URL url = Section.class.getResource( Section.class.getSimpleName()
> + IConstants.XWT_EXTENSION_SUFFIX );
> try
> {
> XWT.open( url );
> }
> catch( Exception e )
> {
> e.printStackTrace();
> }
> }
> }
>
> Running the code-behind throws this exception:
>
> org.eclipse.e4.xwt.XWTException: Type Section is not found.
> at org.eclipse.e4.xwt.XWTLoader.getMetaclass(XWTLoader.java:899 )
> at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource
> Loader.java:419)
> at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource
> Loader.java:648)
> at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource
> Loader.java:449)
> at org.eclipse.e4.xwt.javabean.ResourceLoader.createCLRElement(
> ResourceLoader.java:353)
> at org.eclipse.e4.xwt.internal.core.Core.createCLRElement(Core. java:606)
> at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:646)
> at org.eclipse.e4.xwt.internal.core.Core.load(Core.java:633)
> at org.eclipse.e4.xwt.XWTLoader.loadWithOptions(XWTLoader.java: 835)
> at org.eclipse.e4.xwt.XWTLoader$1.run(XWTLoader.java:768)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.e4.xwt.XWTLoader.open(XWTLoader.java:762)
> at org.eclipse.e4.xwt.XWTLoader.open(XWTLoader.java:714)
> at org.eclipse.e4.xwt.XWT.open(XWT.java:411)
> at snippets.e4.forms.Section.main(Section.java:17)
>
>
> A similar exception is thown for all my forms.
>
> My dependencies in e4 are:
>
> javax.inject;bundle-version="1.0.0",
> org.eclipse.core.resources;bundle-version="3.6.0",
> org.eclipse.core.runtime;bundle-version="3.6.0",
> org.eclipse.swt;bundle-version="3.6.0",
> org.eclipse.core.databinding;bundle-version="1.3.0",
> org.eclipse.core.databinding.beans;bundle-version="1.2.0",
> org.eclipse.jface;bundle-version="3.6.0",
> org.eclipse.jface.databinding;bundle-version="1.4.0",
> org.eclipse.e4.ui.services;bundle-version="0.9.1",
> org.eclipse.e4.ui.workbench;bundle-version="0.9.1",
> org.eclipse.e4.core.services;bundle-version="0.9.1",
> org.eclipse.e4.ui.workbench.swt;bundle-version="0.9.1",
> org.eclipse.core.databinding.property;bundle-version="1.2.100 ",
> org.eclipse.e4.ui.css.core;bundle-version="0.9.0",
> org.w3c.css.sac;bundle-version="1.3.0",
> org.eclipse.e4.core.commands;bundle-version="0.9.0",
> org.eclipse.e4.ui.bindings;bundle-version="0.9.0",
> org.junit4;bundle-version="4.7.0",
> org.eclipse.e4.xwt;bundle-version="0.9.1",
> com.ibm.icu;bundle-version="4.2.1",
> org.eclipse.e4.xwt.tests;bundle-version="0.9.1",
> org.eclipse.e4.xwt.forms;bundle-version="0.9.1",
> org.eclipse.ui.forms;bundle-version="3.5.0"
>
> I don't know exactly why the xwt and swt form packages are not being
> recognized.
>
> Similarl, the form fails to be displayed in the XWT editor.
>
>
> Any help will be appreciated.
>
> Thanks
Re: org.eclipse.e4.xwt.XWTException [message #571127 is a reply to message #571024] Fri, 19 March 2010 18:56 Go to previous messageGo to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello KC,
Thanks for the info.

However, if you look at the unmodified code from xwt cvs, you will notice it is significantly different from yours. And when it renders it does so looking like the section created by WBP.


<Composite xmlns="http://www.eclipse.org/xwt/presentation"
xmlns:j="clr-namespace:test.ui"
xmlns:x="http://www.eclipse.org/xwt">
<Composite.layout>
<GridLayout numColumns="1" />
</Composite.layout>
<Section name="Section" x:style="Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED "
text="Section Two">
<Section.client>
<Label name="Section.Label" text="test" />
</Section.client>
</Section>
</Composite>


I am going to post Yves to tell me where can I find the namespace package test.ui above as I think somethings are in that package that I fail to see.

Moving the code from xwt CVS to another e4 and attempting to run the cod fails though.

When I put the xmlns:p1="clr-namespace:org.eclipse.ui.forms.widgets"> namespace the section looks like simple text rendering.

Let me know what you think.

Thanks.

St Clair
Re: org.eclipse.e4.xwt.XWTException [message #571171 is a reply to message #571127] Fri, 19 March 2010 19:12 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
St Clair Clarke wrote on Fri, 19 March 2010 21:56
> Hello KC,
> Thanks for the info.
>
> However, if you look at the unmodified code from xwt cvs, you will notice it is significantly different from yours. And when it renders it does so looking like the section created by WBP.
>
> I am going to post Yves to tell me where can I find the namespace package test.ui above as I think somethings are in that package that I fail to see.
>
> Moving the code from xwt CVS to another e4 and attempting to run the cod fails though.
>
> When I put the xmlns:p1="clr-namespace:org.eclipse.ui.forms.widgets"> namespace the section looks like simple text rendering.


Look carefully on Form_Section.java

public class Form_Section {
public static void main(String[] args) {

URL url = Form_Section.class.getResource(Form_Section.class.getSimpleN ame()
+ IConstants.XWT_EXTENSION_SUFFIX);
try {
XWTForms.open(url);
} catch (Exception e) {
e.printStackTrace();
}
}
}


Note, that it uses XWTForms for rendering.
This is why it can use Section styles (without causing exception like you posted) and it looks nice (because internally it creates Section using default FormToolkit, not just new Section class without decoration).
--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #571201 is a reply to message #571171] Fri, 19 March 2010 20:28 Go to previous messageGo to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello KC,
Thanks. And the fault was mine. Just missed that important piece of code.

All the forms are now working, but I noticed something peculiar.

None of the forms are displayed in the designer. The designer just has a text saying Loading...

This is also what the cvs checkout does.

Any idea why the forms are not being rendered in the Designer?

Thanks
Re: org.eclipse.e4.xwt.XWTException [message #571217 is a reply to message #571201] Fri, 19 March 2010 20:55 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
St Clair Clarke wrote on Fri, 19 March 2010 23:28
> Thanks. And the fault was mine. Just missed that important piece of code.


Yes, this was surprise for me too.


St Clair Clarke wrote on Fri, 19 March 2010 23:28
> All the forms are now working, but I noticed something peculiar.
>
> None of the forms are displayed in the designer. The designer just has a text saying Loading...
>
> This is also what the cvs checkout does.
>
> Any idea why the forms are not being rendered in the Designer?


As we know now, support for Forms lives in separate plugin which does not contribute anything into main XWT. Instead you should "pull" this support by using special renderer - XWTForms. As I can see, this is not done in org.eclipse.e4.xwt.tools.ui.designer plugin. So, no rendering for Forms.

I've noticed also that org.eclipse.e4.xwt.tools.ui.designer has class org.eclipse.e4.xwt.tools.ui.designer.loader.ResourceVisitor which is almost identical to the org.eclipse.e4.xwt.javabean.ResourceLoader in XWT library itself. So, probably, currently designer is just quick and dirty implementation to prove concept of XML based SWT UI editing and not all features are supported.

--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Previous Topic:How to take an Eclipse RCP app to the Web?
Next Topic:Call XWT.findElementByName Method in User-Interface Thread
Goto Forum:
  


Current Time: Tue Apr 16 09:08:00 GMT 2024

Powered by FUDForum. Page generated in 0.40035 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top