Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » Nested XWT
Nested XWT [message #524489] Thu, 01 April 2010 03:21 Go to next message
Eclipse UserFriend
Hi,

I tried using the test in org.eclipse.e4.xwt.tests.view
for nested XWTs, but all the time even when using the namespace like
<j:CompanyView xmlns:j="clr-namespace:my.app.sample.views">
<j:CompanyView.layout>
<GridLayout numColumns="2"/>
</j:CompanyView.layout>
</j:CompanyView>

XWT says it cannot load the XWT and creates an exception:
org.eclipse.e4.xwt.XWTException: Cannot load my.app.sample.views.CompanyView
at org.eclipse.e4.xwt.internal.core.MetaclassManager.getMetacla ss(MetaclassManager.java:134)
at org.eclipse.e4.xwt.internal.core.MetaclassService.getMetacla ss(MetaclassService.java:43)
at org.eclipse.e4.xwt.internal.core.Core.getMetaclass(Core.java :544)
at org.eclipse.e4.xwt.XWTLoader.getMetaclass(XWTLoader.java:893 )
at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource Loader.java:429)
at org.eclipse.e4.xwt.javabean.ResourceLoader.createCLRElement( ResourceLoader.java:363)
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.load(XWTLoader.java:604)
at org.eclipse.e4.xwt.XWT.load(XWT.java:399)


Any clue?
Re: Nested XWT [message #524693 is a reply to message #524489] Thu, 01 April 2010 15:51 Go to previous messageGo to next message
Eclipse UserFriend
I guess it is a problem of class loader. Is it a Java application or eclipse
bundle ?

Regards
Yves YANG
"Sebastian" <laluz@gateway23.de> wrote in message
news:hp1hi2$dm6$1@build.eclipse.org...
> Hi,
>
> I tried using the test in org.eclipse.e4.xwt.tests.view
> for nested XWTs, but all the time even when using the namespace like
> <j:CompanyView xmlns:j="clr-namespace:my.app.sample.views">
> <j:CompanyView.layout>
> <GridLayout numColumns="2"/>
> </j:CompanyView.layout>
> </j:CompanyView>
>
> XWT says it cannot load the XWT and creates an exception:
> org.eclipse.e4.xwt.XWTException: Cannot load
> my.app.sample.views.CompanyView
> at org.eclipse.e4.xwt.internal.core.MetaclassManager.getMetacla
> ss(MetaclassManager.java:134)
> at org.eclipse.e4.xwt.internal.core.MetaclassService.getMetacla
> ss(MetaclassService.java:43)
> at org.eclipse.e4.xwt.internal.core.Core.getMetaclass(Core.java :544)
> at org.eclipse.e4.xwt.XWTLoader.getMetaclass(XWTLoader.java:893 )
> at org.eclipse.e4.xwt.javabean.ResourceLoader.doCreate(Resource
> Loader.java:429)
> at org.eclipse.e4.xwt.javabean.ResourceLoader.createCLRElement(
> ResourceLoader.java:363)
> 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.load(XWTLoader.java:604)
> at org.eclipse.e4.xwt.XWT.load(XWT.java:399)
>
>
> Any clue?
Re: Nested XWT [message #524760 is a reply to message #524693] Fri, 02 April 2010 07:12 Go to previous messageGo to next message
Eclipse UserFriend
Nope, it's within an eclipse bundle
I will debug it again next week, I guess.
Re: Nested XWT [message #525838 is a reply to message #524760] Wed, 07 April 2010 18:46 Go to previous messageGo to next message
Eclipse UserFriend
It is what I guess. The problem is the class loader. You need to register a
ClassLoaderContext

ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(myLoader);
XWT.load(url, ...);
} catch (Exception e) {
LoggerManager.log(e);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}

where myLoader is your class loader.

Regards
Yves
"Sebastian" <laluz@gateway23.de> wrote in message
news:hp4jfq$u15$1@build.eclipse.org...
> Nope, it's within an eclipse bundle
> I will debug it again next week, I guess.
Re: Nested XWT [message #525876 is a reply to message #525838] Thu, 08 April 2010 03:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi Yves,

I will check this next week (have more time due to vacation Smile
Thanks a lot for your efforts.

However, I'm kind of irritated. Since both java classes and XTWs are in the same package of the same bundle.

Could this be a class loader issue, still? Obviuosly, yes!
But anyhow, in my opinion it makes no sense to be forced to add an own class loader to make things work out right.
Or to say it another way around, to be able using nested XWTs it seems odd to me having to add a class loader, although both XWTs and classes remain in the same bundle and even in the same package/namespace.

In a java app I would expect the java interpreter to find these files, since they're within the same classpath, as an anaolgy.

Please don't hesitate to ask if I expressed myself unclearly
Regards
Sebastian
Re: Nested XWT [message #526007 is a reply to message #525876] Thu, 08 April 2010 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi Sebastian,

The loading operation occurs in XWT bundle.By default, the class loader
context is XWT bundle. Your class and resources are located in a different
bundle, which are not found.

Best regards
Yves YANG
"Sebastian" <laluz@gateway23.de> wrote in message
news:hpk09v$5g7$1@build.eclipse.org...
> Hi Yves,
>
> I will check this next week (have more time due to vacation :)
> Thanks a lot for your efforts.
>
> However, I'm kind of irritated. Since both java classes and XTWs are in
> the same package of the same bundle.
>
> Could this be a class loader issue, still? Obviuosly, yes!
> But anyhow, in my opinion it makes no sense to be forced to add an own
> class loader to make things work out right.
> Or to say it another way around, to be able using nested XWTs it seems odd
> to me having to add a class loader, although both XWTs and classes remain
> in the same bundle and even in the same package/namespace.
>
> In a java app I would expect the java interpreter to find these files,
> since they're within the same classpath, as an anaolgy.
>
> Please don't hesitate to ask if I expressed myself unclearly
> Regards
> Sebastian
Re: Nested XWT [message #526413 is a reply to message #526007] Sat, 10 April 2010 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi Yves,

gosh, you're right - didn't think on that Smile

Sebastian
Re: Nested XWT [message #572659 is a reply to message #524693] Fri, 02 April 2010 07:12 Go to previous messageGo to next message
Eclipse UserFriend
Nope, it's within an eclipse bundle
I will debug it again next week, I guess.
Re: Nested XWT [message #573372 is a reply to message #572659] Wed, 07 April 2010 18:46 Go to previous messageGo to next message
Eclipse UserFriend
It is what I guess. The problem is the class loader. You need to register a
ClassLoaderContext

ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(myLoader);
XWT.load(url, ...);
} catch (Exception e) {
LoggerManager.log(e);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}

where myLoader is your class loader.

Regards
Yves
"Sebastian" <laluz@gateway23.de> wrote in message
news:hp4jfq$u15$1@build.eclipse.org...
> Nope, it's within an eclipse bundle
> I will debug it again next week, I guess.
Re: Nested XWT [message #573446 is a reply to message #525838] Thu, 08 April 2010 03:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi Yves,

I will check this next week (have more time due to vacation :)
Thanks a lot for your efforts.

However, I'm kind of irritated. Since both java classes and XTWs are in the same package of the same bundle.

Could this be a class loader issue, still? Obviuosly, yes!
But anyhow, in my opinion it makes no sense to be forced to add an own class loader to make things work out right.
Or to say it another way around, to be able using nested XWTs it seems odd to me having to add a class loader, although both XWTs and classes remain in the same bundle and even in the same package/namespace.

In a java app I would expect the java interpreter to find these files, since they're within the same classpath, as an anaolgy.

Please don't hesitate to ask if I expressed myself unclearly
Regards
Sebastian
Re: Nested XWT [message #573495 is a reply to message #573446] Thu, 08 April 2010 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi Sebastian,

The loading operation occurs in XWT bundle.By default, the class loader
context is XWT bundle. Your class and resources are located in a different
bundle, which are not found.

Best regards
Yves YANG
"Sebastian" <laluz@gateway23.de> wrote in message
news:hpk09v$5g7$1@build.eclipse.org...
> Hi Yves,
>
> I will check this next week (have more time due to vacation :)
> Thanks a lot for your efforts.
>
> However, I'm kind of irritated. Since both java classes and XTWs are in
> the same package of the same bundle.
>
> Could this be a class loader issue, still? Obviuosly, yes!
> But anyhow, in my opinion it makes no sense to be forced to add an own
> class loader to make things work out right.
> Or to say it another way around, to be able using nested XWTs it seems odd
> to me having to add a class loader, although both XWTs and classes remain
> in the same bundle and even in the same package/namespace.
>
> In a java app I would expect the java interpreter to find these files,
> since they're within the same classpath, as an anaolgy.
>
> Please don't hesitate to ask if I expressed myself unclearly
> Regards
> Sebastian
Re: Nested XWT [message #573937 is a reply to message #526007] Sat, 10 April 2010 12:54 Go to previous message
Eclipse UserFriend
Hi Yves,

gosh, you're right - didn't think on that :)

Sebastian
Previous Topic:Show View request
Next Topic:Show View request
Goto Forum:
  


Current Time: Tue Jul 15 06:09:33 EDT 2025

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

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

Back to the top