<commit_before>package gui.listener;

import gui.Gui;
import gui.frame.MainFrame;
import gui.input.Button;
import gui.panel.InputPanel;
import gui.util.FileBrowser;
import gui.util.ReadFile;
import w2d.parser.W2D;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;

public class ButtonListener implements MouseListener {

	private static W2D w2d;

	@Override
	public void mouseClicked(MouseEvent e) {
		Button button = (Button) e.getSource();

		if (button == InputPanel.chooseFileButton) {
			String directory = new FileBrowser().getSelectedDirectory();

			if (directory != null) {
				String script = ReadFile.getText(directory);

				w2d = new W2D(script);
				w2d.readTheScript();

				List<String> errors = w2d.getParsingErrors();

				if (!errors.isEmpty()) {
					Gui.showErrors(errors);
				} else {
					Gui.showQuestions(w2d.getQuestions());
				}
			}
		} else if (button == InputPanel.submitButton) {
			MainFrame.inputPanel.collectAnswers();

			Gui.showActivities(w2d.getActivitiesToShow());
		} else if (button == InputPanel.backButton){
            MainFrame.inputPanel.resetView();
            MainFrame.outputPanel.resetView();
        }

	}
<commit_msg>Back button to clean input panel and browse script again<commit_after>package gui.listener;

import gui.Gui;
import gui.frame.MainFrame;
import gui.input.Button;
import gui.panel.InputPanel;
import gui.util.FileBrowser;
import gui.util.ReadFile;
import w2d.parser.W2D;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;

public class ButtonListener implements MouseListener {

	private static W2D w2d;

	@Override
	public void mouseClicked(MouseEvent e) {
		Button button = (Button) e.getSource();

		if (button == InputPanel.chooseFileButton) {
			String directory = new FileBrowser().getSelectedDirectory();

			if (directory != null) {
				String script = ReadFile.getText(directory);

				w2d = new W2D(script);
				w2d.readTheScript();

				List<String> errors = w2d.getParsingErrors();

				if (!errors.isEmpty()) {
					Gui.showErrors(errors);
				} else {
					Gui.showQuestions(w2d.getQuestions());
				}
			}
		} else if (button == InputPanel.submitButton) {
			MainFrame.inputPanel.collectAnswers();

			Gui.showActivities(w2d.getActivitiesToShow());
		} else if (button == InputPanel.backButton){
            MainFrame.inputPanel.resetView();
            MainFrame.outputPanel.resetView();
            w2d.resetParsers();
        }

	}

{'fraction_non_alphanumeric': 0.118772419290554, 'fraction_numerical': 0.008369868473495417, 'mean_word_length': 3.7718631178707223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5433454', 'n_tokens_mistral': 901, 'n_tokens_neox': 787, 'n_words': 164}