Unterschiede
Hier werden die Unterschiede zwischen der gewählten und der aktuellen Version gezeigt.
| eclipse-rcp:binding 2016/02/11 09:56 | eclipse-rcp:binding 2020/09/25 09:41 aktuell | ||
|---|---|---|---|
| Zeile 232: | Zeile 232: | ||
| } | } | ||
| } | } | ||
| + | </code> | ||
| + | \\ | ||
| + | \\ | ||
| + | \\ | ||
| + | ===== Button-Enablement an Validationstatus binden ===== | ||
| + | <code java> | ||
| + | public void bindButtonEnablementToValidationStatus(final Button button) { | ||
| + | |||
| + | final IObservableValue buttonEnable = SWTObservables.observeEnabled(button); | ||
| + | final IObservableValue validationStatus = | ||
| + | new AggregateValidationStatus(myBindingContext.getValidationRealm(), myBindingContext.getBindings(), AggregateValidationStatus.MAX_SEVERITY); | ||
| + | myBindingContext.bindValue(buttonEnable, | ||
| + | validationStatus, | ||
| + | new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), | ||
| + | new UpdateValueStrategy().setConverter(new Converter(IStatus.class, Boolean.TYPE) { | ||
| + | @Override | ||
| + | public Object convert(final Object fromObject) { | ||
| + | return new Boolean(((IStatus) fromObject).isOK()); | ||
| + | } | ||
| + | })); | ||
| + | } | ||
| </code> | </code> | ||
| \\ | \\ | ||