Skip to content

Commit c5ef562

Browse files
committed
Add eap version to maven versions combobox if working with eap plugin
1 parent 441fb7f commit c5ef562

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

idea/src/org/jetbrains/kotlin/idea/framework/ui/ConfigureDialogWithModulesAndVersion.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
import com.intellij.util.ui.UIUtil;
3535
import org.jetbrains.annotations.NotNull;
3636
import org.jetbrains.annotations.Nullable;
37+
import org.jetbrains.kotlin.idea.KotlinPluginUtil;
38+
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
3739
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator;
40+
import org.jetbrains.kotlin.idea.versions.KotlinRuntimeLibraryUtilKt;
3841

3942
import javax.swing.*;
4043
import java.awt.*;
@@ -51,6 +54,9 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
5154
private static final String VERSIONS_LIST_URL =
5255
"http://search.maven.org/solrsearch/select?q=g:%22org.jetbrains.kotlin%22+AND+a:%22kotlin-runtime%22&core=gav&rows=20&wt=json";
5356

57+
private static final String EAP_VERSIONS_URL =
58+
"https://bintray.com/kotlin/kotlin-eap/kotlin/";
59+
5460
private final ChooseModulePanel chooseModulePanel;
5561

5662
private JPanel contentPane;
@@ -165,6 +171,23 @@ public void run() {
165171
protected static Collection<String> loadVersions() throws Exception {
166172
List<String> versions = Lists.newArrayList();
167173

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+
168191
HttpURLConnection urlConnection = HttpConfigurable.getInstance().openHttpConnection(VERSIONS_LIST_URL);
169192
try {
170193
int timeout = (int) TimeUnit.SECONDS.toMillis(30);

0 commit comments

Comments
 (0)