SdkListModel () { ImmutableList.Builder<SdkListItem> newModel = ImmutableList.builder(); if (myNoneSdkItem != null) { newModel.add(myNoneSdkItem); } if (myProjectSdkItem != null) { Sdk projectSdk = mySdkModel.getProjectSdk(); if (projectSdk == null || mySdkFilter.value(projectSdk)) { newModel.add(myProjectSdkItem); } } if (myInvalidItem != null) { newModel.add(myInvalidItem); } newModel.addAll(myReferenceItems); newModel.addAll(myHead); ImmutableList<ActionItem> subItems = ImmutableList.<ActionItem>builder() .addAll(myDownloadActions) .addAll(myAddActions) .build(); if (subItems.size() > 3 && !newModel.build().isEmpty()) { newModel.add(new GroupItem(AllIcons.General.Add, ProjectBundle.message("combobox.item.add.sdk"), subItems)); } else { newModel.addAll(subItems); } for (SuggestedItem item : mySuggestions) { if (!isApplicableSuggestedItem(item)) continue; newModel.add(item); } return new SdkListModel(myIsSdkDetectorInProgress, newModel.build(), () -> mySdkModel.getProjectSdk()); }