Example usage for com.google.gwt.eclipse.core.launch GWTLaunchConfigurationWorkingCopy setStartupUrl

List of usage examples for com.google.gwt.eclipse.core.launch GWTLaunchConfigurationWorkingCopy setStartupUrl

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.launch GWTLaunchConfigurationWorkingCopy setStartupUrl.

Prototype

public static void setStartupUrl(ILaunchConfigurationWorkingCopy workingCopy, String startupUrl) 

Source Link

Usage

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

License:Open Source License

/**
 * @throws CoreException//from www.j  a  va2  s  . com
 * @throws OperationCanceledException
 */
public static ILaunchConfigurationWorkingCopy createLaunchConfigWorkingCopy(String launchConfigName,
        final IProject project, String url, boolean isExternal)
        throws CoreException, OperationCanceledException {

    assert (url != null);

    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = manager.getLaunchConfigurationType(WebAppLaunchConfiguration.TYPE_ID);

    final ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchConfigName);

    setDefaults(wc, project);
    LaunchConfigurationUtilities.setProjectName(wc, project.getName());
    if (isExternal) {
        WebAppLaunchConfigurationWorkingCopy.setRunServer(wc, false);
    }
    GWTLaunchConfigurationWorkingCopy.setStartupUrl(wc, url);

    IPath warDir = null;
    if (WebAppUtilities.hasManagedWarOut(project)) {
        warDir = WebAppUtilities.getManagedWarOut(project).getLocation();
    }

    if (warDir != null) {
        // The processor will update to the proper argument style for the current
        // project nature(s)
        WarArgumentProcessor warArgProcessor = new WarArgumentProcessor();
        warArgProcessor.setWarDirFromLaunchConfigCreation(warDir.toOSString());
        LaunchConfigurationProcessorUtilities.updateViaProcessor(warArgProcessor, wc);
    }
    // Link the launch configuration to the project. This will cause the
    // launch config to be deleted automatically if the project is deleted.
    wc.setMappedResources(new IResource[] { project });

    return wc;
}