Example usage for com.google.gwt.eclipse.oophm.model WebAppDebugModel getInstance

List of usage examples for com.google.gwt.eclipse.oophm.model WebAppDebugModel getInstance

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.oophm.model WebAppDebugModel getInstance.

Prototype

public static WebAppDebugModel getInstance() 

Source Link

Document

Get the global model instance.

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  w w .  ja  v a2  s  .  co  m
     * 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);
}

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

License:Open Source License

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
        throws CoreException {
    if (!addVmArgs(configuration)) {
        return;//from   www.j a v a  2  s. com
    }
    try {
        if (!ensureWarArgumentExistenceInCertainCases(configuration)) {
            return;
        }
        IJavaProject javaProject = getJavaProject(configuration);
        maybePublishModulesToWarDirectory(configuration, monitor, javaProject, false);

    } catch (Throwable t) {
        // Play safely and continue launch
        GdtPlugin.getLogger().logError(t,
                "Could not ensure WAR argument existence for the unmanaged WAR project.");
    }

    // check if this launch uses -remoteUI. If not, then don't add this launch
    // to the devmode view
    boolean addLaunch = true;
    if (launch != null) {
        try {
            List<String> args = LaunchConfigurationProcessorUtilities
                    .parseProgramArgs(launch.getLaunchConfiguration());
            if (!args.contains(RemoteUiArgumentProcessor.ARG_REMOTE_UI)) {
                addLaunch = false;
            }
        } catch (CoreException e1) {
            GWTPluginLog.logError(e1);
        }
    }

    if (addLaunch) {
        /*
         * Add the launch to the DevMode view. This is tightly coupled because at
         * the time of ILaunchListener's changed callback, the launch's process
         * does not have a command-line set. Unfortunately there isn't another
         * listener to solve our needs, so we add this glue here.
         */
        WebAppDebugModel.getInstance().addOrReturnExistingLaunchConfiguration(launch, null, null);
    }

    super.launch(configuration, mode, launch, monitor);
}

From source file:org.jboss.tools.maven.gwt.MavenGWTPlugin.java

License:Open Source License

public void start(BundleContext bundleContext) throws Exception {
    MavenGWTPlugin.context = bundleContext;
    listener = new MavenGwtDebugModeListener();
    WebAppDebugModel.getInstance().addWebAppDebugModelListener(listener);
}

From source file:org.jboss.tools.maven.gwt.MavenGWTPlugin.java

License:Open Source License

public void stop(BundleContext bundleContext) throws Exception {
    MavenGWTPlugin.context = null;
    WebAppDebugModel.getInstance().removeWebAppDebugModelListener(listener);
}