void (@NotNull AbstractListModel<Object> model) { model.addListDataListener(new ListDataListener() { @Override public void intervalAdded(ListDataEvent e) { updateViewType(ViewType.FULL); } @Override public void intervalRemoved(ListDataEvent e) { if (myResultsList.isEmpty() && getSearchPattern().isEmpty()) { updateViewType(ViewType.SHORT); } } @Override public void contentsChanged(ListDataEvent e) { updateViewType(myResultsList.isEmpty() && getSearchPattern().isEmpty() ? ViewType.SHORT : ViewType.FULL); } }); }