<commit_before>package app.components;

import java.awt.*;
import javax.swing.*;

/**
 * This class implements the application window.
 */
public class AppWindow extends JFrame {
	public AppWindow(JPanel pane) {
		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // FIXME 
		getContentPane().add(new MainToolbar(), BorderLayout.NORTH);
		getContentPane().add(new DrawingViewport(pane), BorderLayout.CENTER);
		setMinimumSize(new Dimension(600, 480));
		setPreferredSize(new Dimension(800, 600));
		pack();
	}
} // AppWindow<commit_msg>Implemented popup message, when application window is closed.<commit_after>package app.components;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

/**
 * This class implements the application window.
 */
public class AppWindow extends JFrame {
	public AppWindow(JPanel pane) {
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // FIXME 
		
		CloseCheck closeCheck = new CloseCheck();
		this.addWindowListener(closeCheck);
		
		getContentPane().add(new MainToolbar(), BorderLayout.NORTH);
		getContentPane().add(new DrawingViewport(pane), BorderLayout.CENTER);
		setMinimumSize(new Dimension(600, 480));
		setPreferredSize(new Dimension(800, 600));
		pack();
	}
} // AppWindow

class CloseCheck extends WindowAdapter {
	public void windowClosing(WindowEvent e) {
		int optionSelected = JOptionPane.showConfirmDialog(null, "Do you want to save changes?", 
				"Warning!", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
		if (optionSelected == 0) {
			//TODO Call Save Command
			System.exit(0);
		} else if (optionSelected == 1) {
			System.exit(0);
		}
	}
} // CloseCheck
{'fraction_non_alphanumeric': 0.12070006035003017, 'fraction_numerical': 0.016898008449004225, 'mean_word_length': 5.095588235294118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1765048', 'n_tokens_mistral': 569, 'n_tokens_neox': 505, 'n_words': 119}