34
34
import com .intellij .util .ui .UIUtil ;
35
35
import org .jetbrains .annotations .NotNull ;
36
36
import org .jetbrains .annotations .Nullable ;
37
+ import org .jetbrains .kotlin .idea .KotlinPluginUtil ;
38
+ import org .jetbrains .kotlin .idea .configuration .ConfigureKotlinInProjectUtilsKt ;
37
39
import org .jetbrains .kotlin .idea .configuration .KotlinProjectConfigurator ;
40
+ import org .jetbrains .kotlin .idea .versions .KotlinRuntimeLibraryUtilKt ;
38
41
39
42
import javax .swing .*;
40
43
import java .awt .*;
@@ -51,6 +54,9 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
51
54
private static final String VERSIONS_LIST_URL =
52
55
"http://search.maven.org/solrsearch/select?q=g:%22org.jetbrains.kotlin%22+AND+a:%22kotlin-runtime%22&core=gav&rows=20&wt=json" ;
53
56
57
+ private static final String EAP_VERSIONS_URL =
58
+ "https://bintray.com/kotlin/kotlin-eap/kotlin/" ;
59
+
54
60
private final ChooseModulePanel chooseModulePanel ;
55
61
56
62
private JPanel contentPane ;
@@ -165,6 +171,23 @@ public void run() {
165
171
protected static Collection <String > loadVersions () throws Exception {
166
172
List <String > versions = Lists .newArrayList ();
167
173
174
+ String bundledRuntimeVersion = KotlinRuntimeLibraryUtilKt .bundledRuntimeVersion (KotlinPluginUtil .getPluginVersion ());
175
+ if (ConfigureKotlinInProjectUtilsKt .isEap (bundledRuntimeVersion )) {
176
+ HttpURLConnection eapConnection = HttpConfigurable .getInstance ().openHttpConnection (EAP_VERSIONS_URL + bundledRuntimeVersion );
177
+ try {
178
+ int timeout = (int ) TimeUnit .SECONDS .toMillis (30 );
179
+ eapConnection .setConnectTimeout (timeout );
180
+ eapConnection .setReadTimeout (timeout );
181
+
182
+ if (eapConnection .getResponseCode () == 200 ) {
183
+ versions .add (bundledRuntimeVersion );
184
+ }
185
+ }
186
+ finally {
187
+ eapConnection .disconnect ();
188
+ }
189
+ }
190
+
168
191
HttpURLConnection urlConnection = HttpConfigurable .getInstance ().openHttpConnection (VERSIONS_LIST_URL );
169
192
try {
170
193
int timeout = (int ) TimeUnit .SECONDS .toMillis (30 );
0 commit comments