|
Lines 7-12
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Matthew Hall - bug 234496 |
| 10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 11 |
|
12 |
|
| 12 |
package org.eclipse.jface.databinding.viewers; |
13 |
package org.eclipse.jface.databinding.viewers; |
|
Lines 15-20
Link Here
|
| 15 |
import org.eclipse.core.databinding.DataBindingContext; |
16 |
import org.eclipse.core.databinding.DataBindingContext; |
| 16 |
import org.eclipse.core.databinding.UpdateValueStrategy; |
17 |
import org.eclipse.core.databinding.UpdateValueStrategy; |
| 17 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
18 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
|
|
19 |
import org.eclipse.core.databinding.property.value.IValueProperty; |
| 18 |
import org.eclipse.core.runtime.Assert; |
20 |
import org.eclipse.core.runtime.Assert; |
| 19 |
import org.eclipse.jface.viewers.CellEditor; |
21 |
import org.eclipse.jface.viewers.CellEditor; |
| 20 |
import org.eclipse.jface.viewers.ColumnViewer; |
22 |
import org.eclipse.jface.viewers.ColumnViewer; |
|
Lines 32-37
Link Here
|
| 32 |
*/ |
34 |
*/ |
| 33 |
public abstract class ObservableValueEditingSupport extends EditingSupport { |
35 |
public abstract class ObservableValueEditingSupport extends EditingSupport { |
| 34 |
/** |
36 |
/** |
|
|
37 |
* Returns an ObservableValueEditingSupport instance which binds the given |
| 38 |
* cell editor property to the given element property. |
| 39 |
* |
| 40 |
* @param viewer |
| 41 |
* the column viewer |
| 42 |
* @param dbc |
| 43 |
* the DataBindingContext used for binding between the cell |
| 44 |
* editor and the viewer element. |
| 45 |
* @param cellEditor |
| 46 |
* the cell editor |
| 47 |
* @param cellEditorProperty |
| 48 |
* the cell editor property to be bound to the element. |
| 49 |
* @param elementProperty |
| 50 |
* the element property to be bound to the cell editor. |
| 51 |
* @return an ObservableValueEditingSupport instance using the given |
| 52 |
* arguments. |
| 53 |
* @since 1.3 |
| 54 |
*/ |
| 55 |
public static EditingSupport create(ColumnViewer viewer, |
| 56 |
DataBindingContext dbc, final CellEditor cellEditor, |
| 57 |
final IValueProperty cellEditorProperty, |
| 58 |
final IValueProperty elementProperty) { |
| 59 |
return new ObservableValueEditingSupport(viewer, dbc) { |
| 60 |
protected IObservableValue doCreateCellEditorObservable( |
| 61 |
CellEditor cellEditor) { |
| 62 |
return cellEditorProperty.observe(cellEditor); |
| 63 |
} |
| 64 |
|
| 65 |
protected IObservableValue doCreateElementObservable( |
| 66 |
Object element, ViewerCell cell) { |
| 67 |
return elementProperty.observe(element); |
| 68 |
} |
| 69 |
|
| 70 |
protected CellEditor getCellEditor(Object element) { |
| 71 |
return cellEditor; |
| 72 |
} |
| 73 |
}; |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 35 |
* Maintains references to the instances currently imployed while editing. |
77 |
* Maintains references to the instances currently imployed while editing. |
| 36 |
* Will be <code>null</code> when not editing. |
78 |
* Will be <code>null</code> when not editing. |
| 37 |
*/ |
79 |
*/ |
|
Lines 145-153
Link Here
|
| 145 |
|
187 |
|
| 146 |
/** |
188 |
/** |
| 147 |
* Creates a new binding for the provided <code>target</code> and |
189 |
* Creates a new binding for the provided <code>target</code> and |
| 148 |
* <code>model</code>. Default |
190 |
* <code>model</code>. Default {@link UpdateValueStrategy value update |
| 149 |
* {@link UpdateValueStrategy value update strategies} are used with the |
191 |
* strategies} are used with the target to model updating on |
| 150 |
* target to model updating on {@link UpdateValueStrategy#POLICY_CONVERT}. |
192 |
* {@link UpdateValueStrategy#POLICY_CONVERT}. |
| 151 |
* |
193 |
* |
| 152 |
* @param target |
194 |
* @param target |
| 153 |
* @param model |
195 |
* @param model |