use of org.eclipse.wb.internal.rcp.databinding.model.BindableInfo in project windowbuilder by eclipse.
the class BindingsProperty method checkEquals.
// //////////////////////////////////////////////////////////////////////////
//
// Menu
//
// //////////////////////////////////////////////////////////////////////////
@Override
protected boolean checkEquals(IObserveInfo observe) throws Exception {
if (observe instanceof WidgetBindableInfo) {
WidgetBindableInfo bindable = (WidgetBindableInfo) observe;
if (m_context.objectInfo == bindable.getJavaInfo()) {
return true;
}
}
//
String reference = JavaInfoReferenceProvider.getReference(m_context.javaInfo());
BindableInfo bindable = (BindableInfo) observe;
return reference.equals(bindable.getReference());
}
use of org.eclipse.wb.internal.rcp.databinding.model.BindableInfo in project windowbuilder by eclipse.
the class InputObserveProperty method getBinding.
// //////////////////////////////////////////////////////////////////////////
//
// SingleObserveBindingProperty
//
// //////////////////////////////////////////////////////////////////////////
@Override
protected IBindingInfo getBinding() throws Exception {
BindableInfo observeProperty = (BindableInfo) m_observeProperty;
List<AbstractBindingInfo> bindings = observeProperty.getBindings();
return bindings.isEmpty() ? null : bindings.get(0);
}
use of org.eclipse.wb.internal.rcp.databinding.model.BindableInfo in project windowbuilder by eclipse.
the class ObserveProperty method getBindings.
// //////////////////////////////////////////////////////////////////////////
//
// AbstractObserveProperty
//
// //////////////////////////////////////////////////////////////////////////
@Override
public void getBindings(List<IBindingInfo> bindings, List<Boolean> isTargets) throws Exception {
BindableInfo observeProperty = (BindableInfo) m_observeProperty;
bindings.addAll(observeProperty.getBindings());
//
for (IBindingInfo binding : bindings) {
isTargets.add(binding.getTargetProperty() == m_observeProperty);
}
}
use of org.eclipse.wb.internal.rcp.databinding.model.BindableInfo in project windowbuilder by eclipse.
the class DatabindingsProvider method doValidate.
public static boolean doValidate(List<AbstractBindingInfo> bindings, IObserveInfo target, IObserveInfo targetProperty, IObserveInfo model, IObserveInfo modelProperty) throws Exception {
// ignore itself
if (target == model && targetProperty == modelProperty) {
return false;
}
// prepare binable's
BindableInfo targetBindable = (BindableInfo) target;
BindableInfo targetPropertyBindable = (BindableInfo) targetProperty;
IObservableFactory targetFactory = targetPropertyBindable.getObservableFactory();
BindableInfo modelBindable = (BindableInfo) model;
BindableInfo modelPropertyBindable = (BindableInfo) modelProperty;
IObservableFactory modelFactory = modelPropertyBindable.getObservableFactory();
// ignore null factories
if (targetFactory == null || modelFactory == null) {
return false;
}
//
Type targetType = targetFactory.getType();
Type modelType = modelFactory.getType();
//
if (targetType == Type.Input || targetType == Type.InputCollection || modelType == Type.Input || modelType == Type.InputCollection) {
// ignore no collection type for input
if (targetType == modelType) {
return false;
}
if (targetType == Type.InputCollection) {
if (modelType != Type.Input) {
return false;
}
} else if (modelType == Type.InputCollection) {
if (targetType != Type.Input) {
return false;
}
} else if (targetType == Type.Input) {
if (!validateInput(modelType)) {
return false;
}
} else if (!validateInput(targetType)) {
return false;
}
if (targetType == Type.Input) {
if (findBinding(bindings, target, targetProperty)) {
return false;
}
} else if (findBinding(bindings, model, modelProperty)) {
return false;
}
} else if (targetType == modelType) {
if (modelType == Type.Detail) {
return false;
}
} else {
if (targetType == Type.OnlyList) {
if (!validateOnlyList(modelType)) {
return false;
}
} else if (modelType == Type.OnlyList) {
if (!validateOnlyList(targetType)) {
return false;
}
} else if (targetType == Type.OnlySet) {
if (!validateOnlySet(modelType)) {
return false;
}
} else if (modelType == Type.OnlySet) {
if (!validateOnlySet(targetType)) {
return false;
}
} else if (targetType == Type.OnlyValue) {
if (!validateOnlyValue(modelType)) {
return false;
}
} else if (modelType == Type.OnlyValue) {
if (!validateOnlyValue(targetType)) {
return false;
}
} else if (targetType == Type.List) {
if (!validateList(modelType)) {
return false;
}
} else if (modelType == Type.List) {
if (!validateList(targetType)) {
return false;
}
} else if (targetType == Type.Set) {
if (!validateSet(modelType)) {
return false;
}
} else if (modelType == Type.Set) {
if (!validateSet(targetType)) {
return false;
}
} else if (targetType == Type.Any) {
if (!validateAny(modelType)) {
return false;
}
} else if (modelType == Type.Any) {
if (!validateAny(targetType)) {
return false;
}
} else if (targetType == Type.Detail) {
if (!validateDetail(modelType)) {
return false;
}
} else if (modelType == Type.Detail) {
if (!validateDetail(targetType)) {
return false;
}
}
}
// see http://www.eclipse.org/forums/index.php/t/262915/
if (modelType == Type.List || modelType == Type.OnlyList || modelType == Type.Set || modelType == Type.OnlySet) {
if (modelProperty.getParent() != null) {
return false;
}
}
// ignore itself
return !targetBindable.getReference().equals(modelBindable.getReference()) || !targetPropertyBindable.getReference().equals(modelPropertyBindable.getReference());
}
use of org.eclipse.wb.internal.rcp.databinding.model.BindableInfo in project windowbuilder by eclipse.
the class AttributeDocumentEditor method getValue.
// //////////////////////////////////////////////////////////////////////////
//
//
//
// //////////////////////////////////////////////////////////////////////////
private String getValue() throws Exception {
StringBuffer value = new StringBuffer("{Binding ");
//
if (m_binding.getModel() instanceof WidgetBindableInfo) {
WidgetBindableInfo model = (WidgetBindableInfo) m_binding.getModel();
String modelProperty = m_binding.getModelProperty().getPresentation().getText();
value.append(" elementName=" + model.getReference() + ", Path=" + modelProperty);
} else {
BindableInfo modelProperty = (BindableInfo) m_binding.getModelProperty();
String property = StringUtils.remove(modelProperty.getReference(), '"');
//
XmlElementBeanBindableInfo model = (XmlElementBeanBindableInfo) m_binding.getModel();
if (!model.isDataContext()) {
property = "{StaticResource " + property + "}";
}
//
value.append(" Path=" + property);
}
//
if (m_binding.getMode() != 0) {
value.append(", Mode=" + BindingInfo.MODES[m_binding.getMode()]);
}
if (m_binding.getTriger() != 0) {
value.append(", updateSourceTrigger=" + BindingInfo.TRIGGERS[m_binding.getTriger()]);
}
//
m_binding.getConverter().appendValue(value);
m_binding.getValidator().appendValue(value);
//
value.append("}");
//
return value.toString();
}
Aggregations