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

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

Introduction

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

Prototype

public static GWTRuntime getDefaultRuntime() 

Source Link

Usage

From source file:com.google.gdt.eclipse.appengine.rpc.wizards.helpers.RpcServiceLayerCreator.java

License:Open Source License

private String getGwtContainerPath(IJavaProject javaProject) throws CoreException {
    IClasspathEntry[] entries = null;//from   ww  w . j  a  va  2s. com

    entries = javaProject.getRawClasspath();

    for (IClasspathEntry entry : entries) {
        if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER
                && entry.getPath().toString().equals("com.google.gwt.eclipse.core.GWT_CONTAINER")) { //$NON-NLS-N$
            IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
            if (container instanceof GWTRuntimeContainer) {
                IPath path = ((GWTRuntimeContainer) container).getSdk().getInstallationPath();
                return path.toString();
            }
        }
    }
    // gwt not on classpath, add to it, set nature
    GWTRuntime gwt = GWTPreferences.getDefaultRuntime();
    IPath containerPath = SdkClasspathContainer.computeContainerPath(GWTRuntimeContainer.CONTAINER_ID, gwt,
            SdkClasspathContainer.Type.DEFAULT);
    if (GaeNature.isGaeProject(javaProject.getProject())) {
        addClasspathContainer(javaProject, containerPath);
        GWTNature.addNatureToProject(javaProject.getProject());
    }
    return gwt.getInstallationPath().toString();
}