void (Project project, List<TestDataFile> filePaths, RelativePoint point) { filePaths.sort(Comparator.comparing(TestDataFile::getName, String.CASE_INSENSITIVE_ORDER)); List<TestDataNavigationElement> elementsToDisplay = new ArrayList<>(); List<TestDataNavigationElement> nonExistingElementsToDisplay = new ArrayList<>(); Set<TestDataFile> files = new HashSet<>(); for (TestDataFile testDataFile : filePaths) { if (!testDataFile.exists()) { if (nonExistingElementsToDisplay.isEmpty()) { nonExistingElementsToDisplay.add(TestDataNavigationElementFactory.createForCreateMissingFilesOption(filePaths)); } nonExistingElementsToDisplay.add(TestDataNavigationElementFactory.createForNonExistingFile(project, testDataFile)); } else { files.add(testDataFile); } } consumeElementsToDisplay(project, files, elementsToDisplay::add); elementsToDisplay.addAll(nonExistingElementsToDisplay); JList<TestDataNavigationElement> list = new JBList<>(elementsToDisplay); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setCellRenderer(new ColoredListCellRenderer<>() { @Override protected void customizeCellRenderer(@NotNull JList list, TestDataNavigationElement element, int index, boolean selected, boolean hasFocus) { element.getTitleFragments().forEach(pair -> append(pair.getFirst(), pair.getSecond())); setIcon(element.getIcon()); } }); JBPopupFactory.getInstance() .createListPopupBuilder(list) .setNamerForFiltering(element -> Objects.requireNonNull(ContainerUtil.getFirstItem(element.getTitleFragments())).first) .setItemChosenCallback(() -> { TestDataNavigationElement selectedElement = list.getSelectedValue(); if (selectedElement != null) { selectedElement.performAction(project); } }).setTitle(DevKitBundle.message("testdata.popup.navigation.title")).createPopup().show(point); }