# Class ObservableValueEditingSupport<E,M,T>

java.lang.Object
org.eclipse.jface.viewers.EditingSupport
org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport<E,M,T>

Type Parameters:
  `E` - type of the model element with a property that is being edited
  `M` - type of the value in the model that is being edited, the value of the property on the model element
  `T` - type of the target value that actually is being edited by the user

public abstract class ObservableValueEditingSupport<E,M,T> extends EditingSupport
`EditingSupport` using the JFace Data Binding concepts to handle the updating of an element from a `CellEditor`.

If `M` and `T` are different then they must be converted to each other.

Since:
  1.2

## Constructor Summary

Constructors
Constructor
Description
`ObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dataBindingContext)`
Constructs a new instance with the provided `viewer` and dataBindingContext

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`canEdit(Object element)`
Default implementation always returns `true`.
`static <E,M,T> EditingSupport`
`create(ColumnViewer viewer, DataBindingContext dataBindingContext, CellEditor cellEditor, IValueProperty<? super CellEditor, T> cellEditorProperty, IValueProperty<E,M> elementProperty)`
Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.
`protected Binding`
`createBinding(IObservableValue<T> target, IObservableValue<M> model)`
Creates a new binding for the provided `target` and `model`.
`protected abstract IObservableValue<T>`
`doCreateCellEditorObservable(CellEditor cellEditor)`
Creates the observable value for the CellEditor.
`protected abstract IObservableValue<M>`
`doCreateElementObservable(E element, ViewerCell cell)`
Creates the observable value for the element.
`protected final DataBindingContext`
`getDataBindingContext()`
`protected Object`
`getValue(Object element)`
Default implementation always returns `null` as this will be handled by the Binding.
`protected final void`
`initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell)`
Creates a `Binding` between the editor and the element to be edited.
`protected final void`
`saveCellEditorValue(CellEditor cellEditor, ViewerCell cell)`
Updates the model from the target.
`protected void`
`setValue(Object element, Object value)`
Default implementation does nothing as this will be handled by the Binding.

### Methods inherited from class EditingSupport

`getCellEditor, getViewer`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ObservableValueEditingSupport

public ObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dataBindingContext)
Constructs a new instance with the provided `viewer` and dataBindingContext

Parameters:
  `viewer` - viewer to edit
  `dataBindingContext` - used to create `Bindings`

## Method Details

### create

public static <E,M,T> EditingSupport create(ColumnViewer viewer, DataBindingContext dataBindingContext, CellEditor cellEditor, IValueProperty<? super CellEditor, T> cellEditorProperty, IValueProperty<E,M> elementProperty)
Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.

Parameters:
  `viewer` - the column viewer
  `dataBindingContext` - the DataBindingContext used for binding between the cell editor and the viewer element.
  `cellEditor` - the cell editor
  `cellEditorProperty` - the cell editor property to be bound to the element.
  `elementProperty` - the element property to be bound to the cell editor.
Returns:
  an ObservableValueEditingSupport instance using the given arguments.
Since:
  1.3

### canEdit

protected boolean canEdit(Object element)
Default implementation always returns `true`.

Specified by:
  `canEdit` in class `EditingSupport`
Parameters:
  `element` - the model element
Returns:
  true if editable
See Also:
  - `EditingSupport.canEdit(java.lang.Object)`

### getValue

protected Object getValue(Object element)
Default implementation always returns `null` as this will be handled by the Binding.

Specified by:
  `getValue` in class `EditingSupport`
Parameters:
  `element` - the model element
Returns:
  the value shown
See Also:
  - `EditingSupport.getValue(java.lang.Object)`

### setValue

protected void setValue(Object element, Object value)
Default implementation does nothing as this will be handled by the Binding.

Specified by:
  `setValue` in class `EditingSupport`
Parameters:
  `element` - the model element
  `value` - the new value
See Also:
  - `EditingSupport.setValue(java.lang.Object, java.lang.Object)`

### initializeCellEditorValue

protected final void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell)
Creates a `Binding` between the editor and the element to be edited. Invokes `doCreateCellEditorObservable(CellEditor)`, `doCreateElementObservable(Object, ViewerCell)`, and then `createBinding(IObservableValue, IObservableValue)`.

Overrides:
  `initializeCellEditorValue` in class `EditingSupport`
Parameters:
  `cellEditor` - the cell editor
  `cell` - the cell the editor is working for

### doCreateCellEditorObservable

protected abstract IObservableValue<T> doCreateCellEditorObservable(CellEditor cellEditor)
Creates the observable value for the CellEditor.

Parameters:
  `cellEditor` - editor to create observable for
Returns:
  observable value

### doCreateElementObservable

protected abstract IObservableValue<M> doCreateElementObservable(E element, ViewerCell cell)
Creates the observable value for the element.

Parameters:
  `element` - element to create observable for
  `cell` - elements viewer cell
Returns:
  observable value

### getDataBindingContext

protected final DataBindingContext getDataBindingContext()

Returns:
  the `DataBindingContext` that was used when creating this object.
Since:
  1.11

### createBinding

protected Binding createBinding(IObservableValue<T> target, IObservableValue<M> model)
Creates a new binding for the provided `target` and `model`. Default `value update strategies` are used with the target to model updating on `UpdateValueStrategy.POLICY_CONVERT`.

Parameters:
  `target` - the target
  `model` - the model
Returns:
  binding created binding

### saveCellEditorValue

protected final void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell)
Updates the model from the target.

Overrides:
  `saveCellEditorValue` in class `EditingSupport`
Parameters:
  `cellEditor` - the cell-editor
  `cell` - the cell the editor is working for