Example usage for com.google.gwt.ajaxloader.client ExceptionHelper runProtected

List of usage examples for com.google.gwt.ajaxloader.client ExceptionHelper runProtected

Introduction

In this page you can find the example usage for com.google.gwt.ajaxloader.client ExceptionHelper runProtected.

Prototype

public static void runProtected(Runnable runnable) 

Source Link

Document

If an uncaught exception handler has been registered, execute the Runnable in a try/catch block and handle exceptions with the uncaught exception handler.

Usage

From source file:com.rhizospherejs.gwt.client.RhizosphereLoader.java

License:Open Source License

/**
 * Registers a callback to be invoked after Rhizosphere libraries have been
 * successfully injected into a GWT host page. If Rhizosphere libraries
 * have already been injected, the callback immediately executes.
 * @param callback The callback to invoke.
 *//*  www  .j  ava  2  s  . c om*/
public void ensureInjected(final Runnable callback) {
    if (loaded) {
        GWT.log("Rhizosphere has already been loaded. Firing callback now.");
        ExceptionHelper.runProtected(callback);
        return;
    }

    callbacks.add(callback);
    if (injecting) {
        GWT.log("Rhizosphere is currently loading...");
        return;
    }

    GWT.log("Starting Rhizosphere load sequence.");
    injecting = true;
    final ResourcesInjector resourcesFactory = GWT.create(ResourcesInjector.class);
    resourcesFactory.injectDependenciesCss();
    resourcesFactory.injectRhizoCss();

    Runnable dependenciesLoadedCallback = new DependenciesLoadedCallback(resourcesFactory);
    resourcesFactory.injectDependenciesJavascript(dependenciesLoadedCallback, useGoogleCDN);
}

From source file:com.rhizospherejs.gwt.client.RhizosphereLoader.java

License:Open Source License

private void runAllCallbacks() {
    GWT.log("Rhizosphere loading complete. Firing " + callbacks.size() + " callbacks.");
    for (Runnable r : callbacks) {
        ExceptionHelper.runProtected(r);
    }//from  w  ww .  j a va2  s .  c  o m
}