private void create(FileFilter filter, boolean directoryOnly) {
        this.chooser.setDialogType(JFileChooser.OPEN_DIALOG);
        this.chooser.setFileHidingEnabled(true);
        this.chooser.setAcceptAllFileFilterUsed(false);
        this.basePanel.add(this.chooser, BorderLayout.CENTER);

        if (filter != null) {
            this.chooser.setFileFilter(filter);
        }

        if (directoryOnly) {
            this.chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        }

        this.chooser.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent event) {
                JFileChooser jFileChooser = (JFileChooser) event.getSource();
                String command = event.getActionCommand();

                if (command.equals(JFileChooser.APPROVE_SELECTION)) {
                    File selectedFile = jFileChooser.getSelectedFile();
                    Settings.setFilechooserBasepath(selectedFile.toPath());
                    onApprove(selectedFile);
                    dispose();

                } else if (command.equals(JFileChooser.CANCEL_SELECTION)) {
                    onCancel();
                    dispose();
                }
            }
        });

        if (Settings.getFilechooserBasePath() != null) {
            this.chooser.setCurrentDirectory(Settings.getFilechooserBasePath().toFile());
        }
    }