|
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 14-19
Link Here
|
| 14 |
import org.eclipse.core.databinding.Binding; |
15 |
import org.eclipse.core.databinding.Binding; |
| 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; |
|
|
18 |
import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; |
| 17 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
19 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
| 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; |
|
Lines 145-153
Link Here
|
| 145 |
|
147 |
|
| 146 |
/** |
148 |
/** |
| 147 |
* Creates a new binding for the provided <code>target</code> and |
149 |
* Creates a new binding for the provided <code>target</code> and |
| 148 |
* <code>model</code>. Default |
150 |
* <code>model</code>. Default {@link UpdateValueStrategy value update |
| 149 |
* {@link UpdateValueStrategy value update strategies} are used with the |
151 |
* strategies} are used with the target to model updating on |
| 150 |
* target to model updating on {@link UpdateValueStrategy#POLICY_CONVERT}. |
152 |
* {@link UpdateValueStrategy#POLICY_CONVERT}. |
| 151 |
* |
153 |
* |
| 152 |
* @param target |
154 |
* @param target |
| 153 |
* @param model |
155 |
* @param model |
|
Lines 217-220
Link Here
|
| 217 |
binding.dispose(); |
219 |
binding.dispose(); |
| 218 |
} |
220 |
} |
| 219 |
} |
221 |
} |
|
|
222 |
|
| 223 |
/** |
| 224 |
* Returns an ObservableValueEditingSupport instance using the given |
| 225 |
* arguments. |
| 226 |
* |
| 227 |
* @param viewer |
| 228 |
* the column viewer |
| 229 |
* @param dbc |
| 230 |
* the DataBindingContext used for binding between the cell |
| 231 |
* editor and the viewer element. |
| 232 |
* @param cellEditor |
| 233 |
* the cell editor |
| 234 |
* @param cellEditorObservableFactory |
| 235 |
* observable factory which creates an IObservableValue observing |
| 236 |
* the value of the cell editor. |
| 237 |
* @param elementObservableFactory |
| 238 |
* observable factory which creates an IObservableValue observing |
| 239 |
* an aspect of the viewer element. |
| 240 |
* @return an ObservableValueEditingSupport instance using the given |
| 241 |
* arguments. |
| 242 |
* @since 1.3 |
| 243 |
*/ |
| 244 |
public static EditingSupport create(ColumnViewer viewer, |
| 245 |
DataBindingContext dbc, final CellEditor cellEditor, |
| 246 |
final IObservableFactory cellEditorObservableFactory, |
| 247 |
final IObservableFactory elementObservableFactory) { |
| 248 |
return new ObservableValueEditingSupport(viewer, dbc) { |
| 249 |
protected IObservableValue doCreateCellEditorObservable( |
| 250 |
CellEditor cellEditor) { |
| 251 |
return (IObservableValue) cellEditorObservableFactory |
| 252 |
.createObservable(cellEditor.getControl()); |
| 253 |
} |
| 254 |
|
| 255 |
protected IObservableValue doCreateElementObservable( |
| 256 |
Object element, ViewerCell cell) { |
| 257 |
return (IObservableValue) elementObservableFactory |
| 258 |
.createObservable(element); |
| 259 |
} |
| 260 |
|
| 261 |
protected CellEditor getCellEditor(Object element) { |
| 262 |
return cellEditor; |
| 263 |
} |
| 264 |
}; |
| 265 |
} |
| 220 |
} |
266 |
} |