I have a piece of GWT code that I wanted to invoke from outside handwritten JavaScript. There's an example shown here under "Calling a Java method from Handwritten JavaScript":
That example uses a static method; I can make that work, but my first instinct was that i'd rather use an instance, so using the syntax shown under JSNI invocations, I tried:
/* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{
$wnd.imageSelected =
$entry(this@ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected(Ljava/lang/String;Ljava/lang/String;));
}-*/;
That doesn't work. Eclipse (and the GWT compiler) complain:
"JavaScript parsing: Missing ) after argument list PreviewPane.java"
If I replace 'this' with 'x', same problem. If I take 'this' out and leave it binding to the static method:
/* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{
$wnd.imageSelected =
$entry(@ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected(Ljava/lang/String;Ljava/lang/String;));
}-*/;
All is well in the world.
So -- is that just not an option, exporting an instance method like that?