<commit_before>package ui;

import java.util.concurrent.CompletableFuture;

import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class EditGroupDialog implements Dialog<TurboLabelGroup> {
	
	private final Stage parentStage;

	private CompletableFuture<TurboLabelGroup> response;

	private String generatedName;
	private boolean exclusive;
	
	private boolean showExclusiveCheckbox = true;

	public EditGroupDialog(Stage parentStage, TurboLabelGroup group) {
		this.parentStage = parentStage;
		this.generatedName = group.getValue();
		this.exclusive = group.isExclusive();

		response = new CompletableFuture<>();
	}
	
	public EditGroupDialog setExclusiveCheckboxVisible(boolean visible) {
		showExclusiveCheckbox = visible;
		return this;
	}
	
	public CompletableFuture<TurboLabelGroup> show() {
		showDialog();
		return response;
	}

	private void showDialog() {

		VBox layout = new VBox();
		layout.setPadding(new Insets(15));
		layout.setSpacing(10);
		
		Scene scene = new Scene(layout, 330, 90);

		Stage stage = new Stage();

		Platform.runLater(() -> stage.requestFocus());
		
		Button close = new Button("Close");
		HBox buttonContainer = new HBox();
		buttonContainer.setAlignment(Pos.CENTER_RIGHT);
		buttonContainer.getChildren().add(close);
		HBox.setHgrow(buttonContainer, Priority.ALWAYS);
		
		CheckBox checkbox = new CheckBox("Exclusive");
		checkbox.setSelected(exclusive);
		checkbox.setDisable(!showExclusiveCheckbox);
				
		HBox checkBoxContainer = new HBox();
		checkBoxContainer.setAlignment(Pos.CENTER_LEFT);
		checkBoxContainer.getChildren().add(checkbox);
		HBox.setHgrow(checkBoxContainer, Priority.ALWAYS);
		
		HBox bottomContainer = new HBox();
		bottomContainer.getChildren().addAll(checkBoxContainer, buttonContainer);
		
		TextField groupNameField = new TextField();
		groupNameField.setText(generatedName);
		
		layout.getChildren().addAll(groupNameField, bottomContainer);

		stage.setTitle("New Group");
		stage.setScene(scene);
		stage.setOnCloseRequest(e -> {
			respond(groupNameField.getText(), showExclusiveCheckbox ? checkbox.isSelected() : exclusive);
		});
		stage.initOwner(parentStage);
//		 secondStage.initModality(Modality.APPLICATION_MODAL);

		close.setOnAction(e -> {
			respond(groupNameField.getText(), showExclusiveCheckbox ? checkbox.isSelected() : exclusive);
			stage.close();
		});

		stage.setX(parentStage.getX());
		stage.setY(parentStage.getY());

		stage.show();
	}

	private void respond(String name, boolean exclusive) {
		TurboLabelGroup res = new TurboLabelGroup(name);
		res.setExclusive(exclusive);
		response.complete(res);
	}
}
<commit_msg>When the group dialog is closed, changes will now be discarded<commit_after>package ui;

import java.util.concurrent.CompletableFuture;

import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class EditGroupDialog implements Dialog<TurboLabelGroup> {
	
	private final Stage parentStage;

	private CompletableFuture<TurboLabelGroup> response;

	private String generatedName;
	private boolean exclusive;
	
	private boolean showExclusiveCheckbox = true;

	public EditGroupDialog(Stage parentStage, TurboLabelGroup group) {
		this.parentStage = parentStage;
		this.generatedName = group.getValue();
		this.exclusive = group.isExclusive();

		response = new CompletableFuture<>();
	}
	
	public EditGroupDialog setExclusiveCheckboxVisible(boolean visible) {
		showExclusiveCheckbox = visible;
		return this;
	}
	
	public CompletableFuture<TurboLabelGroup> show() {
		showDialog();
		return response;
	}

	private void showDialog() {

		VBox layout = new VBox();
		layout.setPadding(new Insets(15));
		layout.setSpacing(10);
		
		Scene scene = new Scene(layout, 330, 90);

		Stage stage = new Stage();

		Platform.runLater(() -> stage.requestFocus());
		
		Button close = new Button("Close");
		HBox buttonContainer = new HBox();
		buttonContainer.setAlignment(Pos.CENTER_RIGHT);
		buttonContainer.getChildren().add(close);
		HBox.setHgrow(buttonContainer, Priority.ALWAYS);
		
		CheckBox checkbox = new CheckBox("Exclusive");
		checkbox.setSelected(exclusive);
		checkbox.setDisable(!showExclusiveCheckbox);
				
		HBox checkBoxContainer = new HBox();
		checkBoxContainer.setAlignment(Pos.CENTER_LEFT);
		checkBoxContainer.getChildren().add(checkbox);
		HBox.setHgrow(checkBoxContainer, Priority.ALWAYS);
		
		HBox bottomContainer = new HBox();
		bottomContainer.getChildren().addAll(checkBoxContainer, buttonContainer);
		
		TextField groupNameField = new TextField();
		groupNameField.setText(generatedName);
		
		layout.getChildren().addAll(groupNameField, bottomContainer);

		stage.setTitle("New Group");
		stage.setScene(scene);
//		stage.setOnCloseRequest(e -> {
//		});
		stage.initOwner(parentStage);
//		 secondStage.initModality(Modality.APPLICATION_MODAL);

		close.setOnAction(e -> {
			respond(groupNameField.getText(), showExclusiveCheckbox ? checkbox.isSelected() : exclusive);
			stage.close();
		});

		stage.setX(parentStage.getX());
		stage.setY(parentStage.getY());

		stage.show();
	}

	private void respond(String name, boolean exclusive) {
		TurboLabelGroup res = new TurboLabelGroup(name);
		res.setExclusive(exclusive);
		response.complete(res);
	}
}

{'fraction_non_alphanumeric': 0.11353486774304362, 'fraction_numerical': 0.003091721058055651, 'mean_word_length': 5.4129955947136565, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, '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': '3073527', 'n_tokens_mistral': 1928, 'n_tokens_neox': 1709, 'n_words': 342}