<commit_before>package com.example.filelist;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.List;

import static java.util.Arrays.asList;

/**
 * @author innokenty
 */
public class NewFileListDialog extends JDialog {

    private static final List<? extends FileListFactory> FACTORIES = asList(
            new NewLocalFileListPanel(),
            new NewFtpFileListPanel()
    );

    private FileListFactory factory;

    public NewFileListDialog(Component owner) {
        super(JOptionPane.getFrameForComponent(owner));
        setPreferredSize(new Dimension(300, 300));
        setMinimumSize(getPreferredSize());
        setMaximumSize(new Dimension(400, 300));
        setTitle("Please select new tab type");
        setModal(true);

        setLocationRelativeTo(owner);
        setLayout(new BorderLayout());

        final JTabbedPane tabbedPane = new JTabbedPane();
        for (FileListFactory factory : FACTORIES) {
            tabbedPane.add(factory);
        }
        add(tabbedPane, BorderLayout.NORTH);

        JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        bottomPanel.add(new JButton(new AbstractAction("Cancel") {
            @Override
            public void actionPerformed(ActionEvent e) {
                NewFileListDialog.this.dispose();
            }
        }));
        bottomPanel.add(new JButton(new AbstractAction("OK") {
            @Override
            public void actionPerformed(ActionEvent e) {
                NewFileListDialog.this.dispose();
                factory = ((FileListFactory) tabbedPane.getSelectedComponent());
            }
        }));
        add(bottomPanel, BorderLayout.SOUTH);
    }

    public FileList getFileList() throws Exception {
        pack();
        setVisible(true);
        return factory == null ? null : factory.buildFileList();
    }
}
<commit_msg>ref - refact NewFileListDialog<commit_after>package com.example.filelist;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.List;

import static java.util.Arrays.asList;

/**
 * @author innokenty
 */
public class NewFileListDialog extends JDialog {

    private static final List<? extends FileListFactory> FACTORIES = asList(
            new NewLocalFileListPanel(),
            new NewFtpFileListPanel()
    );

    private FileListFactory factory;

    public NewFileListDialog(Component owner) {
        super(JOptionPane.getFrameForComponent(owner));
        setLocationRelativeTo(owner);

        initUIOptions();

        final JTabbedPane tabbedPane = listSelectionPane();
        add(tabbedPane, BorderLayout.NORTH);
        add(bottomPanel(tabbedPane), BorderLayout.SOUTH);
    }

    private void initUIOptions() {
        setPreferredSize(new Dimension(300, 300));
        setMinimumSize(getPreferredSize());
        setMaximumSize(new Dimension(400, 300));
        setTitle("Please select new tab type");
        setModal(true);

        setLayout(new BorderLayout());
    }

    private JTabbedPane listSelectionPane() {
        final JTabbedPane tabbedPane = new JTabbedPane();
        for (FileListFactory factory : FACTORIES) {
            tabbedPane.add(factory);
        }
        return tabbedPane;
    }

    private JPanel bottomPanel(JTabbedPane tabbedPane) {
        JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        bottomPanel.add(cancelButton());
        bottomPanel.add(okButton(tabbedPane));
        return bottomPanel;
    }

    private JButton okButton(final JTabbedPane tabbedPane) {
        return new JButton(new AbstractAction("OK") {
            @Override
            public void actionPerformed(ActionEvent e) {
                NewFileListDialog.this.dispose();
                factory = ((FileListFactory) tabbedPane.getSelectedComponent());
            }
        });
    }

    private JButton cancelButton() {
        return new JButton(new AbstractAction("Cancel") {
            @Override
            public void actionPerformed(ActionEvent e) {
                NewFileListDialog.this.dispose();
            }
        });
    }

    public FileList getFileList() throws Exception {
        pack();
        setVisible(true);
        return factory == null ? null : factory.buildFileList();
    }
}

{'fraction_non_alphanumeric': 0.09749303621169916, 'fraction_numerical': 0.005571030640668524, 'mean_word_length': 2.6028428093645486, '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': '6124756', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1143, 'n_words': 247}