Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » org.eclipse.e4.xwt.XWTException(All forms being executed throws XWTException)
org.eclipse.e4.xwt.XWTException [message #521811] 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 #521844 is a reply to message #521811] 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,
Google, Inc.

[Updated on: Thu, 18 March 2010 21:45]

Report message to a moderator

Re: org.eclipse.e4.xwt.XWTException [message #521866 is a reply to message #521811] 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 #521896 is a reply to message #521866] Fri, 19 March 2010 08:18 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Fri, 19 March 2010 03:25
You need org.eclipse.e4.xwt.forms plugin. You can find examples in the
package org.eclipse.e4.xwt.test.forms



Ah... It uses special class XWTForms for rendering.
Hm... Do you think that this is good?
I personally would prefer to have single rendering entry point, which will discover new supported classes automatically (using extensions) or manually.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #522056 is a reply to message #521844] 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 #522057 is a reply to message #521866] Fri, 19 March 2010 19:02 Go to previous messageGo to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello Yves,
If you look at the penultimate line in the dependencies list in my initial post, note that the class you mentioned is present, yet none of the snippets run.

I note in the test snippets, no explicite namespace is created for the org.eclipse.e4.xwt.test.forms package.

Something else is still missing.

Thanks
Re: org.eclipse.e4.xwt.XWTException [message #522060 is a reply to message #522056] 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.getSimpleName()
				+ 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,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #522078 is a reply to message #522060] 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 #522084 is a reply to message #522078] Fri, 19 March 2010 20:55 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 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,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #523603 is a reply to message #522057] Sat, 27 March 2010 06:14 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"St Clair Clarke" <st_clair@flowja.com> wrote in message
news:ho0hni$tb1$1@build.eclipse.org...
> Hello Yves,
> If you look at the penultimate line in the dependencies list in my initial
> post, note that the class you mentioned is present, yet none of the
> snippets run.

If you use the default namespace, its corresponding Java class must be
registered to the XWT. XWTForms is a help class to register some eclipse
Forms classes be
fore calling XWT.load()/open()

yves
>
> I note in the test snippets, no explicite namespace is created for the
> org.eclipse.e4.xwt.test.forms package.
>
> Something else is still missing.
>
> Thanks
Re: org.eclipse.e4.xwt.XWTException [message #523604 is a reply to message #521896] Sat, 27 March 2010 06:17 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hnvc15$md7$1@build.eclipse.org...
> Yves YANG wrote on Fri, 19 March 2010 03:25
>> You need org.eclipse.e4.xwt.forms plugin. You can find examples in the
>> package org.eclipse.e4.xwt.test.forms
>
>
> Ah... It uses special class XWTForms for rendering.
> Hm... Do you think that this is good?
> I personally would prefer to have single rendering entry point, which
> will discover new supported classes automatically (using extensions) or
> manually.

As I said in the reponse to St Clair, we need to register some classes of
eclipose forms before calling XWT. XWTForms is just a help class.

Best regards
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #523655 is a reply to message #523604] Sun, 28 March 2010 08:42 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Sat, 27 March 2010 09:17


As I said in the reponse to St Clair, we need to register some classes of
eclipose forms before calling XWT. XWTForms is just a help class.



OK
Thank you for clarifying this.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #523673 is a reply to message #523603] Sun, 28 March 2010 14:38 Go to previous messageGo to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello Yves,

Thanks for the reply. Please reply with a small example of how this registration should be done.

I have tried to to this in the code-behind class of the corresponding XWT forms but then the XWT.register() does not allow it.

Thanks

St Clair
Re: org.eclipse.e4.xwt.XWTException [message #571059 is a reply to message #521866] Fri, 19 March 2010 08:18 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Fri, 19 March 2010 03:25
> You need org.eclipse.e4.xwt.forms plugin. You can find examples in the
> package org.eclipse.e4.xwt.test.forms


Ah... It uses special class XWTForms for rendering.
Hm... Do you think that this is good?
I personally would prefer to have single rendering entry point, which will discover new supported classes automatically (using extensions) or manually.
--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #571156 is a reply to message #521866] Fri, 19 March 2010 19:02 Go to previous messageGo to next message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello Yves,
If you look at the penultimate line in the dependencies list in my initial post, note that the class you mentioned is present, yet none of the snippets run.

I note in the test snippets, no explicite namespace is created for the org.eclipse.e4.xwt.test.forms package.

Something else is still missing.

Thanks
Re: org.eclipse.e4.xwt.XWTException [message #571979 is a reply to message #571156] Sat, 27 March 2010 06:14 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"St Clair Clarke" <st_clair@flowja.com> wrote in message
news:ho0hni$tb1$1@build.eclipse.org...
> Hello Yves,
> If you look at the penultimate line in the dependencies list in my initial
> post, note that the class you mentioned is present, yet none of the
> snippets run.

If you use the default namespace, its corresponding Java class must be
registered to the XWT. XWTForms is a help class to register some eclipse
Forms classes be
fore calling XWT.load()/open()

yves
>
> I note in the test snippets, no explicite namespace is created for the
> org.eclipse.e4.xwt.test.forms package.
>
> Something else is still missing.
>
> Thanks
Re: org.eclipse.e4.xwt.XWTException [message #572016 is a reply to message #521896] Sat, 27 March 2010 06:17 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
"Konstantin Scheglov" <Konstantin.Scheglov@gmail.com> wrote in message
news:hnvc15$md7$1@build.eclipse.org...
> Yves YANG wrote on Fri, 19 March 2010 03:25
>> You need org.eclipse.e4.xwt.forms plugin. You can find examples in the
>> package org.eclipse.e4.xwt.test.forms
>
>
> Ah... It uses special class XWTForms for rendering.
> Hm... Do you think that this is good?
> I personally would prefer to have single rendering entry point, which
> will discover new supported classes automatically (using extensions) or
> manually.

As I said in the reponse to St Clair, we need to register some classes of
eclipose forms before calling XWT. XWTForms is just a help class.

Best regards
> --
> Konstantin Scheglov,
> Instantiations, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #572127 is a reply to message #523604] Sun, 28 March 2010 08:43 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yves YANG wrote on Sat, 27 March 2010 09:17
> As I said in the reponse to St Clair, we need to register some classes of
> eclipose forms before calling XWT. XWTForms is just a help class.


OK
Thank you for clarifying this.

--
Konstantin Scheglov,
Instantiations, Inc.


Konstantin Scheglov,
Google, Inc.
Re: org.eclipse.e4.xwt.XWTException [message #572200 is a reply to message #523603] Sun, 28 March 2010 14:38 Go to previous message
St Clair Clarke is currently offline St Clair ClarkeFriend
Messages: 118
Registered: March 2010
Senior Member
Hello Yves,

Thanks for the reply. Please reply with a small example of how this registration should be done.

I have tried to to this in the code-behind class of the corresponding XWT forms but then the XWT.register() does not allow it.

Thanks

St Clair
Previous Topic:Re: Eclipse E4 product export
Next Topic:Re: Eclipse E4 product export
Goto Forum:
  


Current Time: Thu Mar 28 18:04:13 GMT 2024

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

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

Back to the top