Example usage for com.google.gwt.eclipse.core.launch WebAppLaunchShortcutStrategy WebAppLaunchShortcutStrategy

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

Introduction

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

Prototype

WebAppLaunchShortcutStrategy

Source Link

Usage

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

License:Open Source License

/**
 * Given a resource, figure out what the target URL should be for a launch
 * configuration corresponding to this resource. If the resource has several
 * possible URLs that correspond to it, this method will cause a dialog to pop
 * up, asking the user to choose one. If the resource's project uses GAE but
 * not GWT, return empty string; GAE-only projects have no startup url. If the
 * resource's project uses GWT 2.0+, return empty string since no URL is
 * started in dev mode./*  ww w  .j a va  2 s.c o  m*/
 * 
 * @param resource
 * @throws CoreException
 */
public static String determineStartupURL(IResource resource, boolean isExternalLaunch) throws CoreException {
    ILaunchShortcutStrategy strategy = null;
    IProject project = resource.getProject();

    ExtensionQuery<ILaunchShortcutStrategyProvider> extQuery = new ExtensionQuery<ILaunchShortcutStrategyProvider>(
            GWTPlugin.PLUGIN_ID, "launchShortcutStrategy", "class");
    List<ExtensionQuery.Data<ILaunchShortcutStrategyProvider>> strategyProviderInfos = extQuery.getData();

    for (ExtensionQuery.Data<ILaunchShortcutStrategyProvider> data : strategyProviderInfos) {
        strategy = data.getExtensionPointData().getStrategy(project);
        break;
    }

    if (strategy == null) {

        if (WebAppLaunchUtil.projectIsGaeOnly(project)) {
            return "";
        }

        if (WebAppUtilities.isWebApp(project)) {
            strategy = new WebAppLaunchShortcutStrategy();
        } else {
            assert (GWTNature.isGWTProject(project));
            strategy = new LegacyGWTLaunchShortcutStrategy();
        }
    }

    return strategy.generateUrl(resource, isExternalLaunch);
}