Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Call XWT.findElementByName Method in User-Interface Thread
Call XWT.findElementByName Method in User-Interface Thread [message #571290] Sun, 21 March 2010 12:57 Go to next message
can kayacan is currently offline can kayacanFriend
Messages: 16
Registered: March 2010
Junior Member
Hi,

My XWT UI Element implements the java.util.Observer class.

in the update method, I want to get the canvas element by calling XWT.findElementByName but it always returns null.

@Override
public void update(Observable o, Object arg) {
this.getDisplay().asyncExec(new Runnable() {
public void run() {
Canvas pitchCanvas = (Canvas) XWT.findElementByName(this, "PitchCanvas"); // RETURNS NULL
}
});

But if I call the same in the paint events it works:

public void onPaintEvent(Object object, Event event) {
Canvas pitchCanvas = (Canvas) XWT.findElementByName(this, "PitchCanvas"); // WORKS

Have any idea about the problem? Is it a bug?
Re: Call XWT.findElementByName Method in User-Interface Thread [message #571307 is a reply to message #571290] Sun, 21 March 2010 13:21 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
You have to execute the code in the xwt realm, see:

XWT.getRealm().
Re: Call XWT.findElementByName Method in User-Interface Thread [message #571315 is a reply to message #571307] Sun, 21 March 2010 14:14 Go to previous messageGo to next message
can kayacan is currently offline can kayacanFriend
Messages: 16
Registered: March 2010
Junior Member
Unfortunately, the result is the same by using the Realm like:

XWT.getRealm().asyncExec(new Runnable() {
...
Re: Call XWT.findElementByName Method in User-Interface Thread [message #571336 is a reply to message #571315] Sun, 21 March 2010 18:45 Go to previous message
can kayacan is currently offline can kayacanFriend
Messages: 16
Registered: March 2010
Junior Member
I prepared a simple demo application for this problem,

somebody may try it easily...

http://cid-05452aee1eda70dc.skydrive.live.com/self.aspx/Publ ic/DemoFindElementThread.tar.gz
Previous Topic:org.eclipse.e4.xwt.XWTException
Next Topic:problem opening Application.e4xmi in e4 windows 64bit
Goto Forum:
  


Current Time: Sat Apr 20 02:28:22 GMT 2024

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

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

Back to the top