Example usage for com.google.gwt.eclipse.core.speedtracer SpeedTracerBrowserUtilities createTrampolineFileAndAddToLaunch

List of usage examples for com.google.gwt.eclipse.core.speedtracer SpeedTracerBrowserUtilities createTrampolineFileAndAddToLaunch

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.speedtracer SpeedTracerBrowserUtilities createTrampolineFileAndAddToLaunch.

Prototype

public static void createTrampolineFileAndAddToLaunch(String url, ILaunch launch)
        throws IOException, CoreException 

Source Link

Document

Generates a trampoline file and sets the launch's trampoline file url to the file's url.

Usage

From source file:com.google.gdt.eclipse.suite.launch.SpeedTracerLaunchDelegate.java

License:Open Source License

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
        throws CoreException {

    final String finalUrl = SpeedTracerLaunchConfiguration.getAbsoluteUrl(configuration);

    /*/*w  ww. j av a 2s .  com*/
     * LaunchConfigurations (in the OOPHM model) are added in one of two places:
     * (1) here and (2) as a callback from the GWT SDK's DevMode. For Speed
     * Tracer launches, the SpeedTracerLaunchConfiguration subclass must be used
     * (instead of just LaunchConfiguration.) Therefore, we call this method
     * _BEFORE_ we call through to super.launch() so there is no chance the GWT
     * SDK DevMode can add the launch configuration model object before us (if
     * it were to, it would add a regular LaunchConfiguration instance instead
     * of SpeedTracerLaunchConfiguration.)
     * 
     * TODO: This needs to be cleaned up. Speed Tracer launch support has been
     * added uncleanly to the existing DevMode view/model framework.
     */
    WebAppDebugModel.getInstance().addOrReturnExistingLaunchConfiguration(launch, null,
            new ILaunchConfigurationFactory() {
                public LaunchConfiguration newLaunchConfiguration(ILaunch launch, String name,
                        WebAppDebugModel model) {
                    return new com.google.gwt.eclipse.oophm.model.SpeedTracerLaunchConfiguration(launch,
                            finalUrl, name, model);
                }
            });

    /*
     * Our super class, JavaLaunchDelegate, does not understand the profile
     * mode. Since we only use profile mode for UI purposes, pretend we are
     * launching as run mode.
     */
    super.launch(configuration, ILaunchManager.RUN_MODE, launch, monitor);

    try {

        SpeedTracerBrowserUtilities.createTrampolineFileAndAddToLaunch(finalUrl, launch);

    } catch (Throwable e) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openWarning(SWTUtilities.getShell(), "Speed Tracer error",
                        "Speed Tracer will not be opened automatically, please click on the Speed Tracer icon in the Chrome toolbar");
            }
        });
        GWTPluginLog.logWarning(e, "Could not create trampoline HTML file for Speed Tracer");
    }

    // Open Chrome
    SpeedTracerBrowserUtilities.openBrowser(finalUrl, launch);
}