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

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

Introduction

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

Prototype

public static GWTRuntime findSdkFor(IJavaProject javaProject) 

Source Link

Document

Finds the GWTRuntime used by the specified project.

Usage

From source file:com.google.gdt.eclipse.maven.launch.MavenClasspathProvider.java

License:Open Source License

private static void addGwtDevjarIfPossible(IJavaProject proj, Set<IRuntimeClasspathEntry> classpath)
        throws CoreException {
    GWTRuntime runtime = GWTRuntime.findSdkFor(proj);
    IStatus validationStatus = runtime.validate();
    if (!validationStatus.isOK()) {
        throw new CoreException(validationStatus);
    }/*from ww w .  jav  a2 s.c  om*/

    try {
        if (runtime != null) {
            IPath devJarPath = Path.fromOSString(runtime.getDevJar().getAbsolutePath());
            IRuntimeClasspathEntry devJarCpEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(devJarPath);
            classpath.add(devJarCpEntry);
        } else {
            Activator.getDefault().getLog().log(
                    new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to find a GWT Runtime for project "
                            + proj.getElementName() + ". Cannot add gwt-dev to the runtime classpath."));
        }
    } catch (SdkException sdke) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                "Unable to add gwt-dev.jar to the runtime classpath.", sdke));
    }
}

From source file:com.myeclipsedev.gdt.eclipse.ui.internal.wizard.WebComponentExportPage.java

License:Open Source License

private boolean areMultipleModulesAllowed() {
    try {/*from w w w. ja v  a2s  .c  o  m*/
        IJavaProject javaProject = JavaCore.create(project);
        if (javaProject != null) {
            GWTRuntime sdk = GWTRuntime.findSdkFor(javaProject);
            if (sdk != null) {
                return new GwtCapabilityChecker(sdk).doesCompilerAllowMultipleModules();
            }
        }
    } catch (JavaModelException e) {
        GWTPluginLog.logError(e);
    }
    return false;
}