Java Code Examples for org.eclipse.core.databinding.DataBindingContext#getValidationStatusProviders()

The following examples show how to use org.eclipse.core.databinding.DataBindingContext#getValidationStatusProviders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void validateExternalDatabindingContextTargets(final DataBindingContext dbc) {
    if (dbc != null) {
        final IObservableList validationStatusProviders = dbc.getValidationStatusProviders();
        final Iterator iterator = validationStatusProviders.iterator();
        while (iterator.hasNext()) {
            final ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) iterator.next();
            final IObservableValue validationStatus = validationStatusProvider.getValidationStatus();
            if (!(validationStatus instanceof UnmodifiableObservableValue)) {
                final IStatus status = (IStatus) validationStatus.getValue();
                if (status != null) {
                    if (status.getSeverity() == IStatus.OK) {
                        validationStatus.setValue(ValidationStatus.ok());
                    } else if (status.getSeverity() == IStatus.WARNING) {
                        validationStatus.setValue(ValidationStatus.warning(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.INFO) {
                        validationStatus.setValue(ValidationStatus.info(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.ERROR) {
                        validationStatus.setValue(ValidationStatus.error(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.CANCEL) {
                        validationStatus.setValue(ValidationStatus.cancel(status.getMessage()));
                    }
                }
            }
        }
    }
}
 
Example 2
Source File: FlexExistingArtifactDeployPreferencesPanelTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private static IStatus getDeployArtifactPathValidationStatus(
    AppEngineDeployPreferencesPanel panel) {
  DataBindingContext context = panel.getDataBindingContext();
  for (Object provider : context.getValidationStatusProviders()) {
    if (provider instanceof DeployArtifactValidator) {
      IObservableValue value = ((DeployArtifactValidator) provider).getValidationStatus();
      return (IStatus) value.getValue();
    }
  }
  return null;
}
 
Example 3
Source File: FlexDeployPreferencesPanelTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private static IStatus getAppYamlPathValidationStatus(FlexDeployPreferencesPanel panel) {
  DataBindingContext context = panel.getDataBindingContext();
  for (Object provider : context.getValidationStatusProviders()) {
    if (provider instanceof AppYamlValidator) {
      IObservableValue value = ((AppYamlValidator) provider).getValidationStatus();
      return (IStatus) value.getValue();
    }
  }
  return null;
}
 
Example 4
Source File: DialogSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public MaxSeverityValidationStatusProvider(DataBindingContext dbc) {
    super(ValidationStatusProvider.class);
    validationStatusProviders = dbc.getValidationStatusProviders();
}