use of org.eclipse.wb.internal.rcp.databinding.xwt.model.widgets.WidgetBindableInfo in project windowbuilder by eclipse.
the class DatabindingParser method parseBinding.
private BindingInfo parseBinding(DocumentElement element, String property, Map<String, String> attributes) throws Exception {
WidgetBindableInfo target = m_widgetContainer.resolve(element);
if (target == null) {
m_provider.addWarning(MessageFormat.format(Messages.DatabindingParser_widgetNotFound, element), new Throwable());
return null;
}
//
WidgetPropertyBindableInfo targetProperty = target.resolvePropertyByText(property);
if (targetProperty == null) {
m_provider.addWarning(MessageFormat.format(Messages.DatabindingParser_widgetPropertyNotFound, element, property), new Throwable());
return null;
}
//
String path = attributes.get("path");
String elementName = attributes.get("elementname");
//
if (elementName != null) {
WidgetBindableInfo model = m_widgetContainer.resolve(elementName);
if (model == null) {
m_provider.addWarning(MessageFormat.format(Messages.DatabindingParser_widgetNotFound, elementName), new Throwable());
return null;
}
//
if (path.toLowerCase().startsWith("singleselection.(") && path.endsWith(")")) {
if (property.equalsIgnoreCase("input")) {
// XXX
}
// XXX
return null;
}
//
WidgetPropertyBindableInfo modelProperty = model.resolvePropertyByText(path.toLowerCase());
if (modelProperty == null) {
m_provider.addWarning(MessageFormat.format(Messages.DatabindingParser_widgetPropertyNotFound, element, path), new Throwable());
return null;
}
//
return createBinding(target, targetProperty, model, modelProperty, attributes);
}
//
BeanBindableInfo model = null;
String source = attributes.get("source");
//
if (source != null) {
String sourceReference = StringUtils.substringBetween(source, "{StaticResource", "}").trim();
model = (BeanBindableInfo) m_beanContainer.resolve(sourceReference);
} else {
model = m_beanContainer.getDataContext();
}
//
if (model == null) {
m_provider.addWarning(Messages.DatabindingParser_beanNotFound, new Throwable());
return null;
}
//
PropertyBindableInfo modelProperty = model.resolvePropertyReference("\"" + path.toLowerCase() + "\"");
if (modelProperty == null) {
m_provider.addWarning(MessageFormat.format(Messages.DatabindingParser_beanPropertyNotFound, path), new Throwable());
return null;
}
//
if (property.equalsIgnoreCase("input")) {
// XXX
return null;
}
//
return createBinding(target, targetProperty, model, modelProperty, attributes);
}
use of org.eclipse.wb.internal.rcp.databinding.xwt.model.widgets.WidgetBindableInfo 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();
}
use of org.eclipse.wb.internal.rcp.databinding.xwt.model.widgets.WidgetBindableInfo in project windowbuilder by eclipse.
the class BindingInfo method modify.
public void modify(RunnableEx runnable) throws Exception {
WidgetBindableInfo target = (WidgetBindableInfo) m_target;
XmlObjectInfo objectInfo = target.getXMLObjectInfo();
//
objectInfo.startEdit();
runnable.run();
objectInfo.endEdit();
}
Aggregations