In a RCP application I am displaying a GWT-based web-application in a SWT Browser.
My Goal is, to call a Java Method from within the GWT application.
From what I understand the easiest way to do that is to use SWT BrowserFunction, which injects a java Method that I can call from within the web-application.
For some reason I'm not able to get it to work...
In RCP I defined the following
public class GWTBrowserView extends ViewPart {
private GWTBrowser browser;
@Override
public void createPartControl(final Composite parent) {
this.browser = new GWTBrowser(parent, SWT.NONE);
this.browser.setUrl("url of gwt app");
new BrowserFunction(this.browser, "onGWTEvent") {
@Override
public Object function(final Object[] arguments) {
// Do something fancy
return super.function(arguments);
}
};
}
In my GWT EntryPoint as part of onModuleLoad I am calling the Method:
private native void fireRCPEvent(String rcpEventJSON) /*-{
try{
onGWTEvent(rcpEventJSON);
} catch(e) {
alert(e.message)
}
Any ideas how to establish the communication between GWT and RCP via the SWT Browser?