void (JList<InspectionPattern> list, boolean up) { final MyListModel model = (MyListModel)list.getModel(); final int index = list.getSelectedIndex(); final List<InspectionPattern> patterns = myConfiguration.getPatterns(); final int newIndex = up ? index - 1 : index + 1; Collections.swap(patterns, index, newIndex); model.fireContentsChanged(list); list.setSelectedIndex(newIndex); saveChangesToProfile(list); }