JPanel (final List<String> list, final @NlsContexts.Label String borderTitle, final boolean acceptPatterns, final Predicate<? super PsiClass> isApplicable) { @SuppressWarnings("Convert2Diamond") SortedListModel<String> listModel = new SortedListModel<String>(Comparator.naturalOrder()); for (String s : list) { listModel.add(s); } listModel.addListDataListener(new ListDataListener() { @Override public void intervalAdded(ListDataEvent e) { listChanged(); } private void listChanged() { list.clear(); for (int i = 0; i < listModel.getSize(); i++) { list.add(listModel.getElementAt(i)); } } @Override public void intervalRemoved(ListDataEvent e) { listChanged(); } @Override public void contentsChanged(ListDataEvent e) { listChanged(); } }); return createSpecialAnnotationsListControl(borderTitle, acceptPatterns, listModel, isApplicable); }