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);
}
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);
}
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);
}
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;
}
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());
}
Aggregations