<commit_before>package net.korikisulda.gotow;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;

/**
 * Created by Travis (Toyz) on 10/29/2014.
 */
public class GUI extends JFrame {
    private GotoW main;

    public GUI(final GotoW main) {
        this.main = main;
        final JFileChooser fc = new JFileChooser();
        initComponents();

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
        } catch (InstantiationException ex) {
        } catch (IllegalAccessException ex) {
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        }


        sfile.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int returnVal = fc.showOpenDialog(null);

                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    tofind.setText("");
                    File file = fc.getSelectedFile();
                    //This is where a real application would open the file.
                    tofind.setText(file.getAbsolutePath());
                }
            }
        });

        find.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if(!tofind.getText().trim().equals("")){
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            tofind.setEnabled(false);
                            find.setEnabled(false);
                            sfile.setEnabled(false);

                            output.setText("");
                            try {
                                main.command(new String[]{tofind.getText()});
                            } catch (IOException e1) {
                                e1.printStackTrace();
                            }

                            tofind.setEnabled(true);
                            find.setEnabled(true);
                            sfile.setEnabled(true);
                        }
                    }).start();
                }
            }
        });
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        sfile = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        output = new javax.swing.JTextArea();
        find = new javax.swing.JButton();
        tofind = new javax.swing.JTextField();<commit_msg>Added Serial UID, removed unnecessary warning suppression<commit_after>package net.korikisulda.gotow;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;

/**
 * Created by Travis (Toyz) on 10/29/2014.
 */
public class GUI extends JFrame {
	private static final long serialVersionUID = 4259967289409131510L;
	private GotoW main;

    public GUI(final GotoW main) {
        this.main = main;
        final JFileChooser fc = new JFileChooser();
        initComponents();

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
        } catch (InstantiationException ex) {
        } catch (IllegalAccessException ex) {
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        }


        sfile.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                int returnVal = fc.showOpenDialog(null);

                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    tofind.setText("");
                    File file = fc.getSelectedFile();
                    //This is where a real application would open the file.
                    tofind.setText(file.getAbsolutePath());
                }
            }
        });

        find.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if(!tofind.getText().trim().equals("")){
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            tofind.setEnabled(false);
                            find.setEnabled(false);
                            sfile.setEnabled(false);

                            output.setText("");
                            try {
                                main.command(new String[]{tofind.getText()});
                            } catch (IOException e1) {
                                e1.printStackTrace();
                            }

                            tofind.setEnabled(true);
                            find.setEnabled(true);
                            sfile.setEnabled(true);
                        }
                    }).start();
                }
            }
        });
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        sfile = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        output = new javax.swing.JTextArea();
        find = new javax.swing.JButton();
        tofind = new javax.swing.JTextField();
{'fraction_non_alphanumeric': 0.09635907093534213, 'fraction_numerical': 0.006434400502197113, 'mean_word_length': 1.4596680818216905, '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': '5305855', 'n_tokens_mistral': 1635, 'n_tokens_neox': 1565, 'n_words': 350}