Search in sources :

Example 1 with BindingException

use of net.sf.launch4j.binding.BindingException in project cogtool by cogtool.

the class MainFrame method save.

private boolean save() {
    // XXX
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Example 2 with BindingException

use of net.sf.launch4j.binding.BindingException in project chipKIT32-MAX by chipKIT32.

the class MainFrame method save.

private boolean save() {
    // XXX
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Example 3 with BindingException

use of net.sf.launch4j.binding.BindingException in project megameklab by MegaMek.

the class MainFrame method save.

private boolean save() {
    // XXX
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Example 4 with BindingException

use of net.sf.launch4j.binding.BindingException in project beast-mcmc by beast-dev.

the class MainFrame method save.

private boolean save() {
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Example 5 with BindingException

use of net.sf.launch4j.binding.BindingException in project SIMRacingApps by SIMRacingApps.

the class MainFrame method save.

private boolean save() {
    try {
        _configForm.get(ConfigPersister.getInstance().getConfig());
        if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) {
            File f = _fileChooser.getSelectedFile();
            if (!f.getPath().endsWith(".xml")) {
                f = new File(f.getPath() + ".xml");
            }
            ConfigPersister.getInstance().save(f);
            _saved = true;
            showConfigName(f);
            return true;
        }
        return false;
    } catch (InvariantViolationException ex) {
        warn(ex);
        return false;
    } catch (BindingException ex) {
        warn(ex.getMessage());
        return false;
    } catch (ConfigPersisterException ex) {
        warn(ex.getMessage());
        return false;
    }
}
Also used : InvariantViolationException(net.sf.launch4j.binding.InvariantViolationException) ConfigPersisterException(net.sf.launch4j.config.ConfigPersisterException) File(java.io.File) BindingException(net.sf.launch4j.binding.BindingException)

Aggregations

File (java.io.File)5 BindingException (net.sf.launch4j.binding.BindingException)5 InvariantViolationException (net.sf.launch4j.binding.InvariantViolationException)5 ConfigPersisterException (net.sf.launch4j.config.ConfigPersisterException)5