Search in sources :

Example 1 with PythonOptionsValidator

use of org.apache.netbeans.modules.python4nb.editor.options.PythonOptionsValidator in project python4nb by ebresie.

the class PythonOptionsPanelController method isValid.

@Override
public boolean isValid() {
    assert EventQueue.isDispatchThread();
    PythonOptionsPanel panel = getPanel();
    ValidationResult result = new PythonOptionsValidator().validatePython(panel.getPython(), panel.getPythonSources()).validatePip(panel.getPip()).getResult();
    // errors
    if (result.hasErrors()) {
        panel.setError(result.getFirstErrorMessage());
        return false;
    }
    // warnings
    if (result.hasWarnings()) {
        panel.setWarning(result.getFirstWarningMessage());
        return true;
    }
    // everything ok
    // NOI18N
    panel.setError(" ");
    return true;
}
Also used : PythonOptionsValidator(org.apache.netbeans.modules.python4nb.editor.options.PythonOptionsValidator) ValidationResult(org.apache.netbeans.modules.python4nb.util.ValidationResult)

Aggregations

PythonOptionsValidator (org.apache.netbeans.modules.python4nb.editor.options.PythonOptionsValidator)1 ValidationResult (org.apache.netbeans.modules.python4nb.util.ValidationResult)1