Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » A problem in rcp+xml project
A problem in rcp+xml project [message #504997] Thu, 24 December 2009 09:03 Go to next message
ngh  is currently offline ngh Friend
Messages: 4
Registered: December 2009
Junior Member
Dear everyone:
When I run the code as follow:
1: public void run() {
2: URL file = Test.class.getResource("Test.xwt");
3: t ry {
4: XWT.open(file);
} catch (Exception e) {
e.printStackTrace();
}
}



package test;

import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;

public class Test extends Composite {

public Test(Composite parent, int style) {
super(parent, style);
}
public void selection(Event event){
Button button=(Button)event.widget;
button.setText("It is ok");
}
}

the fourth line throws a exception which is as follow:
classNotFound "selection".
help me.thanks.




Re: A problem in rcp+xml project [message #505024 is a reply to message #504997] Thu, 24 December 2009 16:08 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
It seems your xwt file is missing.

I guess you have a proble class loader. You need to change the thread class
load before calling XWT.open()/load()

XWT.setLoadingContext(new DefaultLoadingContext(this.getClass()
.getClassLoader()));

Yves YANG
"ngh" <wngh13191@126.com> wrote in message
news:hgvapb$eah$1@build.eclipse.org...
> Dear everyone:
> When I run the code as follow:
> 1: public void run() { 2: URL file =
> Test.class.getResource("Test.xwt");
> 3: t ry {
> 4: XWT.open(file);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
>
>
> package test;
>
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Event;
>
> public class Test extends Composite {
>
> public Test(Composite parent, int style) {
> super(parent, style);
> }
> public void selection(Event event){
> Button button=(Button)event.widget;
> button.setText("It is ok");
> }
> }
>
> the fourth line throws a exception which is as follow:
> classNotFound "selection".
> help me.thanks.
>
>
>
>
>
Re: A problem in rcp+xml project [message #505040 is a reply to message #505024] Fri, 25 December 2009 01:53 Go to previous messageGo to next message
ngh  is currently offline ngh Friend
Messages: 4
Registered: December 2009
Junior Member
Thanks Yves YANG:
I hava done as what you said,but the class DefaultLoadingContext cannot be resolved.what's more I
should do.
Re: A problem in rcp+xml project [message #505080 is a reply to message #505040] Fri, 25 December 2009 23:15 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You can look at our org.eclipse.e4.xwt.pde project or
org.eclipse.e4.xwt.workbench. Both of them deal with the resource loading in
eclipse context. There is some examples ported in XWT under
/cvsroot/eclipse/e4/org.eclipse.e4.xwt/examples/ such as contact demo, photo
demo

Best regards
Yves YANG
"ngh" <wngh13191@126.com> wrote in message
news:hh15vp$75k$1@build.eclipse.org...
> Thanks Yves YANG:
> I hava done as what you said,but the class DefaultLoadingContext cannot be
> resolved.what's more I should do.
Re: A problem in rcp+xml project [message #566505 is a reply to message #505024] Fri, 25 December 2009 01:54 Go to previous message
ngh  is currently offline ngh Friend
Messages: 4
Registered: December 2009
Junior Member
Thanks Yves YANG:
I hava done as what you said,but the class DefaultLoadingContext cannot be resolved.what's more I
should do.
Re: A problem in rcp+xml project [message #566574 is a reply to message #566505] Fri, 25 December 2009 23:15 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You can look at our org.eclipse.e4.xwt.pde project or
org.eclipse.e4.xwt.workbench. Both of them deal with the resource loading in
eclipse context. There is some examples ported in XWT under
/cvsroot/eclipse/e4/org.eclipse.e4.xwt/examples/ such as contact demo, photo
demo

Best regards
Yves YANG
"ngh" <wngh13191@126.com> wrote in message
news:hh15vp$75k$1@build.eclipse.org...
> Thanks Yves YANG:
> I hava done as what you said,but the class DefaultLoadingContext cannot be
> resolved.what's more I should do.
Previous Topic:A problem in rcp+xml project
Next Topic:XWT + DataBinding +HashMap
Goto Forum:
  


Current Time: Thu Apr 25 20:01:32 GMT 2024

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

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

Back to the top