Home » Eclipse Projects » Remote Application Platform (RAP) » Events not working (Cannot get even one event handler to work)
| Events not working [message #941400] |
Fri, 12 October 2012 09:39  |
John Bester Messages: 5 Registered: October 2012 |
Junior Member |
|
|
I am using Eclipse Juno on Ubuntu 12.04.1. I have tried everything short of saying the magic word and I cannot get even one event handler to be called. I have searched the net for 2 days now. For now, if I can catch a button press to fire, I will be ecstatic. This is how far I got:
I can create a display, shell and add components to it. I can run this app as an OSGI application and open it in a browser. The design at this point is fairly simple, since there is no real point in going any further without being able to handle events. I have tried the following in various different combinations and sequences, and nothing changes:
Display display = new org.eclipse.swt.widgets.Display();
Shell shell = new org.eclipse.swt.widgets.Shell(display, SWT.RESIZE);
Button button = new org.eclipse.swt.widgets.Button(shell, SWT.PUSH);
button.setText("Hallo");
display.setData(RWT.ACTIVE_KEYS, new String[] { "X", "F2", "ENTER", "SPACE" });
shell.setData(RWT.ACTIVE_KEYS, new String[] { "X", "F2", "ENTER", "SPACE" });
button.setData(RWT.ACTIVE_KEYS, new String[] { "X", "F2", "ENTER", "SPACE" });
display.addFilter(SWT.KeyDown, new Listener() { ... });
display.addFilter(SWT.MouseDown, new Listener() { ... });
shell.addFilter(SWT.KeyDown, new Listener() { ... });
shell.addFilter(SWT.MouseDown, new Listener() { ... });
button.addFilter(SWT.KeyDown, new Listener() { ... });
button.addFilter(SWT.MouseDown, new Listener() { ... });
button.addSelectionListener(new SelectionListener() { ... });
button.addMouseListener(new MouseListener() { ... });
button.addKeyListener(new KeyListener() { ... });
If you were to put these statements in a bag, shake it a bit and let a few fall out and then take out the rest one by one, I would have probably tried the code you came up with. What am I missing? I have added dependencies, I have marked the "Optional" and "Re-export" flags on dependencies (all stuff I tried by doing tons of google). I have tried running the app as OGSI as well as RAP applications. I have tried different browsers (Chrome, Firefox, Eclipse built in browser). I even tried some of these options on MacOSX. I even tried running the app as a stand alone SWT app, but got a problem that seems to be unheard of: "java.lang.IllegalStateException: No context available outside of the request service lifecycle." But this has taken up yet another couple of hours of research to no avail.
If I cannot get past this obstacle, then I will have to go back to GWT or some other framework. That would be a pity, because I do like the quick development lifecycle of RAP.
Please help!!!
|
|
|
Goto Forum:
Current Time: Tue May 21 11:19:46 EDT 2013
Powered by FUDForum. Page generated in 0.01773 seconds
|