Example usage for com.google.gwt.eclipse.core.nature GWTNature addNatureToProject

List of usage examples for com.google.gwt.eclipse.core.nature GWTNature addNatureToProject

Introduction

In this page you can find the example usage for com.google.gwt.eclipse.core.nature GWTNature addNatureToProject.

Prototype

public static void addNatureToProject(IProject project) throws CoreException 

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 w  w w.ja  va  2  s  . c  om*/

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