Commit ae8d7f2d authored by Piotr Różański's avatar Piotr Różański Committed by Marian Dovgialo

#45479 Fixed file selection dialogs for PsychoPy

parent 726a3366
......@@ -16,7 +16,7 @@
public abstract class SelectFilePanel extends JPanel {
final static int DEFAULT_PATH_COLUMNS_NUMBER = 18;
private JFileChooser fileChooser;
protected final JFileChooser fileChooser;
private JTextField path;
private JLabel pathLabel;
private JButton browseButton;
......@@ -36,7 +36,8 @@
abstract protected JLabel createInfoLabel();
abstract protected String createBorderTitle();
abstract protected int showDialog();
private void initializeUI() {
mainPanel.setLayout(new GridBagLayout());
......@@ -76,7 +77,7 @@ private void connectListeners() {
}
private void onBrowse() {
int returnVal = this.fileChooser.showOpenDialog(this);
int returnVal = this.showDialog();
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = this.fileChooser.getSelectedFile();
this.path.setText(file.getPath());
......
......@@ -39,6 +39,11 @@ protected String createBorderTitle() {
return _("Output: Experiment results");
}
protected int showDialog()
{
return this.fileChooser.showSaveDialog(this);
}
@Override
public void validate(ValidationErrors errors) {
if (this.selectedPath() == null || this.selectedPath().isEmpty()) {
......
......@@ -25,7 +25,12 @@ protected String createBorderTitle()
{
return _("Input: Psychopy procedure");
}
protected int showDialog()
{
return this.fileChooser.showOpenDialog(this);
}
@Override
JFileChooser createFileChooser() {
JFileChooser fileChooser = new JFileChooser();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment