Package org.eclipse.core.databinding
Class AggregateValidationStatus
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.value.AbstractObservableValue<T>
org.eclipse.core.databinding.observable.value.ComputedValue<IStatus>
org.eclipse.core.databinding.AggregateValidationStatus
- All Implemented Interfaces:
IObservable
,IObservableValue<IStatus>
This class can be used to aggregate status values from a data binding context
into a single status value. Instances of this class can be used as an
observable value with a value type of
IStatus
, or the static methods
can be called directly if an aggregated status result is only needed once.- Since:
- 1.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant denoting an aggregation strategy that always returns the most severe status from the given validation status providers.static final int
Constant denoting an aggregation strategy that merges multiple non-OK status objects in aMultiStatus
. -
Constructor Summary
ConstructorDescriptionAggregateValidationStatus
(DataBindingContext dbc, int strategy) Creates a new aggregate validation status observable for the given data binding context.AggregateValidationStatus
(IObservableCollection<? extends ValidationStatusProvider> validationStatusProviders, int strategy) AggregateValidationStatus
(Realm realm, IObservableCollection<? extends ValidationStatusProvider> validationStatusProviders, int strategy) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(Object listenerType, IObservablesListener listener) protected IStatus
Subclasses must override this method to provide the object's value.protected Object
clone()
protected void
fireEvent
(ObservableEvent event) protected void
getRealm()
static IStatus
getStatusMaxSeverity
(Collection<? extends ValidationStatusProvider> validationStatusProviders) Returns a status that always returns the most severe status from the given validation status providers.static IStatus
getStatusMerged
(Collection<? extends ValidationStatusProvider> validationStatusProviders) Returns a status object that merges multiple non-OK status objects in aMultiStatus
.protected void
protected void
removeListener
(Object listenerType, IObservablesListener listener) Methods inherited from class org.eclipse.core.databinding.observable.value.ComputedValue
addChangeListener, addValueChangeListener, create, dispose, doGetValue, getValueType, hasListeners, isStale, makeDirty
Methods inherited from class org.eclipse.core.databinding.observable.value.AbstractObservableValue
doSetValue, fireChange, fireValueChange, getValue, removeValueChangeListener, setValue
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
-
Field Details
-
MERGED
public static final int MERGEDConstant denoting an aggregation strategy that merges multiple non-OK status objects in aMultiStatus
. Returns an OK status result if all statuses from the given validation status providers are the an OK status. Returns a single status if there is only one non-OK status. -
MAX_SEVERITY
public static final int MAX_SEVERITYConstant denoting an aggregation strategy that always returns the most severe status from the given validation status providers. If there is more than one status at the same severity level, it picks the first one it encounters.
-
-
Constructor Details
-
AggregateValidationStatus
Creates a new aggregate validation status observable for the given data binding context.- Parameters:
dbc
- a data binding contextstrategy
- a strategy constant, one ofMERGED
orMAX_SEVERITY
.- Since:
- 1.1
-
AggregateValidationStatus
public AggregateValidationStatus(IObservableCollection<? extends ValidationStatusProvider> validationStatusProviders, int strategy) - Parameters:
validationStatusProviders
- an observable collection containing elements of typeValidationStatusProvider
strategy
- a strategy constant, one ofMERGED
orMAX_SEVERITY
.- See Also:
-
AggregateValidationStatus
public AggregateValidationStatus(Realm realm, IObservableCollection<? extends ValidationStatusProvider> validationStatusProviders, int strategy) - Parameters:
realm
- RealmvalidationStatusProviders
- an observable collection containing elements of typeValidationStatusProvider
strategy
- a strategy constant, one ofMERGED
orMAX_SEVERITY
.- Since:
- 1.1
- See Also:
-
-
Method Details
-
calculate
Description copied from class:ComputedValue
Subclasses must override this method to provide the object's value. Any dependencies used to calculate the value must beIObservable
, and implementers must use one of the interface methods tagged TrackedGetter for ComputedValue to recognize it as a dependency.- Specified by:
calculate
in classComputedValue<IStatus>
- Returns:
- the object's value
-
getStatusMerged
public static IStatus getStatusMerged(Collection<? extends ValidationStatusProvider> validationStatusProviders) Returns a status object that merges multiple non-OK status objects in aMultiStatus
. Returns an OK status result if all statuses from the given validation status providers are the an OK status. Returns a single status if there is only one non-OK status.- Parameters:
validationStatusProviders
- a collection of validation status providers- Returns:
- a merged status
-
getStatusMaxSeverity
public static IStatus getStatusMaxSeverity(Collection<? extends ValidationStatusProvider> validationStatusProviders) Returns a status that always returns the most severe status from the given validation status providers. If there is more than one status at the same severity level, it picks the first one it encounters.- Parameters:
validationStatusProviders
- a collection of validation status providers- Returns:
- a single status reflecting the most severe status from the given validation status providers
-
addListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to add; notnull
-
removeListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to remove; notnull
-
fireEvent
-
firstListenerAdded
protected void firstListenerAdded() -
lastListenerRemoved
protected void lastListenerRemoved() -
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-