<commit_before>package ui.components.pickers;

import ui.components.NavigableListView;

import java.util.Optional;

public class LabelListView extends NavigableListView<LabelPicker.Label> {

    private Optional<LabelPicker.Label> previousSelection = Optional.empty();

    public boolean areItemsEqual(LabelPicker.Label item1, LabelPicker.Label item2) {
        return item1.getName().equals(item2.getName());
    }

    public void toggleSelectedItem() {
        if (getSelectedItem().isPresent()) {
            getSelectedItem().get().toggleChecked();
        }
    }

    public void showSelectedItemChange() {
        if (getSelectedItem().isPresent()) {
            if (previousSelection.isPresent()) {
                previousSelection.get().setSelected(false);
            }
            getSelectedItem().get().setSelected(true);
            previousSelection = Optional.of(getSelectedItem().get());
        }
    }

    public void setFirstItem() {
        if (getItems().size() == 0) return;
        getSelectionModel().clearAndSelect(0);
        scrollAndShow(0);
        selectedIndex = Optional.of(0);
        showSelectedItemChange();
    }

    @Override
    protected void setupMouseEvents() {
        setOnMouseClicked(e -> {
            int currentlySelected = getSelectionModel().getSelectedIndex();

            // The currently-selected index is sometimes -1 when an issue is clicked.
            // When this happens we ignore this event.

            if (currentlySelected != -1) {
                selectedIndex = Optional.of(currentlySelected);
                toggleSelectedItem();
            }
        });
    }

}<commit_msg>removed extra mouse events from LabelListView<commit_after>package ui.components.pickers;

import ui.components.NavigableListView;

import java.util.Optional;

public class LabelListView extends NavigableListView<LabelPicker.Label> {

    private Optional<LabelPicker.Label> previousSelection = Optional.empty();
    private LabelPickerDialog labelPickerDialog;

    public LabelListView(LabelPickerDialog labelPickerDialog) {
        this.labelPickerDialog = labelPickerDialog;
    }

    public boolean areItemsEqual(LabelPicker.Label item1, LabelPicker.Label item2) {
        return item1.getName().equals(item2.getName());
    }

    public void toggleSelectedItem() {
        if (getSelectedItem().isPresent()) {
            getSelectedItem().get().toggleChecked();
        }
    }

    public void showSelectedItemChange() {
        if (getSelectedItem().isPresent()) {
            if (previousSelection.isPresent()) {
                previousSelection.get().setSelected(false);
            }
            getSelectedItem().get().setSelected(true);
            previousSelection = Optional.of(getSelectedItem().get());
        }
    }

    public void setFirstItem() {
        if (getItems().size() == 0) return;
        getSelectionModel().clearAndSelect(0);
        scrollAndShow(0);
        selectedIndex = Optional.of(0);
        showSelectedItemChange();
    }

    @Override
    protected void setupMouseEvents() {
        setOnMouseClicked(e -> labelPickerDialog.requestFocus());
    }

    @Override
    protected void setupKeyEvents() {}

}
{'fraction_non_alphanumeric': 0.1091362644215778, 'fraction_numerical': 0.005612722170252572, 'mean_word_length': 2.712962962962963, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3830203', 'n_tokens_mistral': 829, 'n_tokens_neox': 796, 'n_words': 159}