Search in sources :

Example 1 with AppEngineStandardWebApp

use of com.google.cloud.tools.intellij.appengine.descriptor.dom.AppEngineStandardWebApp in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardFacet method getAppEngineStandardWebXml.

@Nullable
public AppEngineStandardWebApp getAppEngineStandardWebXml() {
    XmlFile appengineWebXmlFile = AppEngineAssetProvider.getInstance().loadAppEngineStandardWebXml(getModule().getProject(), ImmutableList.of(getModule()));
    final DomManager domManager = DomManager.getDomManager(getModule().getProject());
    DomFileElement<AppEngineStandardWebApp> appEngineWebXmlDom = domManager.getFileElement(appengineWebXmlFile, AppEngineStandardWebApp.class);
    if (appEngineWebXmlDom == null) {
        return null;
    }
    return appEngineWebXmlDom.getRootElement();
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) DomManager(com.intellij.util.xml.DomManager) AppEngineStandardWebApp(com.google.cloud.tools.intellij.appengine.descriptor.dom.AppEngineStandardWebApp) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with AppEngineStandardWebApp

use of com.google.cloud.tools.intellij.appengine.descriptor.dom.AppEngineStandardWebApp in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineStandardFacet method getRuntimeJavaVersion.

/**
 * Returns the {@link JavaVersion} of the Java runtime, as defined in the {@code
 * appengine-web.xml}.
 *
 * <p>If no runtime is specified in the {@code appengine-web.xml} or if the specified runtime is
 * not valid, {@link JavaVersion#JAVA_1_7} is returned.
 */
public JavaVersion getRuntimeJavaVersion() {
    AppEngineStandardWebApp appEngineStandardWebApp = getAppEngineStandardWebXml();
    if (appEngineStandardWebApp != null) {
        String runtimeString = appEngineStandardWebApp.getRuntime().getStringValue();
        JavaVersion runtimeVersion = RUNTIMES_MAP.get(runtimeString);
        if (runtimeVersion != null) {
            return runtimeVersion;
        }
    }
    // The default runtime is Java 7.
    return JavaVersion.JAVA_1_7;
}
Also used : AppEngineStandardWebApp(com.google.cloud.tools.intellij.appengine.descriptor.dom.AppEngineStandardWebApp) JavaVersion(org.apache.commons.lang3.JavaVersion)

Aggregations

AppEngineStandardWebApp (com.google.cloud.tools.intellij.appengine.descriptor.dom.AppEngineStandardWebApp)2 XmlFile (com.intellij.psi.xml.XmlFile)1 DomManager (com.intellij.util.xml.DomManager)1 JavaVersion (org.apache.commons.lang3.JavaVersion)1 Nullable (org.jetbrains.annotations.Nullable)1