MCPcopy Create free account
hub / github.com/FabricMC/Matcher / moveSelectionUp

Method moveSelectionUp

src/main/java/matcher/gui/GuiUtil.java:27–42  ·  view source on GitHub ↗
(ListView<T> list)

Source from the content-addressed store, hash-verified

25 }
26
27 public static <T> void moveSelectionUp(ListView<T> list) {
28 MultipleSelectionModel<T> selection = list.getSelectionModel();
29 List<Integer> selected = new ArrayList<>(selection.getSelectedIndices());
30
31 list.getSelectionModel().clearSelection();
32
33 for (int idx : selected) {
34 if (idx > 0 && !selection.isSelected(idx - 1)) {
35 T e = list.getItems().remove(idx);
36 list.getItems().add(idx - 1, e);
37 selection.select(idx - 1);
38 } else {
39 selection.select(idx);
40 }
41 }
42 }
43
44 public static <T> void moveSelectionDown(ListView<T> list) {
45 MultipleSelectionModel<T> selection = list.getSelectionModel();

Callers 2

initMethod · 0.95

Calls 1

selectMethod · 0.80

Tested by

no test coverage detected