use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo 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.bindables.EPropertyBindableInfo in project windowbuilder by eclipse.
the class EmfObserveTypeContainer method createValue.
AstObjectInfo createValue(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 ValueEmfObservableInfo(eObject, eProperty);
observable.setCodeSupport(new EmfObservableValueCodeSupport());
//
return observable;
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo in project windowbuilder by eclipse.
the class DetailEmfObservableInfo method createContentProviders.
// //////////////////////////////////////////////////////////////////////////
//
// Editing
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void createContentProviders(List<IUiContentProvider> providers, BindingUiContentProviderContext context, DatabindingsProvider provider) throws Exception {
m_masterObservable.createContentProviders(providers, context, provider);
//
ChooseClassAndPropertiesConfiguration configuration = new ChooseClassAndPropertiesConfiguration(getConfiguration());
configuration.setBaseClassName("org.eclipse.emf.ecore.EObject");
//
providers.add(new ObservableDetailUiContentProvider(configuration, this, provider) {
@Override
protected List<PropertyAdapter> getProperties(Class<?> choosenClass) throws Exception {
List<PropertyAdapter> properties = Lists.newArrayList();
for (PropertyInfo emfPropertyInfo : m_propertiesSupport.getProperties(choosenClass)) {
properties.add(new ChooseClassAndTreePropertiesUiContentProvider.ObservePropertyAdapter(null, new EPropertyBindableInfo(m_propertiesSupport, null, emfPropertyInfo.type, emfPropertyInfo.name, emfPropertyInfo.reference)));
}
return properties;
}
@Override
protected void setClassNameAndProperties(Class<?> beanClass, String beanClassName, List<String> properties) throws Exception {
if (beanClassName == null) {
setClassName(CoreUtils.getClassName(beanClass));
} else {
setClassName(beanClassName);
}
//
EObjectBindableInfo eObject = new EObjectBindableInfo(beanClass, null, m_propertiesSupport, null);
//
Object[] adapters = new Object[properties.size()];
for (int i = 0; i < adapters.length; i++) {
adapters[i] = convertPropertyToAdapter(eObject.resolvePropertyReference(properties.get(i)));
}
//
setCheckedAndExpand(adapters);
calculatePropertiesFinish();
}
@Override
protected ObservePropertyAdapter convertPropertyToAdapter(IObserveInfo observe) throws Exception {
if (observe instanceof EPropertyBindableInfo) {
EPropertyBindableInfo property = (EPropertyBindableInfo) observe;
ObservePropertyAdapter adapter = new ObservePropertyAdapter(convertPropertyToAdapter(property.getParent()), property);
adapter.addToParent();
return adapter;
}
return null;
}
});
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo in project windowbuilder by eclipse.
the class EmfPropertiesCodeSupport method createObservable.
protected ObservableInfo createObservable(AstEditor editor, EObjectBindableInfo eObject) throws Exception {
EPropertyBindableInfo eProperty = eObject.resolvePropertyReference(m_parserPropertyReference);
if (eProperty == null) {
AbstractParser.addError(editor, MessageFormat.format(Messages.EmfPropertiesCodeSupport_beanPropertyNotFound, m_parserPropertyReference, eObject.getReference()), new Throwable());
eProperty = new EPropertyBindableInfo(null, null, null, "", "");
}
//
ObservableInfo observable = createObservable(eObject, eProperty);
observable.setCodeSupport(this);
return observable;
}
use of org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo in project windowbuilder by eclipse.
the class EmfObserveTypeContainer method getEProperty.
/**
* @return {@link EPropertyBindableInfo} property that association with given {@link Expression}.
*/
private EPropertyBindableInfo getEProperty(EObjectBindableInfo eObject, Expression expression) throws Exception {
// prepare reference
String reference = CoreUtils.getNodeReference(expression);
// find property
EPropertyBindableInfo eProperty = eObject.resolvePropertyReference(reference);
//
if (eProperty == null) {
eProperty = new EPropertyBindableInfo(null, null, null, "", "");
}
//
return eProperty;
}
Aggregations