use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.
the class EmfObserveTypeContainer method createList.
AstObjectInfo createList(AstEditor editor, Expression[] arguments, int startIndex) throws Exception {
// prepare object
EObjectBindableInfo eObject = getEObject(arguments[startIndex]);
if (eObject == null) {
AbstractParser.addError(editor, MessageFormat.format(Messages.EmfObserveTypeContainer_argumentNotFound, arguments[startIndex]), new Throwable());
return null;
}
// prepare property
EPropertyBindableInfo eProperty = getEProperty(eObject, arguments[startIndex + 1]);
// create observable
ObservableInfo observable = new ListEmfObservableInfo(eObject, eProperty);
observable.setCodeSupport(new EmfObservableListCodeSupport());
//
return observable;
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method filterElementPropertiesForTreeViewerInput.
@Override
public void filterElementPropertiesForTreeViewerInput(ObservableInfo inputObservable, Class<?> elementType, List<PropertyDescriptor> descriptors) throws Exception {
if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
descriptors.clear();
PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
for (PropertyInfo emfProperty : propertiesSupport.getProperties(elementType)) {
descriptors.add(createProperty(emfProperty.name, emfProperty.type));
}
}
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method createObserveMaps.
@Override
public MapsBeanObservableInfo createObserveMaps(ObservableInfo inputObservable, ObservableInfo domainObservable, Class<?> elementType, boolean[] useViewerSupport) throws Exception {
if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
useViewerSupport[0] = false;
MapsEmfObservableInfo observeMaps = new MapsEmfObservableInfo(domainObservable, getPropertiesSupport(inputObservable));
observeMaps.setElementType(elementType);
return observeMaps;
}
return null;
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo in project windowbuilder by eclipse.
the class GlobalObservableFactory method configureChooseElementForViewerInput.
// //////////////////////////////////////////////////////////////////////////
//
// IGlobalObservableFactory: UI
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void configureChooseElementForViewerInput(ObservableInfo inputObservable, ChooseClassAndPropertiesConfiguration configuration) throws Exception {
if (inputObservable instanceof ListEmfObservableInfo || inputObservable instanceof DetailListEmfObservableInfo) {
final PropertiesSupport propertiesSupport = getPropertiesSupport(inputObservable);
configuration.setBaseClassName("org.eclipse.emf.ecore.EObject");
configuration.addPropertiesFilter(new IPropertiesFilter() {
@Override
public List<PropertyAdapter> filterProperties(Class<?> choosenClass, List<PropertyAdapter> properties) throws Exception {
properties = Lists.newArrayList();
for (PropertyInfo emfPropertyInfo : propertiesSupport.getProperties(choosenClass)) {
properties.add(new ChooseClassAndTreePropertiesUiContentProvider.ObservePropertyAdapter(null, new EPropertyBindableInfo(propertiesSupport, null, emfPropertyInfo.type, emfPropertyInfo.name, "\"" + emfPropertyInfo.name + "\"")));
}
return properties;
}
});
}
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo 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