Example usage for com.google.gwt.eclipse.core.preferences GWTPreferences setSdks

List of usage examples for com.google.gwt.eclipse.core.preferences GWTPreferences setSdks

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.preferences GWTPreferences setSdks.

Prototype

public static void setSdks(SdkSet<GWTRuntime> sdkSet) 

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  ww . j ava  2s  .co m*/
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);
    }
}

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

License:Open Source License

public static void removeDefaultRuntime() {
    SdkSet<GWTRuntime> sdkSet = GWTPreferences.getSdks();
    sdkSet.remove(sdkSet.getDefault());
    GWTPreferences.setSdks(sdkSet);
}