Search in sources :

Example 1 with ObserveInfo

use of org.eclipse.wb.internal.swing.databinding.model.ObserveInfo in project windowbuilder by eclipse.

the class DatabindingsProvider method createBinding.

public IBindingInfo createBinding(IObserveInfo target, IObserveInfo targetProperty, IObserveInfo model, IObserveInfo modelProperty) throws Exception {
    // prepare ObserveInfo's
    ObserveInfo targetObserve = (ObserveInfo) target;
    ObserveInfo targetPropertyObserve = (ObserveInfo) targetProperty;
    ObserveInfo modelObserve = (ObserveInfo) model;
    ObserveInfo modelPropertyObserve = (ObserveInfo) modelProperty;
    // check virtual bindings
    if (targetObserve.getCreationType() == ObserveCreationType.VirtualBinding || modelObserve.getCreationType() == ObserveCreationType.VirtualBinding) {
        return new VirtualBindingInfo(targetObserve, targetPropertyObserve, createProperty(targetObserve, targetPropertyObserve), modelObserve, modelPropertyObserve, createProperty(modelObserve, modelPropertyObserve));
    }
    // check swing bindings
    if (targetObserve.getCreationType() != ObserveCreationType.AutoBinding) {
        IBindingInfo binding = createSwingBinding(targetObserve, targetPropertyObserve, modelObserve, modelPropertyObserve);
        if (binding != null) {
            return binding;
        }
    }
    if (modelObserve.getCreationType() != ObserveCreationType.AutoBinding) {
        IBindingInfo binding = createSwingBinding(modelObserve, modelPropertyObserve, targetObserve, targetPropertyObserve);
        if (binding != null) {
            return binding;
        }
    }
    // auto bindings
    UpdateStrategyInfo strategy = new UpdateStrategyInfo(UpdateStrategyInfo.Value.READ);
    PropertyInfo targetAstProperty = createProperty(targetObserve, targetPropertyObserve);
    PropertyInfo modelAstProperty = createProperty(modelObserve, modelPropertyObserve);
    // 
    return new AutoBindingInfo(strategy, targetObserve, targetPropertyObserve, targetAstProperty, modelObserve, modelPropertyObserve, modelAstProperty);
}
Also used : UpdateStrategyInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.UpdateStrategyInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) AutoBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo) PropertyInfo(org.eclipse.wb.internal.swing.databinding.model.properties.PropertyInfo) VirtualBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo)

Example 2 with ObserveInfo

use of org.eclipse.wb.internal.swing.databinding.model.ObserveInfo in project windowbuilder by eclipse.

the class BeanPropertyObserveInfo method createProperty.

@Override
public PropertyInfo createProperty(ObserveInfo observeObject) throws Exception {
    StringBuffer reference = new StringBuffer(getReference());
    ObserveInfo parent = (ObserveInfo) getParent();
    while (parent != null) {
        reference.insert(0, parent.getReference() + ".");
        parent = (ObserveInfo) parent.getParent();
    }
    return new BeanPropertyInfo(observeObject.getObjectType(), getObjectType(), null, reference.toString());
}
Also used : BeanPropertyInfo(org.eclipse.wb.internal.swing.databinding.model.properties.BeanPropertyInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo)

Example 3 with ObserveInfo

use of org.eclipse.wb.internal.swing.databinding.model.ObserveInfo in project windowbuilder by eclipse.

the class ChooseClassAndPropertiesUiContentProvider method convertAdapterToProperty.

private PropertyInfo convertAdapterToProperty(BeanSupport beanSupport, Class<?> objectClass, ObservePropertyAdapter adapter) throws Exception {
    ClassGenericType objectType = new ClassGenericType(objectClass, null, null);
    ObserveInfo observe = new SubBeanObserveInfo(beanSupport, null, objectType, StringReferenceProvider.EMPTY);
    return adapter.getProperty().createProperty(observe);
}
Also used : ElPropertyObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.ElPropertyObserveInfo) BeanObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.BeanObserveInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) ClassGenericType(org.eclipse.wb.internal.swing.databinding.model.generic.ClassGenericType)

Example 4 with ObserveInfo

use of org.eclipse.wb.internal.swing.databinding.model.ObserveInfo in project windowbuilder by eclipse.

the class ColumnBindingUiContentProvider method getProperties.

private List<PropertyAdapter> getProperties(IGenericType objectType) throws Exception {
    List<PropertyAdapter> adapters = Lists.newArrayList();
    BeanSupport beanSupport = new BeanSupport();
    beanSupport.doAddELProperty(true);
    for (ObserveInfo property : beanSupport.createProperties(null, objectType)) {
        adapters.add(new ObservePropertyAdapter(null, property));
    }
    return adapters;
}
Also used : ElPropertyObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.ElPropertyObserveInfo) BeanObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.BeanObserveInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) BeanSupport(org.eclipse.wb.internal.swing.databinding.model.beans.BeanSupport) PropertyAdapter(org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter)

Example 5 with ObserveInfo

use of org.eclipse.wb.internal.swing.databinding.model.ObserveInfo in project windowbuilder by eclipse.

the class ContentAssistProcessor method createTopProperties.

private List<ObserveInfo> createTopProperties() throws Exception {
    BeanSupport beanSupport = new BeanSupport();
    beanSupport.doAddELProperty(false);
    beanSupport.doAddSelfProperty(false);
    // 
    List<ObserveInfo> properties = beanSupport.createProperties(null, new ClassGenericType(m_propertiesSupport.getTopLevelBean(), null, null));
    return properties;
}
Also used : ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) BeanSupport(org.eclipse.wb.internal.swing.databinding.model.beans.BeanSupport) ClassGenericType(org.eclipse.wb.internal.swing.databinding.model.generic.ClassGenericType)

Aggregations

ObserveInfo (org.eclipse.wb.internal.swing.databinding.model.ObserveInfo)23 IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)13 ClassGenericType (org.eclipse.wb.internal.swing.databinding.model.generic.ClassGenericType)7 ElPropertyObserveInfo (org.eclipse.wb.internal.swing.databinding.model.beans.ElPropertyObserveInfo)6 BeanObserveInfo (org.eclipse.wb.internal.swing.databinding.model.beans.BeanObserveInfo)5 BeanSupport (org.eclipse.wb.internal.swing.databinding.model.beans.BeanSupport)4 IBindingInfo (org.eclipse.wb.internal.core.databinding.model.IBindingInfo)3 PropertyAdapter (org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter)3 ComponentsObserveTypeContainer (org.eclipse.wb.internal.swing.databinding.model.components.ComponentsObserveTypeContainer)2 IGenericType (org.eclipse.wb.internal.swing.databinding.model.generic.IGenericType)2 PropertyInfo (org.eclipse.wb.internal.swing.databinding.model.properties.PropertyInfo)2 PropertyDescriptor (java.beans.PropertyDescriptor)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 StringTokenizer (java.util.StringTokenizer)1 Comment (org.eclipse.jdt.core.dom.Comment)1 LineComment (org.eclipse.jdt.core.dom.LineComment)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 ChildrenContext (org.eclipse.wb.internal.core.databinding.model.IObserveInfo.ChildrenContext)1 StringReferenceProvider (org.eclipse.wb.internal.core.databinding.model.reference.StringReferenceProvider)1