private static void recompileWidgetsetAndStartInDevMode(
final String serverUrl) {
VConsole.log("Recompiling widgetset using<br/>" + serverUrl
+ "<br/>and then reloading in super dev mode");
VNotification n = new VNotification();
n.show("<b>Recompiling widgetset, please wait</b>",
VNotification.CENTERED, VNotification.STYLE_SYSTEM);
JsonpRequestBuilder b = new JsonpRequestBuilder();
b.setCallbackParam("_callback");
b.setTimeout(COMPILE_TIMEOUT_IN_SECONDS * 1000);
b.requestObject(serverUrl + "recompile/" + GWT.getModuleName() + "?"
+ getRecompileParameters(GWT.getModuleName()),
new AsyncCallback<RecompileResult>() {
@Override
public void onSuccess(RecompileResult result) {
VConsole.log("JSONP compile call successful");
if (!result.ok()) {
VConsole.log("* result: " + result);
failed();
return;
}
setSession(
getSuperDevModeHookKey(),
getSuperDevWidgetSetUrl(GWT.getModuleName(),
serverUrl));
setSession(SKIP_RECOMPILE, "1");
VConsole.log("* result: OK. Reloading");
Location.reload();
}
@Override
public void onFailure(Throwable caught) {
VConsole.error("JSONP compile call failed");
// Don't log exception as they are shown as
// notifications
VConsole.error(Util.getSimpleName(caught) + ": "
+ caught.getMessage());
failed();
}
private void failed() {
VNotification n = new VNotification();
n.addEventListener(new EventListener() {
@Override
public void notificationHidden(HideEvent event) {
recompileWidgetsetAndStartInDevMode(serverUrl);
}
});
n.show("Recompilation failed.<br/>"
+ "Make sure CodeServer is running, "
+ "check its output and click to retry",
VNotification.CENTERED,
VNotification.STYLE_SYSTEM);
}