IDEA-156888 Simplify JDK setup for new projects: check for jdk validity

This commit is contained in:
Dmitry Avdeev
2017-01-18 17:49:17 +03:00
parent ae2c890c9b
commit c6ca12e09f
@@ -30,7 +30,6 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.ScreenUtil;
@@ -328,14 +327,14 @@ public class JdkComboBox extends ComboBoxWithWidePopup<JdkComboBox.JdkComboBoxIt
}
protected void addSuggestedItems(@Nullable Condition<SdkTypeId> sdkTypeFilter, Sdk[] jdks) {
// todo remove it when unix is supported
if (!SystemInfo.isWindows) return;
SdkType[] types = SdkType.getAllTypes();
for (SdkType type : types) {
if (sdkTypeFilter == null || sdkTypeFilter.value(type) && ContainerUtil.find(jdks, sdk -> sdk.getSdkType() == type) == null) {
Collection<String> paths = type.suggestHomePaths();
for (String path : paths) {
addElement(new SuggestedJdkItem(type, path));
if (path != null && type.isValidSdkHome(path)) {
addElement(new SuggestedJdkItem(type, path));
}
}
}
}