Class ObservableValueEditingSupport
- java.lang.Object
-
- org.eclipse.jface.viewers.EditingSupport
-
- org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport
-
public abstract class ObservableValueEditingSupport extends EditingSupport
EditingSupportusing the JFace Data Binding concepts to handle the updating of an element from aCellEditor.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description ObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dbc)Constructs a new instance with the providedvieweranddbc.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancanEdit(Object element)Default implementation always returnstrue.static EditingSupportcreate(ColumnViewer viewer, DataBindingContext dbc, CellEditor cellEditor, IValueProperty cellEditorProperty, IValueProperty elementProperty)Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.protected BindingcreateBinding(IObservableValue target, IObservableValue model)Creates a new binding for the providedtargetandmodel.protected abstract IObservableValuedoCreateCellEditorObservable(CellEditor cellEditor)Creates the observable value for the CellEditor.protected abstract IObservableValuedoCreateElementObservable(Object element, ViewerCell cell)Creates the observable value for the element.protected ObjectgetValue(Object element)Default implementation always returnsnullas this will be handled by the Binding.protected voidinitializeCellEditorValue(CellEditor cellEditor, ViewerCell cell)Creates aBindingbetween the editor and the element to be edited.protected voidsaveCellEditorValue(CellEditor cellEditor, ViewerCell cell)Updates the model from the target.protected voidsetValue(Object element, Object value)Default implementation does nothing as this will be handled by the Binding.-
Methods inherited from class org.eclipse.jface.viewers.EditingSupport
getCellEditor, getViewer
-
-
-
-
Constructor Detail
-
ObservableValueEditingSupport
public ObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dbc)
Constructs a new instance with the providedvieweranddbc.- Parameters:
viewer- viewer to editdbc- dbc to createBindings
-
-
Method Detail
-
create
public static EditingSupport create(ColumnViewer viewer, DataBindingContext dbc, CellEditor cellEditor, IValueProperty cellEditorProperty, IValueProperty elementProperty)
Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.- Parameters:
viewer- the column viewerdbc- the DataBindingContext used for binding between the cell editor and the viewer element.cellEditor- the cell editorcellEditorProperty- 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 returnstrue.- Specified by:
canEditin classEditingSupport- 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 returnsnullas this will be handled by the Binding.- Specified by:
getValuein classEditingSupport- 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:
setValuein classEditingSupport- Parameters:
element- the model elementvalue- the new value- See Also:
EditingSupport.setValue(java.lang.Object, java.lang.Object)
-
initializeCellEditorValue
protected final void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell)
Creates aBindingbetween the editor and the element to be edited. InvokesdoCreateCellEditorObservable(CellEditor),doCreateElementObservable(Object, ViewerCell), and thencreateBinding(IObservableValue, IObservableValue).- Overrides:
initializeCellEditorValuein classEditingSupport- Parameters:
cellEditor- the cell editorcell- the cell the editor is working for
-
doCreateCellEditorObservable
protected abstract IObservableValue doCreateCellEditorObservable(CellEditor cellEditor)
Creates the observable value for the CellEditor.- Parameters:
cellEditor-- Returns:
- observable value
-
doCreateElementObservable
protected abstract IObservableValue doCreateElementObservable(Object element, ViewerCell cell)
Creates the observable value for the element.- Parameters:
element-cell-- Returns:
- observable value
-
createBinding
protected Binding createBinding(IObservableValue target, IObservableValue model)
Creates a new binding for the providedtargetandmodel. Defaultvalue update strategiesare used with the target to model updating onUpdateValueStrategy.POLICY_CONVERT.- Parameters:
target-model-- Returns:
- binding
-
saveCellEditorValue
protected final void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell)
Updates the model from the target.- Overrides:
saveCellEditorValuein classEditingSupport- Parameters:
cellEditor- the cell-editorcell- the cell the editor is working for
-
-