DisplayGroup.CLASS_NAME_INDEX), null, null);
myBindingContext.bindList(SWTObservables.observeItems(myEntityCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.ENTITY_LIST), null, null);
myBindingContext.bindValue(SWTObservables.observeEnabled(myMasterDetailGroup), BeansObservables
.observeValue(myDisplayGroup, DisplayGroup.HAS_MASTER_DETAIL), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), null);
UpdateValueStrategy booleanInverse = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE) {
@Override
protected IStatus doSet(final IObservableValue observableValue, final Object value) {
Boolean newValue = !(Boolean) value;
return super.doSet(observableValue, newValue);
}
};
myBindingContext.bindValue(SWTObservables.observeEnabled(myEntityCombo), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.HAS_MASTER_DETAIL),
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), booleanInverse);
myBindingContext.bindValue(CustomSWTObservables.observeText(myEntityCombo), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.ENTITY_NAME), null,
null);
myBindingContext.bindValue(SWTObservables.observeEnabled(myEditingContextText), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.HAS_MASTER_DETAIL), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), booleanInverse);
myBindingContext.bindValue(SWTObservables.observeText(myEditingContextText, SWT.Modify), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.EDITING_CONTEXT), null, null);
myBindingContext.bindValue(SWTObservables.observeSelection(myHasDetailButton), BeansObservables
.observeValue(myDisplayGroup, DisplayGroup.HAS_MASTER_DETAIL), null, null);
myBindingContext.bindList(SWTObservables.observeItems(myMasterEntityCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.ENTITY_LIST), null, null);
myBindingContext.bindValue(CustomSWTObservables.observeText(myMasterEntityCombo), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.MASTER_ENTITY_NAME), null, null);
myBindingContext.bindList(SWTObservables.observeItems(myDetailKeyCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.DETAIL_KEY_LIST), null, null);
myBindingContext.bindValue(CustomSWTObservables.observeText(myDetailKeyCombo), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.DETAIL_KEY_NAME),
null, null);
myBindingContext.bindValue(SWTObservables.observeSelection(myEntriesPerBatchSpinner), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.ENTRIES_PER_BATCH), null, null);
myBindingContext.bindValue(SWTObservables.observeSelection(mySelectsFirstObjectButton), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.SELECTS_FIRST_OBJECT), null, null);
myBindingContext.bindList(SWTObservables.observeItems(myQualificationCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.QUALIFICATION_LIST), null, null);
myBindingContext.bindValue(SWTObservables.observeSingleSelectionIndex(myQualificationCombo), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.QUALIFICATION_INDEX), null, null);
myBindingContext.bindValue(SWTObservables.observeSelection(myFetchOnLoadButton), BeansObservables
.observeValue(myDisplayGroup, DisplayGroup.FETCHES_ON_LOAD), null, null);
myBindingContext.bindList(SWTObservables.observeItems(mySortAttributeCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.SORT_LIST), null, null);
myBindingContext.bindValue(CustomSWTObservables.observeSelection(mySortAttributeCombo), BeansObservables.observeValue(myDisplayGroup,
DisplayGroup.SORT_ORDER_KEY), null, null);
myBindingContext.bindValue(CustomSWTObservables.observeSelection(mySortRadioGroup), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.SORT_ORDER),
null, null);
UpdateValueStrategy fetchSpecEmpty = new UpdateValueStrategy();
fetchSpecEmpty.setConverter(new IConverter() {
public Object convert(final Object fromObject) {
boolean result = fromObject != null && ((List<?>) fromObject).size() > 0;
if (!myHasDetailButton.getSelection()) {
return result;
}
return false;
}
public Object getFromType() {
return new ArrayList<String>();
}
public Object getToType() {
return true;
}
});
UpdateValueStrategy fetchSpecEnabled = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE) {
@Override
protected IStatus doSet(final IObservableValue observableValue, final Object value) {
Boolean newValue = false;
if (myFetchSpecCombo.getItemCount() > 0) {
newValue = !(Boolean) value;
}
return super.doSet(observableValue, newValue);
}
};
myBindingContext.bindValue(SWTObservables.observeEnabled(myFetchSpecCombo), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.HAS_MASTER_DETAIL),
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), fetchSpecEnabled);
myBindingContext.bindValue(SWTObservables.observeEnabled(myFetchSpecCombo), BeansObservables.observeValue(myDisplayGroup, DisplayGroup.FETCH_SPEC_LIST),
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), fetchSpecEmpty);
myBindingContext.bindList(SWTObservables.observeItems(myFetchSpecCombo), BeansObservables.observeList(Realm.getDefault(), myDisplayGroup,
DisplayGroup.FETCH_SPEC_LIST), null, null);
UpdateValueStrategy fetchSpecSelection = new UpdateValueStrategy() {
@Override
protected IStatus doSet(IObservableValue observableValue, Object value) {
if (value == null || value.equals("")) {
value = DisplayGroup.FETCH_SPEC_NONE;
}