| Summary: | [DataBinding] ObservableValueEditingSupport: option to use IObservableFactory instead of subclassing | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Matthew Hall <qualidafial> | ||||||||||||||
| Component: | UI | Assignee: | Matthew Hall <qualidafial> | ||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||
| Severity: | enhancement | ||||||||||||||||
| Priority: | P3 | CC: | bokowski, nacor, tom.schindl | ||||||||||||||
| Version: | 3.4 | ||||||||||||||||
| Target Milestone: | 3.5 M6 | ||||||||||||||||
| Hardware: | PC | ||||||||||||||||
| OS: | Windows XP | ||||||||||||||||
| Whiteboard: | |||||||||||||||||
| Attachments: |
|
||||||||||||||||
|
Description
Matthew Hall
Created attachment 102521 [details]
Add static method ObservableValueEditingSupport.create()
Created attachment 102527 [details]
CellEditorObservables
Boris, with this patch you can set up EditingSupport with databinding as follows:
viewerColumn.setEditingSupport(
ObservableValueEditingSupport.create(
viewer, dbc, cellEditor,
CellEditorObservables.valueFactory(),
BeansObservables.valueFactory(realm, propertyName) ) );
We should implement this as CellEditorProperties, and add static methods to ObservableValueEditingSupport to accept IObservableFactories.
Thus the following:
viewerColumn.setEditingSupport(new ObservableValueEditingSupport(viewer, dbc) {
protected IObservableValue doCreateCellEditorObservable(CellEditor cellEditor) {
return SWTObservables.observeText(cellEditor.getControl(), SWT.Modify);
}
protected IObservableValue doCreateElementObservable(Object element, ViewerCell cell) {
return BeansObservables.observeValue(element, "name");
}
} );
could be simply:
viewerColumn.setEditingSupport(ObservableValueEditingSupport.create(
viewer, dbc, WidgetProperties.text(SWT.Modify).valueFactory(), BeanProperties.value("name").valueFactory() );
We could also introduce ValuePropertyEditingSupport as a convenience class:
viewerColumn.setEditingSupport(ValuePropertyEditingSupport.create(
viewer, dbc, WidgetProperties.text(SWT.Modify), BeanProperties.value("name") );
Created attachment 127953 [details]
Patch
Created attachment 128120 [details]
Patch
Created attachment 128121 [details]
mylyn/context/zip
Boris, any chance of squeezing this one in? Created attachment 128130 [details] snippet (as patch) This is a simplified version of the snippet contributed by Heiko Ahrens on bug 267712. Heiko, I simplified your snippet a bit based on this last little bit of data binding API for 3.5. Released > 20090309 |