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 04:03 Go to next message
ngh  is currently offline ngh
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 11:08 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANG
Messages: 687
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] Thu, 24 December 2009 20:53 Go to previous messageGo to next message
ngh  is currently offline ngh
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 18:15 Go to previous message
Yves YANG is currently offline Yves YANG
Messages: 687
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] Thu, 24 December 2009 20:54 Go to previous message
ngh  is currently offline ngh
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 18:15 Go to previous message
Yves YANG is currently offline Yves YANG
Messages: 687
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: Wed Aug 20 10:45:53 EDT 2014

Powered by FUDForum. Page generated in 0.01699 seconds