Search in sources :

Example 1 with EPropertyBindableInfo

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;
}
Also used : EObjectBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo) MapsEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo) ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) KnownElementsObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo) ValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) EmfObservableListCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableListCodeSupport) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)

Example 2 with EPropertyBindableInfo

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;
}
Also used : EObjectBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo) MapsEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo) ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) ListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo) DetailListEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo) KnownElementsObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo) ValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo) DetailValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo) ValueEmfObservableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo) EmfObservableValueCodeSupport(org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableValueCodeSupport)

Example 3 with EPropertyBindableInfo

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;
        }
    });
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) EObjectBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo) ChooseClassAndPropertiesConfiguration(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration) ObservableDetailUiContentProvider(org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ObservableDetailUiContentProvider) List(java.util.List) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo) PropertyInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo)

Example 4 with EPropertyBindableInfo

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;
}
Also used : ObservableInfo(org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo) EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)

Example 5 with EPropertyBindableInfo

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;
}
Also used : EPropertyBindableInfo(org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)

Aggregations

EPropertyBindableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EPropertyBindableInfo)6 EObjectBindableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.EObjectBindableInfo)3 DetailListEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailListEmfObservableInfo)3 ListEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ListEmfObservableInfo)3 ObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo)3 List (java.util.List)2 PropertyInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport.PropertyInfo)2 DetailValueEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.DetailValueEmfObservableInfo)2 MapsEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.MapsEmfObservableInfo)2 ValueEmfObservableInfo (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.ValueEmfObservableInfo)2 KnownElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo)2 IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)1 ChooseClassAndPropertiesConfiguration (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration)1 IPropertiesFilter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesConfiguration.IPropertiesFilter)1 PropertyAdapter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter)1 PropertiesSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.bindables.PropertiesSupport)1 EmfObservableListCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableListCodeSupport)1 EmfObservableValueCodeSupport (org.eclipse.wb.internal.rcp.databinding.emf.model.observables.EmfObservableValueCodeSupport)1 ObservableDetailUiContentProvider (org.eclipse.wb.internal.rcp.databinding.ui.contentproviders.ObservableDetailUiContentProvider)1