Search in sources :

Example 1 with IObserveInfo

use of org.eclipse.wb.internal.core.databinding.model.IObserveInfo 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 IObserveInfo

use of org.eclipse.wb.internal.core.databinding.model.IObserveInfo in project windowbuilder by eclipse.

the class ObserveElementsWizardPage method getBinding.

public IBindingInfo getBinding() throws Exception {
    IStructuredSelection modelSelection = EditComposite.getSelection(m_composite, true);
    IStructuredSelection modelPropertySelection = EditComposite.getSelection(m_composite, false);
    // prepare model
    IObserveInfo model = (IObserveInfo) modelSelection.getFirstElement();
    IObserveInfo modelProperty = (IObserveInfo) modelPropertySelection.getFirstElement();
    // 
    return m_context.provider.createBinding(m_context.observeObject, m_observeProperty, model, modelProperty);
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 3 with IObserveInfo

use of org.eclipse.wb.internal.core.databinding.model.IObserveInfo in project windowbuilder by eclipse.

the class ControllerSupport method moveBeans.

private static void moveBeans(DatabindingsProvider provider) throws Exception {
    AstEditor controllerASTEditor = provider.getAstEditor();
    TypeDeclaration controllerRootNode = provider.getRootNode();
    List<IBindingInfo> bindings = provider.getBindings();
    int size = bindings.size();
    Set<IObserveInfo> observes = Sets.newHashSet();
    for (int i = size - 1; i >= 0; i--) {
        IBindingInfo binding = bindings.get(i);
        IObserveInfo model = binding.getModel();
        if (observes.add(model)) {
            moveBean(provider, model, controllerASTEditor, controllerRootNode);
        }
        IObserveInfo target = binding.getTarget();
        if (observes.add(target)) {
            moveBean(provider, target, controllerASTEditor, controllerRootNode);
        }
    }
    // 
    controllerASTEditor.commitChanges();
    controllerASTEditor.getModelUnit().getBuffer().save(null, true);
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) AstEditor(org.eclipse.wb.internal.core.utils.ast.AstEditor) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) TypeDeclaration(org.eclipse.jdt.core.dom.TypeDeclaration)

Example 4 with IObserveInfo

use of org.eclipse.wb.internal.core.databinding.model.IObserveInfo in project windowbuilder by eclipse.

the class ElPropertyInfo method getObserveProperty.

@Override
public ObserveInfo getObserveProperty(ObserveInfo observeObject) throws Exception {
    // configure observe object account with base property
    if (m_baseProperty != null) {
        Assert.instanceOf(BeanPropertyInfo.class, m_baseProperty);
        observeObject = m_baseProperty.getObserveProperty(observeObject);
    }
    // find property
    for (IObserveInfo observeProperty : observeObject.getChildren(ChildrenContext.ChildrenForPropertiesTable)) {
        if (observeProperty instanceof ElPropertyObserveInfo) {
            return (ObserveInfo) observeProperty;
        }
    }
    return null;
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) ElPropertyObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.ElPropertyObserveInfo) IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo) ElPropertyObserveInfo(org.eclipse.wb.internal.swing.databinding.model.beans.ElPropertyObserveInfo)

Example 5 with IObserveInfo

use of org.eclipse.wb.internal.core.databinding.model.IObserveInfo in project windowbuilder by eclipse.

the class BindingsProperty method checkEquals.

// //////////////////////////////////////////////////////////////////////////
// 
// Menu
// 
// //////////////////////////////////////////////////////////////////////////
@Override
protected boolean checkEquals(IObserveInfo iobserve) throws Exception {
    String reference = JavaInfoReferenceProvider.getReference(m_context.javaInfo());
    ObserveInfo observe = (ObserveInfo) iobserve;
    return reference.equals(observe.getReference());
}
Also used : IObserveInfo(org.eclipse.wb.internal.core.databinding.model.IObserveInfo) ObserveInfo(org.eclipse.wb.internal.swing.databinding.model.ObserveInfo)

Aggregations

IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)100 DatabindingsProvider (org.eclipse.wb.internal.rcp.databinding.DatabindingsProvider)66 CompositeInfo (org.eclipse.wb.internal.swt.model.widgets.CompositeInfo)34 WidgetBindableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.bindables.WidgetBindableInfo)21 IBindingInfo (org.eclipse.wb.internal.core.databinding.model.IBindingInfo)16 DetailListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailListBeanObservableInfo)13 DetailSetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailSetBeanObservableInfo)13 WritableListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.WritableListBeanObservableInfo)13 WritableSetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.WritableSetBeanObservableInfo)13 CheckedElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.CheckedElementsObservableInfo)13 ObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo)12 ListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.ListBeanObservableInfo)12 SetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.SetBeanObservableInfo)12 TreeViewerInputBindingInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.TreeViewerInputBindingInfo)12 MultiSelectionObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.MultiSelectionObservableInfo)12 SingleSelectionObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.SingleSelectionObservableInfo)12 MapsBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.MapsBeanObservableInfo)11 KnownElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo)11 ViewerObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.ViewerObservableInfo)11 ObservableMapLabelProviderInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ObservableMapLabelProviderInfo)8