Search in sources :

Example 1 with IBindingInfo

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

the class AbstractBindingsProperty method contributeActions.

// //////////////////////////////////////////////////////////////////////////
// 
// Menu
// 
// //////////////////////////////////////////////////////////////////////////
private void contributeActions(IMenuManager manager) throws Exception {
    IMenuManager menu = new MenuManager(Messages.AbstractBindingsProperty_menuName);
    // fill bindings
    for (IBindingInfo binding : m_context.provider.getBindings()) {
        if (checkEquals(binding.getTarget())) {
            addBindingAction(menu, binding, binding.getTargetProperty(), true);
        } else if (checkEquals(binding.getModel())) {
            addBindingAction(menu, binding, binding.getModelProperty(), false);
        }
    }
    // separator
    menu.add(new Separator());
    // fill properties
    for (Property property : getProperties()) {
        if (property instanceof AbstractObserveProperty) {
            AbstractObserveProperty observeProperty = (AbstractObserveProperty) property;
            menu.add(new ObserveAction(m_context.objectInfo, observeProperty));
        } else if (property instanceof SingleObserveBindingProperty) {
            SingleObserveBindingProperty observeProperty = (SingleObserveBindingProperty) property;
            menu.add(new SingleObserveBindingAction(m_context.objectInfo, observeProperty));
        }
    }
    // add menu
    manager.appendToGroup(IContextMenuConstants.GROUP_LAYOUT, menu);
}
Also used : IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) IMenuManager(org.eclipse.jface.action.IMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Property(org.eclipse.wb.internal.core.model.property.Property) Separator(org.eclipse.jface.action.Separator)

Example 2 with IBindingInfo

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

the class DatabindingsProvider method editBinding.

public void editBinding(final IBindingInfo ibinding) {
    // edit
    ExecutionUtils.runLog(new RunnableEx() {

        public void run() throws Exception {
            BindingInfo binding = (BindingInfo) ibinding;
            binding.edit(m_rootInfo.getBindings());
        }
    });
    // save
    saveEdit();
}
Also used : JTableBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JTableBindingInfo) JComboBoxBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JComboBoxBindingInfo) ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) BindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.BindingInfo) JListBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JListBindingInfo) DetailBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.DetailBindingInfo) AutoBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo) VirtualBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 3 with IBindingInfo

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

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

the class JavaInfoDeleteManager method deleteBinding.

// //////////////////////////////////////////////////////////////////////////
// 
// Handle
// 
// //////////////////////////////////////////////////////////////////////////
@Override
protected void deleteBinding(IBindingInfo ibinding, List<IBindingInfo> bindings) throws Exception {
    BindingInfo binding = (BindingInfo) ibinding;
    binding.delete(CoreUtils.<BindingInfo>cast(bindings));
}
Also used : BindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.BindingInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo)

Example 5 with IBindingInfo

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

the class DatabindingsProvider method addBinding.

public void addBinding(final IBindingInfo ibinding) {
    // add
    getBindings().add(ibinding);
    // post process
    ExecutionUtils.runLog(new RunnableEx() {

        public void run() throws Exception {
            BindingInfo binding = (BindingInfo) ibinding;
            binding.create(m_rootInfo.getBindings());
        }
    });
    // save
    saveEdit();
}
Also used : JTableBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JTableBindingInfo) JComboBoxBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JComboBoxBindingInfo) ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) BindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.BindingInfo) JListBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JListBindingInfo) DetailBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.DetailBindingInfo) AutoBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo) VirtualBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Aggregations

IBindingInfo (org.eclipse.wb.internal.core.databinding.model.IBindingInfo)81 DatabindingsProvider (org.eclipse.wb.internal.rcp.databinding.DatabindingsProvider)51 CompositeInfo (org.eclipse.wb.internal.swt.model.widgets.CompositeInfo)48 BindingInfo (org.eclipse.wb.internal.rcp.databinding.model.context.BindingInfo)38 IObserveInfo (org.eclipse.wb.internal.core.databinding.model.IObserveInfo)18 TreeViewerInputBindingInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.TreeViewerInputBindingInfo)16 DetailListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailListBeanObservableInfo)14 DetailSetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.DetailSetBeanObservableInfo)14 ListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.ListBeanObservableInfo)14 SetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.SetBeanObservableInfo)14 WritableListBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.WritableListBeanObservableInfo)14 WritableSetBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.WritableSetBeanObservableInfo)14 ObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.ObservableInfo)13 CheckedElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.CheckedElementsObservableInfo)13 ViewerObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.observables.ViewerObservableInfo)13 MapsBeanObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.beans.observables.MapsBeanObservableInfo)12 KnownElementsObservableInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.KnownElementsObservableInfo)12 ViewerInputBindingInfo (org.eclipse.wb.internal.rcp.databinding.model.widgets.input.ViewerInputBindingInfo)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