Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWTException by adding Listener to Button
XWTException by adding Listener to Button [message #728639] Fri, 23 September 2011 15:18 Go to next message
Wok Show is currently offline Wok ShowFriend
Messages: 40
Registered: July 2009
Member
Hi together,

before I add the doubleClick Listener to the Button in XWT the Application runs well. After adding the SelectionListener in the Codebehind-Class I get this Exception

org.eclipse.e4.xwt.XWTException: Event handler "onSelection" is not found.

I read in many threads they told about the Classloader position, I done it, but this Exception is still there.

Can anybody help me?

Thanks!

D.Chau
Re: XWTException by adding Listener to Button [message #728641 is a reply to message #728639] Fri, 23 September 2011 15:23 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
You have to use it this way:

<button selectionEvent="yourEventHandlerMethodName" />

I am not sure, but I guess for double click this may work (just have a look at the test cases):

<button doubleClickEvent="yourEventHandlerMethodName" />
Re: XWTException by adding Listener to Button [message #728662 is a reply to message #728641] Fri, 23 September 2011 15:51 Go to previous messageGo to next message
Wok Show is currently offline Wok ShowFriend
Messages: 40
Registered: July 2009
Member
Hi Erdak Karaca,

yeah i Use the selectionEvent Attribute to add the Listener, but thats why I not understand about the Exception
Re: XWTException by adding Listener to Button [message #728701 is a reply to message #728662] Fri, 23 September 2011 17:20 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
Are you sure you have a method that has this signature or looks like this:

public void onSelection(Event e) {
...
}

"onSelection" is what you define in your handler class that you tell xwt to use via x:Class="com.exampl.MyEventHandler"...

The exception is telling you that either "onSelection" does not exist or your handler class is not defined/registered...
Re: XWTException by adding Listener to Button [message #728705 is a reply to message #728701] Fri, 23 September 2011 17:36 Go to previous messageGo to next message
Wok Show is currently offline Wok ShowFriend
Messages: 40
Registered: July 2009
Member
this method is generated by the windows builder gui, when I add the doublelcick listener to the button in drag&drop editor and i get this exception by running the application.
Re: XWTException by adding Listener to Button [message #901202 is a reply to message #728639] Fri, 10 August 2012 10:05 Go to previous messageGo to next message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 36
Registered: August 2012
Member
Hi!

I got the same issue. My test code works fine as long as i am using swt and the shell standalone. But as soon as i try to use the code in a RCP-View i get the exception "Event handler "onSelection" is not found."

<Composite xmlns="http://www.eclipse.org/xwt/presentation" 
		xmlns:x="http://www.eclipse.org/xwt" 
		x:Class="aasdaa.TestWB" 
		xmlns:p1="clr-namespace:java.lang">
	<Composite.layout>
		 <GridLayout  numColumns="4" />
	</Composite.layout>
	<Button text="Double click me!" SelectionEvent="onSelection" />

</Composite>


package aasdaa;

import java.net.URL;

import org.eclipse.e4.xwt.IConstants;
import org.eclipse.e4.xwt.XWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Event;

public class TestWB {

	public void onSelection(Event event) {
		System.out.println("Hello");
	}

}


By the way, i am using Eclipse 3.6 (also as target platform). Any Help would be appreceated. Because XWT seems to be a good solution for our problems.

regards weinma
Re: XWTException by adding Listener to Button [message #902325 is a reply to message #901202] Fri, 17 August 2012 05:19 Go to previous message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 36
Registered: August 2012
Member
Hi! I found the solution to the problem Smile In my case it was the Classloader. Because of the eclipse plugins where every plugin seems to use its own classloader my class couldn't be found.

So the solution was to set the correct classloader before calling XWT.load(..)

XWT.setLoadingContext(new DefaultLoadingContext(dataContext.getClass().getClassloader);


regards weinma
Previous Topic:xwt databinding trouble
Next Topic:PartSashContainer: Children
Goto Forum:
  


Current Time: Thu Dec 18 20:24:00 GMT 2014

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

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