1414import com .intellij .openapi .options .ConfigurationException ;
1515import com .intellij .openapi .options .SettingsEditor ;
1616import com .intellij .openapi .project .Project ;
17+ import com .intellij .openapi .util .InvalidDataException ;
18+ import com .intellij .openapi .util .WriteExternalException ;
1719import com .microsoft .azure .management .appservice .JavaVersion ;
1820import com .microsoft .azure .management .appservice .OperatingSystem ;
1921import com .microsoft .azure .management .appservice .RuntimeStack ;
2931import lombok .Getter ;
3032import lombok .Setter ;
3133import org .apache .commons .lang3 .StringUtils ;
34+ import org .jdom .Element ;
3235import org .jetbrains .annotations .NotNull ;
3336import org .jetbrains .annotations .Nullable ;
3437
3538import java .util .Map ;
39+ import java .util .Optional ;
3640
3741import static com .microsoft .intellij .ui .messages .AzureBundle .message ;
3842
@@ -43,6 +47,7 @@ public class WebAppConfiguration extends AzureRunConfigurationBase<IntelliJWebAp
4347 private static final String TOMCAT = "tomcat" ;
4448 private static final String JAVA = "java" ;
4549 private static final String JBOSS = "jboss" ;
50+ public static final String JAVA_VERSION = "javaVersion" ;
4651 private final IntelliJWebAppSettingModel webAppSettingModel ;
4752 @ Getter
4853 @ Setter
@@ -71,6 +76,23 @@ public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEn
7176 return new WebAppRunState (getProject (), this );
7277 }
7378
79+ @ Override
80+ public void readExternal (final Element element ) throws InvalidDataException {
81+ super .readExternal (element );
82+ Optional .ofNullable (element .getChild (JAVA_VERSION ))
83+ .map (javaVersionElement -> javaVersionElement .getAttributeValue (JAVA_VERSION ))
84+ .ifPresent (javaVersion -> webAppSettingModel .setJdkVersion (JavaVersion .fromString (javaVersion )));
85+ }
86+
87+ @ Override
88+ public void writeExternal (final Element element ) throws WriteExternalException {
89+ super .writeExternal (element );
90+ Optional .ofNullable (webAppSettingModel .getJdkVersion ())
91+ .map (JavaVersion ::toString )
92+ .map (javaVersion -> new Element (JAVA_VERSION ).setAttribute (JAVA_VERSION , javaVersion ))
93+ .ifPresent (element ::addContent );
94+ }
95+
7496 @ Override
7597 public void validate () throws ConfigurationException {
7698 if (webAppSettingModel .isCreatingNew ()) {
0 commit comments