Your test()
is not static. Therefore you will need to make it static or specify an instance or make the purchase non-static.
(This error is the GWT version of "Cannot make a static reference to the non-static method methodName() from the type TypeName
")
public native void purchase(String token) /*-{
var instance = this;
var successHandler = function(status){ // Success handler
return instance.@com.gw.myProject.client.presenter.payments.PaymentProgramPresenter::test()();
}
var failureHandler = function(status){ // Failure handler
// $wnd.alert('testing');
}
$doc.purchaseAction(token, successHandler, failureHandler);
}-*/;
public void test() {
this.onHide();
}
You can find a real good tutorial at gwtproject.org
One more tip. If you create javascript Callbacks within the JSNI, wrap them with en $entry()-function:
$doc.purchaseAction(token,$entry( successHandler ), $entry( failureHandler));
This will enable the GWT uncaughtExceptionHandler