I'm following the example seen here for 'calling Java methods from
JSNI' and it works great.
http://googlewebtoolkit.blogspot.com/2008/07/getting-to-really-know-gwt-part-1-jsni.html
I'm trying to do something slightly different though. Here's what it
is.
package com.foo.bar;
public class MyClass {
private void javaMethod(String s) {
Window.alert("called the java method with String " + s);
}
private native String nativeMethod() /*-{
var myFunc = function() {
// trying to call the 'javaMethod' method from here and the
notation
// at the link above does not work
//
// notation that is not working for me
// this.@com.foo.bar.MyClass::javaMethod(Ljava/lang/String;)
('coming from nativeMethod.myFunc');
}
}-*/;
}
It doesn't surprise me that what I'm trying doesn't work, I'm assuming
the 'this' I'm trying to use is in the wrong scope. Anyone have any
suggestions for how I can get to that java method from within a native
method that defines a function?