void (@NotNull JList<Configuration> list) { boolean metaData = false; for (Configuration configuration : list.getSelectedValuesList()) { if (configuration.getOrder() == 0) { metaData = true; } myConfigurations.remove(configuration); } if (metaData) { myMainConfiguration = moveMetaData(myMainConfiguration, myConfigurations.get(0)); } final int size = myConfigurations.size(); for (int i = 0; i < size; i++){ myConfigurations.get(i).setOrder(i); } 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); }