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