Example usage for com.google.gwt.eclipse.core.runtime GWTRuntime getFactory

List of usage examples for com.google.gwt.eclipse.core.runtime GWTRuntime getFactory

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.runtime GWTRuntime getFactory.

Prototype

public static SdkFactory<GWTRuntime> getFactory() 

Source Link

Usage

From source file:com.google.gwt.eclipse.testing.GwtRuntimeTestUtilities.java

License:Open Source License

/**
 * Adds a default GWT runtime to the {@link GWTPreferences}. Uses the {@code GWT_HOME} environment
 * variable if it is set, otherwise extracts a GWT SDK from this testing bundle and sets
 * {@code GWT_HOME} to the location where it is extracted.
 *///from  w w w.ja v  a2  s . c  om
public static void addDefaultRuntime() throws Exception {
    String gwtHomePath = getGwtTestSdkPath();
    TestEnvironmentUtil.updateEnvironmentVariable("GWT_HOME", gwtHomePath);
    System.out.println("SETTING: GWT_HOME=" + gwtHomePath);

    SdkSet<GWTRuntime> sdkSet = GWTPreferences.getSdks();
    if (sdkSet.getDefault() == null) {
        assert (sdkSet.size() == 0);

        GWTRuntime sdk = GWTRuntime.getFactory().newInstance("Default GWT SDK", new Path(gwtHomePath));
        IStatus status = sdk.validate();
        if (!status.isOK()) {
            throw new CoreException(status);
        }

        sdkSet.add(sdk);
        GWTPreferences.setSdks(sdkSet);
    }
}