Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 234496 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/databinding/viewers/ObservableValueEditingSupport.java (+45 lines)
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 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
	 */
243
	public static EditingSupport create(ColumnViewer viewer,
244
			DataBindingContext dbc, final CellEditor cellEditor,
245
			final IObservableFactory cellEditorObservableFactory,
246
			final IObservableFactory elementObservableFactory) {
247
		return new ObservableValueEditingSupport(viewer, dbc) {
248
			protected IObservableValue doCreateCellEditorObservable(
249
					CellEditor cellEditor) {
250
				return (IObservableValue) cellEditorObservableFactory
251
						.createObservable(cellEditor);
252
			}
253
254
			protected IObservableValue doCreateElementObservable(
255
					Object element, ViewerCell cell) {
256
				return (IObservableValue) elementObservableFactory
257
						.createObservable(element);
258
			}
259
260
			protected CellEditor getCellEditor(Object element) {
261
				return cellEditor;
262
			}
263
		};
264
	}
220
}
265
}

Return to bug 234496