void (Collection<? extends T> elements) { if (elements.isEmpty()) { myTable.clearSelection(); return; } int[] rows = new int[elements.size()]; int index = 0; for (T element : elements) { rows[index++] = myTable.convertRowIndexToView(myTableModel.getElementRow(element)); } TableUtil.selectRows(myTable, rows); TableUtil.scrollSelectionToVisible(myTable); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTable, true)); }