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 #566426] 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 #566486 is a reply to message #566426] Thu, 24 December 2009 16:08 Go to previous 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.
>
>
>
>
>
Previous Topic:How to get a part reference with the service registry?
Next Topic:A problem in rcp+xml project
Goto Forum:
  


Current Time: Thu Sep 24 11:24:10 GMT 2020

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

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

Back to the top