use of org.eclipse.scanning.api.ValidationException in project gda-core by openGDA.
the class TimeSeriesScanView method displayValidationResult.
private void displayValidationResult(Object result, boolean initialValidation) {
if (malcolmModelEditor == null)
return;
final IMalcolmModel malcolmModel = malcolmModelEditor.getModel();
Display.getDefault().asyncExec(() -> {
// note getShell().getDisplay() can throw NPE initially
if (result instanceof ValidationException) {
MessageDialog.openError(getShell(), "Validation Error", "The given configuration is invalid: " + ((Exception) result).getMessage());
} else if (result instanceof Exception) {
logger.error("Error getting malcolm device '{}', {}", malcolmModel.getName(), result);
MessageDialog.openError(getShell(), "Error", "Could not get malcolm device " + malcolmModel.getName());
} else if (!initialValidation) {
// only show message for ok if button pressed
MessageDialog.openInformation(getShell(), "Validation Successful", "The given configuration is valid.");
}
malcolmModelEditor.updateValidatedModel(result instanceof IMalcolmModel ? (IMalcolmModel) result : null);
});
}
Aggregations