Search in sources :

Example 1 with InputException

use of com.intellij.openapi.ui.InputException in project intellij-community by JetBrains.

the class PServerSettingsPanel method saveTo.

public void saveTo(CvsApplicationLevelConfiguration config) {
    final String pathToPasswordFile = CvsApplicationLevelConfiguration.convertToIOFilePath(myPathToPasswordFile.getText());
    final File passwordFile = new File(pathToPasswordFile);
    if (!passwordFile.exists()) {
        final int result = Messages.showYesNoDialog(myPanel, CvsBundle.message("message.password.file.does.not.exist", pathToPasswordFile), CvsBundle.message("title.password.file.does.not.exist"), Messages.getQuestionIcon());
        if (result == Messages.NO) {
            throw new InputException(myPathToPasswordFile);
        }
        try {
            passwordFile.createNewFile();
        } catch (IOException e) {
            throw new InputException(e.getMessage(), myPathToPasswordFile);
        }
    }
    config.setPathToPasswordFile(pathToPasswordFile);
    try {
        final int timeout = Integer.parseInt(myTimeout.getText());
        if (timeout < 0) {
            throwInvalidTimeoutException();
        }
        config.TIMEOUT = timeout;
    } catch (NumberFormatException ex) {
        throwInvalidTimeoutException();
    }
}
Also used : InputException(com.intellij.openapi.ui.InputException) IOException(java.io.IOException) File(java.io.File)

Aggregations

InputException (com.intellij.openapi.ui.InputException)1 File (java.io.File)1 IOException (java.io.IOException)1