void (JList<InspectionPattern> list) { final List<InspectionPattern> patterns = myConfiguration.getPatterns(); for (InspectionPattern pattern : list.getSelectedValuesList()) { myConfiguration.removePattern(pattern); } final int size = patterns.size(); final int maxIndex = list.getMaxSelectionIndex(); if (maxIndex != list.getMinSelectionIndex()) { list.setSelectedIndex(maxIndex); } ((MyListModel)list.getModel()).fireContentsChanged(list); if (list.getSelectedIndex() >= size) { list.setSelectedIndex(size - 1); } final int index = list.getSelectedIndex(); list.scrollRectToVisible(list.getCellBounds(index, index)); saveChangesToProfile(list); }