use of org.apache.netbeans.modules.python4nb.util.ValidationResult 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;
}
use of org.apache.netbeans.modules.python4nb.util.ValidationResult in project python4nb by ebresie.
the class PythonExecutable method forPath.
@CheckForNull
public static PythonExecutable forPath(String path) {
ValidationResult result = new ValidationResult();
ValidationUtils.validatePython(result, path);
;
if (validateResult(result) != null) {
return null;
}
return createExecutable(path, null);
}
use of org.apache.netbeans.modules.python4nb.util.ValidationResult in project python4nb by ebresie.
the class PythonCustomizerPanel method validateData.
void validateData() {
ValidationResult result = new PythonPreferencesValidator().validateCustomizer(pythonEnabled, defaultPython, python, pythonPathPanel.getPythonSources(), debugPort).getResult();
if (result.hasErrors()) {
category.setErrorMessage(result.getFirstErrorMessage());
category.setValid(false);
return;
}
if (result.hasWarnings()) {
category.setErrorMessage(result.getFirstWarningMessage());
category.setValid(true);
return;
}
category.setErrorMessage(null);
category.setValid(true);
}
use of org.apache.netbeans.modules.python4nb.util.ValidationResult in project python4nb by ebresie.
the class PythonExecutable method forProjectInternal.
@CheckForNull
private static PythonExecutable forProjectInternal(@NullAllowed Project project, boolean showCustomizer) {
if (project == null) {
return getDefault(null, showCustomizer);
}
PythonPreferences preferences = PythonSupport.forProject(project).getPreferences();
if (preferences.isDefaultPython()) {
return getDefault(project, showCustomizer);
}
String node = preferences.getPython();
ValidationResult result = new PythonPreferencesValidator().validateNode(node).getResult();
if (validateResult(result) != null) {
if (showCustomizer) {
PythonCustomizerProvider.openCustomizer(project, result);
}
return null;
}
assert node != null;
return createExecutable(node, project);
}
Aggregations