use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.AbstractViewerInputBindingInfo in project windowbuilder by eclipse.
the class DatabindingsProvider method createObservable.
public ObservableInfo createObservable(IObservableFactory factory, BindableInfo bindable, BindableInfo property, Type type) throws Exception {
boolean version_1_3 = Activator.getStore().getBoolean(IPreferenceConstants.GENERATE_CODE_FOR_VERSION_1_3);
ObservableInfo newObservable = factory.createObservable(bindable, property, type, version_1_3);
//
for (IBindingInfo ibinding : getBindings()) {
if (ibinding instanceof BindingInfo) {
BindingInfo binding = (BindingInfo) ibinding;
// check target
ObservableInfo targetObservable = binding.getTargetObservable();
if (targetObservable.canShared() && binding.getTarget() == bindable && binding.getTargetProperty() == property && targetObservable.getClass() == newObservable.getClass()) {
return targetObservable;
}
// check model
ObservableInfo modelObservable = binding.getModelObservable();
if (modelObservable.canShared() && binding.getModel() == bindable && binding.getModelProperty() == property && modelObservable.getClass() == newObservable.getClass()) {
return modelObservable;
}
} else {
AbstractViewerInputBindingInfo binding = (AbstractViewerInputBindingInfo) ibinding;
// check viewer input
ObservableInfo inputObservable = binding.getInputObservable();
if (inputObservable.canShared() && binding.getModel() == bindable && binding.getModelProperty() == property && inputObservable.getClass() == newObservable.getClass()) {
return inputObservable;
}
}
}
return newObservable;
}
use of org.eclipse.wb.internal.rcp.databinding.model.widgets.input.AbstractViewerInputBindingInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method createDetailObservable.
// //////////////////////////////////////////////////////////////////////////
//
// IGlobalObservableFactory: Observable
//
// //////////////////////////////////////////////////////////////////////////
@Override
public ObservableInfo createDetailObservable(SingleSelectionObservableInfo masterObservable, BindableInfo object, Type type) throws Exception {
if (masterObservable.isViewer()) {
// prepare input
ObservableInfo inputObservable = null;
BindableInfo property = object.resolvePropertyReference("setInput");
for (AbstractBindingInfo binding : object.getBindings()) {
if (binding.getTargetProperty() == property) {
AbstractViewerInputBindingInfo viewerBinding = (AbstractViewerInputBindingInfo) binding;
inputObservable = viewerBinding.getInputObservable();
break;
}
}
// create detail observable
if (inputObservable instanceof ListEmfObservableInfo) {
PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
boolean version_2_5 = propertiesSupport.isEMFProperties();
ObservableInfo observable = null;
//
if (type == Type.OnlyValue) {
observable = new DetailValueEmfObservableInfo(masterObservable, propertiesSupport);
//
if (version_2_5) {
observable.setCodeSupport(new EmfValuePropertyDetailCodeSupport());
} else {
observable.setCodeSupport(new EmfObservableDetailValueCodeSupport());
}
} else if (type == Type.OnlyList) {
observable = new DetailListEmfObservableInfo(masterObservable, propertiesSupport);
//
if (version_2_5) {
observable.setCodeSupport(new EmfListPropertyDetailCodeSupport());
} else {
observable.setCodeSupport(new EmfObservableDetailListCodeSupport());
}
}
return observable;
}
}
return null;
}
Aggregations