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

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

Introduction

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

Prototype

public static SdkSet<GWTRuntime> getSdks() 

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.
 *///  w w w . java  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 GWTJarsRuntime getDefaultRuntime() throws Exception {
    SdkSet<GWTRuntime> sdkSet = GWTPreferences.getSdks();
    if (sdkSet.getDefault() == null) {
        throw new Exception("No default runtime has been set! "
                + "Did you forget to call GwtRuntimeTestUtilities.addDefaultRuntime()?");
    }/*ww  w. j  a  v  a2s .  c o  m*/

    return (GWTJarsRuntime) sdkSet.getDefault();
}

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);
}