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 194734 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/databinding/property/set/SimpleSetPropertyObservableSet.java (-26 / +19 lines)
Lines 151-171 Link Here
151
				Collections.EMPTY_SET);
151
				Collections.EMPTY_SET);
152
152
153
		boolean wasUpdating = updating;
153
		boolean wasUpdating = updating;
154
		boolean changed;
155
		updating = true;
154
		updating = true;
156
		try {
155
		try {
157
			changed = property.setSet(source, set, diff);
156
			diff = property.setSet(source, set, diff);
158
			modCount++;
157
			modCount++;
159
		} finally {
158
		} finally {
160
			updating = wasUpdating;
159
			updating = wasUpdating;
161
		}
160
		}
162
161
163
		if (changed) {
162
		if (diff != null) {
164
			cachedSet = getSet();
163
			cachedSet = getSet();
165
			fireSetChange(diff);
164
			fireSetChange(diff);
166
		}
165
		}
167
166
168
		return changed;
167
		return diff != null;
169
	}
168
	}
170
169
171
	public Iterator iterator() {
170
	public Iterator iterator() {
Lines 198-213 Link Here
198
						Collections.singleton(last));
197
						Collections.singleton(last));
199
198
200
				boolean wasUpdating = updating;
199
				boolean wasUpdating = updating;
201
				boolean changed;
202
				updating = true;
200
				updating = true;
203
				try {
201
				try {
204
					changed = property.setSet(source, set, diff);
202
					diff = property.setSet(source, set, diff);
205
					modCount++;
203
					modCount++;
206
				} finally {
204
				} finally {
207
					updating = wasUpdating;
205
					updating = wasUpdating;
208
				}
206
				}
209
207
210
				if (changed) {
208
				if (diff != null) {
211
					cachedSet = getSet();
209
					cachedSet = getSet();
212
					fireSetChange(diff);
210
					fireSetChange(diff);
213
211
Lines 234-254 Link Here
234
				.singleton(o));
232
				.singleton(o));
235
233
236
		boolean wasUpdating = updating;
234
		boolean wasUpdating = updating;
237
		boolean changed;
238
		updating = true;
235
		updating = true;
239
		try {
236
		try {
240
			changed = property.setSet(source, set, diff);
237
			diff = property.setSet(source, set, diff);
241
			modCount++;
238
			modCount++;
242
		} finally {
239
		} finally {
243
			updating = wasUpdating;
240
			updating = wasUpdating;
244
		}
241
		}
245
242
246
		if (changed) {
243
		if (diff != null) {
247
			cachedSet = property.getSet(source);
244
			cachedSet = property.getSet(source);
248
			fireSetChange(diff);
245
			fireSetChange(diff);
249
		}
246
		}
250
247
251
		return changed;
248
		return diff != null;
252
	}
249
	}
253
250
254
	// Bulk change operations
251
	// Bulk change operations
Lines 274-294 Link Here
274
		SetDiff diff = Diffs.createSetDiff(additions, Collections.EMPTY_SET);
271
		SetDiff diff = Diffs.createSetDiff(additions, Collections.EMPTY_SET);
275
272
276
		boolean wasUpdating = updating;
273
		boolean wasUpdating = updating;
277
		boolean changed;
278
		updating = true;
274
		updating = true;
279
		try {
275
		try {
280
			changed = property.setSet(source, set, diff);
276
			diff = property.setSet(source, set, diff);
281
			modCount++;
277
			modCount++;
282
		} finally {
278
		} finally {
283
			updating = wasUpdating;
279
			updating = wasUpdating;
284
		}
280
		}
285
281
286
		if (changed) {
282
		if (diff != null) {
287
			cachedSet = property.getSet(source);
283
			cachedSet = property.getSet(source);
288
			fireSetChange(diff);
284
			fireSetChange(diff);
289
		}
285
		}
290
286
291
		return changed;
287
		return diff != null;
292
	}
288
	}
293
289
294
	public boolean removeAll(Collection c) {
290
	public boolean removeAll(Collection c) {
Lines 315-335 Link Here
315
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, removals);
311
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, removals);
316
312
317
		boolean wasUpdating = updating;
313
		boolean wasUpdating = updating;
318
		boolean changed;
319
		updating = true;
314
		updating = true;
320
		try {
315
		try {
321
			changed = property.setSet(source, set, diff);
316
			diff = property.setSet(source, set, diff);
322
			modCount++;
317
			modCount++;
323
		} finally {
318
		} finally {
324
			updating = wasUpdating;
319
			updating = wasUpdating;
325
		}
320
		}
326
321
327
		if (changed) {
322
		if (diff != null) {
328
			cachedSet = property.getSet(source);
323
			cachedSet = property.getSet(source);
329
			fireSetChange(diff);
324
			fireSetChange(diff);
330
		}
325
		}
331
326
332
		return changed;
327
		return diff != null;
333
	}
328
	}
334
329
335
	public boolean retainAll(Collection c) {
330
	public boolean retainAll(Collection c) {
Lines 361-381 Link Here
361
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, removals);
356
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, removals);
362
357
363
		boolean wasUpdating = updating;
358
		boolean wasUpdating = updating;
364
		boolean changed;
365
		updating = true;
359
		updating = true;
366
		try {
360
		try {
367
			changed = property.setSet(source, set, diff);
361
			diff = property.setSet(source, set, diff);
368
			modCount++;
362
			modCount++;
369
		} finally {
363
		} finally {
370
			updating = wasUpdating;
364
			updating = wasUpdating;
371
		}
365
		}
372
366
373
		if (changed) {
367
		if (diff != null) {
374
			cachedSet = property.getSet(source);
368
			cachedSet = property.getSet(source);
375
			fireSetChange(diff);
369
			fireSetChange(diff);
376
		}
370
		}
377
371
378
		return changed;
372
		return diff != null;
379
	}
373
	}
380
374
381
	public void clear() {
375
	public void clear() {
Lines 388-403 Link Here
388
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, set);
382
		SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, set);
389
383
390
		boolean wasUpdating = updating;
384
		boolean wasUpdating = updating;
391
		boolean changed;
392
		updating = true;
385
		updating = true;
393
		try {
386
		try {
394
			changed = property.setSet(source, Collections.EMPTY_SET, diff);
387
			diff = property.setSet(source, Collections.EMPTY_SET, diff);
395
			modCount++;
388
			modCount++;
396
		} finally {
389
		} finally {
397
			updating = wasUpdating;
390
			updating = wasUpdating;
398
		}
391
		}
399
392
400
		if (changed) {
393
		if (diff != null) {
401
			cachedSet = property.getSet(source);
394
			cachedSet = property.getSet(source);
402
			fireSetChange(diff);
395
			fireSetChange(diff);
403
		}
396
		}
(-)src/org/eclipse/core/databinding/property/set/SimpleSetProperty.java (-3 / +3 lines)
Lines 105-115 Link Here
105
	 *            the new set
105
	 *            the new set
106
	 * @param diff
106
	 * @param diff
107
	 *            a diff describing the change
107
	 *            a diff describing the change
108
	 * @return true if the property was modified on the source object, false
108
	 * @return a SetDiff describing the change that was made, or null if no
109
	 *         otherwise
109
	 *         change could be made.
110
	 * @noreference This method is not intended to be referenced by clients.
110
	 * @noreference This method is not intended to be referenced by clients.
111
	 */
111
	 */
112
	protected abstract boolean setSet(Object source, Set set, SetDiff diff);
112
	protected abstract SetDiff setSet(Object source, Set set, SetDiff diff);
113
113
114
	// Listeners
114
	// Listeners
115
115
(-)src/org/eclipse/core/databinding/property/map/SimpleMapProperty.java (-3 / +3 lines)
Lines 114-124 Link Here
114
	 *            the new map
114
	 *            the new map
115
	 * @param diff
115
	 * @param diff
116
	 *            a diff describing the change
116
	 *            a diff describing the change
117
	 * @return true if the property was modified on the source object, false
117
	 * @return a MapDiff describing the change that was made, or null if no
118
	 *         otherwise
118
	 *         change could be made.
119
	 * @noreference This method is not intended to be referenced by clients.
119
	 * @noreference This method is not intended to be referenced by clients.
120
	 */
120
	 */
121
	protected abstract boolean setMap(Object source, Map map, MapDiff diff);
121
	protected abstract MapDiff setMap(Object source, Map map, MapDiff diff);
122
122
123
	// Listeners
123
	// Listeners
124
124
(-)src/org/eclipse/core/databinding/property/map/SimpleMapPropertyObservableMap.java (-9 / +6 lines)
Lines 163-177 Link Here
163
					.getValue());
163
					.getValue());
164
164
165
			boolean wasUpdating = updating;
165
			boolean wasUpdating = updating;
166
			boolean changed;
167
			updating = true;
166
			updating = true;
168
			try {
167
			try {
169
				changed = property.setMap(source, map, diff);
168
				diff = property.setMap(source, map, diff);
170
			} finally {
169
			} finally {
171
				updating = wasUpdating;
170
				updating = wasUpdating;
172
			}
171
			}
173
172
174
			if (changed) {
173
			if (diff != null) {
175
				cachedMap = getMap();
174
				cachedMap = getMap();
176
				fireMapChange(diff);
175
				fireMapChange(diff);
177
176
Lines 209-224 Link Here
209
			diff = Diffs.createMapDiffSingleChange(key, oldValue, value);
208
			diff = Diffs.createMapDiffSingleChange(key, oldValue, value);
210
209
211
		boolean wasUpdating = updating;
210
		boolean wasUpdating = updating;
212
		boolean changed;
213
		updating = true;
211
		updating = true;
214
		try {
212
		try {
215
			changed = property.setMap(source, map, diff);
213
			diff = property.setMap(source, map, diff);
216
			modCount++;
214
			modCount++;
217
		} finally {
215
		} finally {
218
			updating = wasUpdating;
216
			updating = wasUpdating;
219
		}
217
		}
220
218
221
		if (changed) {
219
		if (diff != null) {
222
			cachedMap = property.getMap(source);
220
			cachedMap = property.getMap(source);
223
			fireMapChange(diff);
221
			fireMapChange(diff);
224
		}
222
		}
Lines 254-269 Link Here
254
				changedKeys, oldValues, newValues);
252
				changedKeys, oldValues, newValues);
255
253
256
		boolean wasUpdating = updating;
254
		boolean wasUpdating = updating;
257
		boolean changed;
258
		updating = true;
255
		updating = true;
259
		try {
256
		try {
260
			changed = property.setMap(source, map, diff);
257
			diff = property.setMap(source, map, diff);
261
			modCount++;
258
			modCount++;
262
		} finally {
259
		} finally {
263
			updating = wasUpdating;
260
			updating = wasUpdating;
264
		}
261
		}
265
262
266
		if (changed) {
263
		if (diff != null) {
267
			cachedMap = getMap();
264
			cachedMap = getMap();
268
			fireMapChange(diff);
265
			fireMapChange(diff);
269
		}
266
		}
(-)src/org/eclipse/core/databinding/property/value/ObservableListSimpleValuePropertyObservableList.java (-6 / +9 lines)
Lines 37-42 Link Here
37
import org.eclipse.core.databinding.observable.set.ISetChangeListener;
37
import org.eclipse.core.databinding.observable.set.ISetChangeListener;
38
import org.eclipse.core.databinding.observable.set.SetChangeEvent;
38
import org.eclipse.core.databinding.observable.set.SetChangeEvent;
39
import org.eclipse.core.databinding.observable.set.WritableSet;
39
import org.eclipse.core.databinding.observable.set.WritableSet;
40
import org.eclipse.core.databinding.observable.value.ValueDiff;
40
import org.eclipse.core.databinding.property.INativePropertyListener;
41
import org.eclipse.core.databinding.property.INativePropertyListener;
41
import org.eclipse.core.internal.databinding.IdentityWrapper;
42
import org.eclipse.core.internal.databinding.IdentityWrapper;
42
import org.eclipse.core.internal.databinding.Util;
43
import org.eclipse.core.internal.databinding.Util;
Lines 378-392 Link Here
378
						lastMasterElement));
379
						lastMasterElement));
379
380
380
				boolean wasUpdating = updating;
381
				boolean wasUpdating = updating;
381
				boolean changed;
382
				ValueDiff diff;
382
				updating = true;
383
				updating = true;
383
				try {
384
				try {
384
					changed = detailProperty.setValue(lastElement, o);
385
					diff = detailProperty.setValue(lastElement, o, Diffs
386
							.createValueDiff(oldValue, o));
385
				} finally {
387
				} finally {
386
					updating = wasUpdating;
388
					updating = wasUpdating;
387
				}
389
				}
388
390
389
				if (changed) {
391
				if (diff != null) {
390
					Object newValue = detailProperty.getValue(lastElement);
392
					Object newValue = detailProperty.getValue(lastElement);
391
393
392
					if (!Util.equals(oldValue, newValue)) {
394
					if (!Util.equals(oldValue, newValue)) {
Lines 414-428 Link Here
414
		Object oldValue = detailProperty.getValue(masterElement);
416
		Object oldValue = detailProperty.getValue(masterElement);
415
417
416
		boolean wasUpdating = updating;
418
		boolean wasUpdating = updating;
417
		boolean changed;
419
		ValueDiff diff;
418
		updating = true;
420
		updating = true;
419
		try {
421
		try {
420
			changed = detailProperty.setValue(masterElement, o);
422
			diff = detailProperty.setValue(masterElement, o, Diffs
423
					.createValueDiff(oldValue, o));
421
		} finally {
424
		} finally {
422
			updating = wasUpdating;
425
			updating = wasUpdating;
423
		}
426
		}
424
427
425
		if (changed) {
428
		if (diff != null) {
426
			Object newValue = detailProperty.getValue(masterElement);
429
			Object newValue = detailProperty.getValue(masterElement);
427
430
428
			if (!Util.equals(oldValue, newValue)) {
431
			if (!Util.equals(oldValue, newValue)) {
(-)src/org/eclipse/core/databinding/property/value/ObservableSetSimpleValuePropertyObservableMap.java (-5 / +5 lines)
Lines 106-123 Link Here
106
	protected Object doPut(Object key, Object value) {
106
	protected Object doPut(Object key, Object value) {
107
		Object oldValue = detailProperty.getValue(key);
107
		Object oldValue = detailProperty.getValue(key);
108
108
109
		boolean changed;
109
		ValueDiff diff = Diffs.createValueDiff(oldValue, value);
110
		updating = true;
110
		updating = true;
111
		try {
111
		try {
112
			changed = detailProperty.setValue(key, value);
112
			diff = detailProperty.setValue(key, value, diff);
113
		} finally {
113
		} finally {
114
			updating = false;
114
			updating = false;
115
		}
115
		}
116
		
116
117
		if (changed) {
117
		if (diff != null) {
118
			Object newValue = detailProperty.getValue(key);
118
			Object newValue = detailProperty.getValue(key);
119
			cachedValues.put(key, newValue);
119
			cachedValues.put(key, newValue);
120
			
120
121
			if (oldValue != newValue) {
121
			if (oldValue != newValue) {
122
				fireMapChange(Diffs.createMapDiffSingleChange(key, oldValue,
122
				fireMapChange(Diffs.createMapDiffSingleChange(key, oldValue,
123
						newValue));
123
						newValue));
(-)src/org/eclipse/core/databinding/property/value/ObservableMapSimpleValuePropertyObservableMap.java (-6 / +7 lines)
Lines 33-38 Link Here
33
import org.eclipse.core.databinding.observable.set.ISetChangeListener;
33
import org.eclipse.core.databinding.observable.set.ISetChangeListener;
34
import org.eclipse.core.databinding.observable.set.SetChangeEvent;
34
import org.eclipse.core.databinding.observable.set.SetChangeEvent;
35
import org.eclipse.core.databinding.observable.set.WritableSet;
35
import org.eclipse.core.databinding.observable.set.WritableSet;
36
import org.eclipse.core.databinding.observable.value.ValueDiff;
36
import org.eclipse.core.databinding.property.INativePropertyListener;
37
import org.eclipse.core.databinding.property.INativePropertyListener;
37
import org.eclipse.core.internal.databinding.IdentityWrapper;
38
import org.eclipse.core.internal.databinding.IdentityWrapper;
38
import org.eclipse.core.internal.databinding.Util;
39
import org.eclipse.core.internal.databinding.Util;
Lines 283-302 Link Here
283
284
284
			Object oldValue = detailProperty.getValue(source);
285
			Object oldValue = detailProperty.getValue(source);
285
286
286
			boolean changed;
287
			ValueDiff diff = Diffs.createValueDiff(oldValue, value);
287
			updating = true;
288
			updating = true;
288
			try {
289
			try {
289
				changed = detailProperty.setValue(source, value);
290
				diff = detailProperty.setValue(source, value, diff);
290
			} finally {
291
			} finally {
291
				updating = false;
292
				updating = false;
292
			}
293
			}
293
294
294
			if (changed) {
295
			if (diff != null) {
295
				Object newValue = detailProperty.getValue(source);
296
				Object newValue = detailProperty.getValue(source);
296
				
297
297
				if (!Util.equals(oldValue, newValue)) {
298
				if (!Util.equals(oldValue, newValue)) {
298
					fireMapChange(Diffs.createMapDiffSingleChange(key, oldValue,
299
					fireMapChange(Diffs.createMapDiffSingleChange(key,
299
							newValue));
300
							oldValue, newValue));
300
				}
301
				}
301
			}
302
			}
302
303
(-)src/org/eclipse/core/databinding/property/value/SimpleValueProperty.java (-4 / +6 lines)
Lines 19-24 Link Here
19
import org.eclipse.core.databinding.observable.masterdetail.MasterDetailObservables;
19
import org.eclipse.core.databinding.observable.masterdetail.MasterDetailObservables;
20
import org.eclipse.core.databinding.observable.set.IObservableSet;
20
import org.eclipse.core.databinding.observable.set.IObservableSet;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.core.databinding.observable.value.ValueDiff;
22
import org.eclipse.core.databinding.property.INativePropertyListener;
23
import org.eclipse.core.databinding.property.INativePropertyListener;
23
24
24
/**
25
/**
Lines 29-35 Link Here
29
 * Subclasses must implement these methods:
30
 * Subclasses must implement these methods:
30
 * <ul>
31
 * <ul>
31
 * <li> {@link #getValue(Object)}
32
 * <li> {@link #getValue(Object)}
32
 * <li> {@link #setValue(Object, Object)}
33
 * <li> {@link #setValue(Object, Object, ValueDiff)}
33
 * <li> {@link #adaptListener(IValuePropertyChangeListener)}
34
 * <li> {@link #adaptListener(IValuePropertyChangeListener)}
34
 * <li> {@link #addListener(Object, INativePropertyListener)}
35
 * <li> {@link #addListener(Object, INativePropertyListener)}
35
 * <li> {@link #removeListener(Object, INativePropertyListener)}
36
 * <li> {@link #removeListener(Object, INativePropertyListener)}
Lines 66-76 Link Here
66
	 *            the property source
67
	 *            the property source
67
	 * @param value
68
	 * @param value
68
	 *            the new value
69
	 *            the new value
69
	 * @return true if the property was modified on the source object, false
70
	 * @param diff TODO
70
	 *         otherwise
71
	 * @return a ValueDiff describing the change that was made, or null if no
72
	 *         change could be made.
71
	 * @noreference This method is not intended to be referenced by clients.
73
	 * @noreference This method is not intended to be referenced by clients.
72
	 */
74
	 */
73
	protected abstract boolean setValue(Object source, Object value);
75
	protected abstract ValueDiff setValue(Object source, Object value, ValueDiff diff);
74
76
75
	/**
77
	/**
76
	 * Returns a listener which implements the correct listener interface for
78
	 * Returns a listener which implements the correct listener interface for
(-)src/org/eclipse/core/databinding/property/value/SimpleValuePropertyObservableValue.java (-6 / +6 lines)
Lines 102-126 Link Here
102
	}
102
	}
103
103
104
	protected void doSetValue(Object value) {
104
	protected void doSetValue(Object value) {
105
		if (hasListeners()) {
105
		Object oldValue = cachedValue;
106
			Object oldValue = cachedValue;
106
		ValueDiff diff = Diffs.createValueDiff(oldValue, value);
107
107
108
			boolean changed;
108
		if (hasListeners()) {
109
			updating = true;
109
			updating = true;
110
			try {
110
			try {
111
				changed = property.setValue(source, value);
111
				diff = property.setValue(source, value, diff);
112
			} finally {
112
			} finally {
113
				updating = false;
113
				updating = false;
114
			}
114
			}
115
115
116
			if (changed) {
116
			if (diff != null) {
117
				Object newValue = cachedValue = property.getValue(source);
117
				Object newValue = cachedValue = property.getValue(source);
118
				if (hasListeners() && !Util.equals(oldValue, newValue)) {
118
				if (hasListeners() && !Util.equals(oldValue, newValue)) {
119
					fireValueChange(Diffs.createValueDiff(oldValue, newValue));
119
					fireValueChange(Diffs.createValueDiff(oldValue, newValue));
120
				}
120
				}
121
			}
121
			}
122
		} else {
122
		} else {
123
			property.setValue(source, value);
123
			property.setValue(source, value, diff);
124
		}
124
		}
125
	}
125
	}
126
126
(-)src/org/eclipse/core/databinding/property/list/SimpleListProperty.java (-3 / +3 lines)
Lines 105-115 Link Here
105
	 *            the new list
105
	 *            the new list
106
	 * @param diff
106
	 * @param diff
107
	 *            a diff describing the change
107
	 *            a diff describing the change
108
	 * @return true if the property was modified on the source object, false
108
	 * @return a ListDiff describing the change that was made, or null if no
109
	 *         otherwise
109
	 *         change could be made.
110
	 * @noreference This method is not intended to be referenced by clients.
110
	 * @noreference This method is not intended to be referenced by clients.
111
	 */
111
	 */
112
	protected abstract boolean setList(Object source, List list, ListDiff diff);
112
	protected abstract ListDiff setList(Object source, List list, ListDiff diff);
113
113
114
	// Listeners
114
	// Listeners
115
115
(-)src/org/eclipse/core/databinding/property/list/SimpleListPropertyObservableList.java (-40 / +27 lines)
Lines 166-185 Link Here
166
	public void add(int index, Object o) {
166
	public void add(int index, Object o) {
167
		checkRealm();
167
		checkRealm();
168
		boolean wasUpdating = updating;
168
		boolean wasUpdating = updating;
169
		boolean changed;
170
		updating = true;
169
		updating = true;
171
		List list = new ArrayList(getList());
170
		List list = new ArrayList(getList());
172
		list.add(index, o);
171
		list.add(index, o);
173
		ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
172
		ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
174
				true, o));
173
				true, o));
175
		try {
174
		try {
176
			changed = property.setList(source, list, diff);
175
			diff = property.setList(source, list, diff);
177
			modCount++;
176
			modCount++;
178
		} finally {
177
		} finally {
179
			updating = wasUpdating;
178
			updating = wasUpdating;
180
		}
179
		}
181
180
182
		if (changed) {
181
		if (diff != null) {
183
			cachedList = getList();
182
			cachedList = getList();
184
			fireListChange(diff);
183
			fireListChange(diff);
185
		}
184
		}
Lines 220-235 Link Here
220
						lastIndex, false, lastElement));
219
						lastIndex, false, lastElement));
221
220
222
				boolean wasUpdating = updating;
221
				boolean wasUpdating = updating;
223
				boolean changed;
224
				updating = true;
222
				updating = true;
225
				try {
223
				try {
226
					changed = property.setList(source, list, diff);
224
					diff = property.setList(source, list, diff);
227
					modCount++;
225
					modCount++;
228
				} finally {
226
				} finally {
229
					updating = wasUpdating;
227
					updating = wasUpdating;
230
				}
228
				}
231
229
232
				if (changed) {
230
				if (diff != null) {
233
					cachedList = getList();
231
					cachedList = getList();
234
					fireListChange(diff);
232
					fireListChange(diff);
235
233
Lines 268-283 Link Here
268
				true, element));
266
				true, element));
269
267
270
		boolean wasUpdating = updating;
268
		boolean wasUpdating = updating;
271
		boolean changed;
272
		updating = true;
269
		updating = true;
273
		try {
270
		try {
274
			changed = property.setList(source, list, diff);
271
			diff = property.setList(source, list, diff);
275
			modCount++;
272
			modCount++;
276
		} finally {
273
		} finally {
277
			updating = wasUpdating;
274
			updating = wasUpdating;
278
		}
275
		}
279
276
280
		if (changed) {
277
		if (diff != null) {
281
			cachedList = getList();
278
			cachedList = getList();
282
			fireListChange(diff);
279
			fireListChange(diff);
283
		}
280
		}
Lines 363-378 Link Here
363
				ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
360
				ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
364
						index, true, o));
361
						index, true, o));
365
				boolean wasUpdating = updating;
362
				boolean wasUpdating = updating;
366
				boolean changed;
367
				updating = true;
363
				updating = true;
368
				try {
364
				try {
369
					changed = property.setList(source, list, diff);
365
					diff = property.setList(source, list, diff);
370
					modCount++;
366
					modCount++;
371
				} finally {
367
				} finally {
372
					updating = wasUpdating;
368
					updating = wasUpdating;
373
				}
369
				}
374
370
375
				if (changed) {
371
				if (diff != null) {
376
					cachedList = getList();
372
					cachedList = getList();
377
					fireListChange(diff);
373
					fireListChange(diff);
378
374
Lines 392-407 Link Here
392
						.createListDiffEntry(lastIndex, true, o));
388
						.createListDiffEntry(lastIndex, true, o));
393
389
394
				boolean wasUpdating = updating;
390
				boolean wasUpdating = updating;
395
				boolean changed;
396
				updating = true;
391
				updating = true;
397
				try {
392
				try {
398
					changed = property.setList(source, list, diff);
393
					diff = property.setList(source, list, diff);
399
					modCount++;
394
					modCount++;
400
				} finally {
395
				} finally {
401
					updating = wasUpdating;
396
					updating = wasUpdating;
402
				}
397
				}
403
398
404
				if (changed) {
399
				if (diff != null) {
405
					cachedList = getList();
400
					cachedList = getList();
406
					fireListChange(diff);
401
					fireListChange(diff);
407
402
Lines 422-437 Link Here
422
						lastIndex, false, lastElement));
417
						lastIndex, false, lastElement));
423
418
424
				boolean wasUpdating = updating;
419
				boolean wasUpdating = updating;
425
				boolean changed;
426
				updating = true;
420
				updating = true;
427
				try {
421
				try {
428
					changed = property.setList(source, list, diff);
422
					diff = property.setList(source, list, diff);
429
					modCount++;
423
					modCount++;
430
				} finally {
424
				} finally {
431
					updating = wasUpdating;
425
					updating = wasUpdating;
432
				}
426
				}
433
427
434
				if (changed) {
428
				if (diff != null) {
435
					cachedList = getList();
429
					cachedList = getList();
436
					fireListChange(diff);
430
					fireListChange(diff);
437
431
Lines 457-472 Link Here
457
				false, element));
451
				false, element));
458
452
459
		boolean wasUpdating = updating;
453
		boolean wasUpdating = updating;
460
		boolean changed;
461
		updating = true;
454
		updating = true;
462
		try {
455
		try {
463
			changed = property.setList(source, list, diff);
456
			diff = property.setList(source, list, diff);
464
			modCount++;
457
			modCount++;
465
		} finally {
458
		} finally {
466
			updating = wasUpdating;
459
			updating = wasUpdating;
467
		}
460
		}
468
461
469
		if (changed) {
462
		if (diff != null) {
470
			cachedList = getList();
463
			cachedList = getList();
471
			fireListChange(diff);
464
			fireListChange(diff);
472
		}
465
		}
Lines 484-499 Link Here
484
				false, oldElement), Diffs.createListDiffEntry(index, true, o));
477
				false, oldElement), Diffs.createListDiffEntry(index, true, o));
485
478
486
		boolean wasUpdating = updating;
479
		boolean wasUpdating = updating;
487
		boolean changed;
488
		updating = true;
480
		updating = true;
489
		try {
481
		try {
490
			changed = property.setList(source, list, diff);
482
			diff = property.setList(source, list, diff);
491
			modCount++;
483
			modCount++;
492
		} finally {
484
		} finally {
493
			updating = wasUpdating;
485
			updating = wasUpdating;
494
		}
486
		}
495
487
496
		if (changed) {
488
		if (diff != null) {
497
			cachedList = getList();
489
			cachedList = getList();
498
			fireListChange(diff);
490
			fireListChange(diff);
499
		}
491
		}
Lines 534-556 Link Here
534
		}
526
		}
535
		ListDiff diff = Diffs.createListDiff(entries);
527
		ListDiff diff = Diffs.createListDiff(entries);
536
528
537
		boolean changed;
538
539
		boolean wasUpdating = updating;
529
		boolean wasUpdating = updating;
540
		updating = true;
530
		updating = true;
541
		try {
531
		try {
542
			changed = property.setList(source, list, diff);
532
			diff = property.setList(source, list, diff);
543
			modCount++;
533
			modCount++;
544
		} finally {
534
		} finally {
545
			updating = wasUpdating;
535
			updating = wasUpdating;
546
		}
536
		}
547
537
548
		if (changed) {
538
		if (diff != null) {
549
			cachedList = getList();
539
			cachedList = getList();
550
			fireListChange(diff);
540
			fireListChange(diff);
551
		}
541
		}
552
542
553
		return changed;
543
		return diff != null;
554
	}
544
	}
555
545
556
	public boolean removeAll(Collection c) {
546
	public boolean removeAll(Collection c) {
Lines 568-574 Link Here
568
		ListDiff diff;
558
		ListDiff diff;
569
559
570
		boolean wasUpdating = updating;
560
		boolean wasUpdating = updating;
571
		boolean changed;
572
		updating = true;
561
		updating = true;
573
		try {
562
		try {
574
			for (ListIterator it = list.listIterator(); it.hasNext();) {
563
			for (ListIterator it = list.listIterator(); it.hasNext();) {
Lines 585-602 Link Here
585
574
586
			diff = Diffs.createListDiff((ListDiffEntry[]) entries
575
			diff = Diffs.createListDiff((ListDiffEntry[]) entries
587
					.toArray(new ListDiffEntry[entries.size()]));
576
					.toArray(new ListDiffEntry[entries.size()]));
588
			changed = property.setList(source, list, diff);
577
			diff = property.setList(source, list, diff);
589
			modCount++;
578
			modCount++;
590
		} finally {
579
		} finally {
591
			updating = wasUpdating;
580
			updating = wasUpdating;
592
		}
581
		}
593
582
594
		if (changed) {
583
		if (diff != null) {
595
			cachedList = getList();
584
			cachedList = getList();
596
			fireListChange(diff);
585
			fireListChange(diff);
597
		}
586
		}
598
587
599
		return changed;
588
		return diff != null;
600
	}
589
	}
601
590
602
	public boolean retainAll(Collection c) {
591
	public boolean retainAll(Collection c) {
Lines 616-622 Link Here
616
		ListDiff diff;
605
		ListDiff diff;
617
606
618
		boolean wasUpdating = updating;
607
		boolean wasUpdating = updating;
619
		boolean changed;
620
		updating = true;
608
		updating = true;
621
		try {
609
		try {
622
			for (ListIterator it = list.listIterator(); it.hasNext();) {
610
			for (ListIterator it = list.listIterator(); it.hasNext();) {
Lines 633-650 Link Here
633
621
634
			diff = Diffs.createListDiff((ListDiffEntry[]) entries
622
			diff = Diffs.createListDiff((ListDiffEntry[]) entries
635
					.toArray(new ListDiffEntry[entries.size()]));
623
					.toArray(new ListDiffEntry[entries.size()]));
636
			changed = property.setList(source, list, diff);
624
			diff = property.setList(source, list, diff);
637
			modCount++;
625
			modCount++;
638
		} finally {
626
		} finally {
639
			updating = wasUpdating;
627
			updating = wasUpdating;
640
		}
628
		}
641
629
642
		if (changed) {
630
		if (diff != null) {
643
			cachedList = getList();
631
			cachedList = getList();
644
			fireListChange(diff);
632
			fireListChange(diff);
645
		}
633
		}
646
634
647
		return changed;
635
		return diff != null;
648
	}
636
	}
649
637
650
	public void clear() {
638
	public void clear() {
Lines 663-678 Link Here
663
		ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries
651
		ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries
664
				.toArray(new ListDiffEntry[entries.size()]));
652
				.toArray(new ListDiffEntry[entries.size()]));
665
		boolean wasUpdating = updating;
653
		boolean wasUpdating = updating;
666
		boolean changed;
667
		updating = true;
654
		updating = true;
668
		try {
655
		try {
669
			changed = property.setList(source, Collections.EMPTY_LIST, diff);
656
			diff = property.setList(source, Collections.EMPTY_LIST, diff);
670
			modCount++;
657
			modCount++;
671
		} finally {
658
		} finally {
672
			updating = wasUpdating;
659
			updating = wasUpdating;
673
		}
660
		}
674
661
675
		if (changed) {
662
		if (diff != null) {
676
			cachedList = getList();
663
			cachedList = getList();
677
			fireListChange(diff);
664
			fireListChange(diff);
678
		}
665
		}
(-)src/org/eclipse/core/internal/databinding/beans/BeanSetProperty.java (-3 / +3 lines)
Lines 68-79 Link Here
68
		return (Set) propertyValue;
68
		return (Set) propertyValue;
69
	}
69
	}
70
70
71
	protected boolean setSet(Object source, Set set, SetDiff diff) {
71
	protected SetDiff setSet(Object source, Set set, SetDiff diff) {
72
		if (source == null)
72
		if (source == null)
73
			return false;
73
			return null;
74
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
74
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
75
				convertSetToBeanPropertyType(set));
75
				convertSetToBeanPropertyType(set));
76
		return true;
76
		return diff;
77
	}
77
	}
78
78
79
	private Object convertSetToBeanPropertyType(Set set) {
79
	private Object convertSetToBeanPropertyType(Set set) {
(-)src/org/eclipse/core/internal/databinding/beans/PojoValueProperty.java (-3 / +4 lines)
Lines 14-19 Link Here
14
import java.beans.PropertyDescriptor;
14
import java.beans.PropertyDescriptor;
15
15
16
import org.eclipse.core.databinding.beans.IBeanProperty;
16
import org.eclipse.core.databinding.beans.IBeanProperty;
17
import org.eclipse.core.databinding.observable.value.ValueDiff;
17
import org.eclipse.core.databinding.property.INativePropertyListener;
18
import org.eclipse.core.databinding.property.INativePropertyListener;
18
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
19
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
19
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
20
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
Lines 48-58 Link Here
48
		return BeanPropertyHelper.readProperty(source, propertyDescriptor);
49
		return BeanPropertyHelper.readProperty(source, propertyDescriptor);
49
	}
50
	}
50
51
51
	public boolean setValue(Object source, Object value) {
52
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
52
		if (source == null)
53
		if (source == null)
53
			return false;
54
			return null;
54
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, value);
55
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, value);
55
		return true;
56
		return diff;
56
	}
57
	}
57
58
58
	public PropertyDescriptor getPropertyDescriptor() {
59
	public PropertyDescriptor getPropertyDescriptor() {
(-)src/org/eclipse/core/internal/databinding/beans/PojoSetProperty.java (-3 / +3 lines)
Lines 64-75 Link Here
64
		return (Set) propertyValue;
64
		return (Set) propertyValue;
65
	}
65
	}
66
66
67
	protected boolean setSet(Object source, Set set, SetDiff diff) {
67
	protected SetDiff setSet(Object source, Set set, SetDiff diff) {
68
		if (source == null)
68
		if (source == null)
69
			return false;
69
			return null;
70
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
70
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
71
				convertSetToBeanPropertyType(set));
71
				convertSetToBeanPropertyType(set));
72
		return true;
72
		return diff;
73
	}
73
	}
74
74
75
	private Object convertSetToBeanPropertyType(Set set) {
75
	private Object convertSetToBeanPropertyType(Set set) {
(-)src/org/eclipse/core/internal/databinding/beans/BeanListProperty.java (-3 / +3 lines)
Lines 69-80 Link Here
69
		return (List) propertyValue;
69
		return (List) propertyValue;
70
	}
70
	}
71
71
72
	protected boolean setList(Object source, List list, ListDiff diff) {
72
	protected ListDiff setList(Object source, List list, ListDiff diff) {
73
		if (source == null)
73
		if (source == null)
74
			return false;
74
			return null;
75
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
75
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
76
				convertListToBeanPropertyType(list));
76
				convertListToBeanPropertyType(list));
77
		return true;
77
		return diff;
78
	}
78
	}
79
79
80
	private Object convertListToBeanPropertyType(List list) {
80
	private Object convertListToBeanPropertyType(List list) {
(-)src/org/eclipse/core/internal/databinding/beans/PojoMapProperty.java (-3 / +3 lines)
Lines 65-75 Link Here
65
		return (Map) propertyValue;
65
		return (Map) propertyValue;
66
	}
66
	}
67
67
68
	protected boolean setMap(Object source, Map map, MapDiff diff) {
68
	protected MapDiff setMap(Object source, Map map, MapDiff diff) {
69
		if (source == null)
69
		if (source == null)
70
			return false;
70
			return null;
71
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, map);
71
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, map);
72
		return true;
72
		return diff;
73
	}
73
	}
74
74
75
	public PropertyDescriptor getPropertyDescriptor() {
75
	public PropertyDescriptor getPropertyDescriptor() {
(-)src/org/eclipse/core/internal/databinding/beans/BeanMapProperty.java (-3 / +3 lines)
Lines 69-79 Link Here
69
		return (Map) propertyValue;
69
		return (Map) propertyValue;
70
	}
70
	}
71
71
72
	protected boolean setMap(Object source, Map map, MapDiff diff) {
72
	protected MapDiff setMap(Object source, Map map, MapDiff diff) {
73
		if (source == null)
73
		if (source == null)
74
			return false;
74
			return null;
75
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, map);
75
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, map);
76
		return true;
76
		return diff;
77
	}
77
	}
78
78
79
	public PropertyDescriptor getPropertyDescriptor() {
79
	public PropertyDescriptor getPropertyDescriptor() {
(-)src/org/eclipse/core/internal/databinding/beans/PojoListProperty.java (-3 / +3 lines)
Lines 65-76 Link Here
65
		return (List) propertyValue;
65
		return (List) propertyValue;
66
	}
66
	}
67
67
68
	protected boolean setList(Object source, List list, ListDiff diff) {
68
	protected ListDiff setList(Object source, List list, ListDiff diff) {
69
		if (source == null)
69
		if (source == null)
70
			return false;
70
			return null;
71
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
71
		BeanPropertyHelper.writeProperty(source, propertyDescriptor,
72
				convertListToBeanPropertyType(list));
72
				convertListToBeanPropertyType(list));
73
		return true;
73
		return diff;
74
	}
74
	}
75
75
76
	private Object convertListToBeanPropertyType(List list) {
76
	private Object convertListToBeanPropertyType(List list) {
(-)src/org/eclipse/core/internal/databinding/beans/BeanValueProperty.java (-3 / +3 lines)
Lines 53-63 Link Here
53
		return BeanPropertyHelper.readProperty(source, propertyDescriptor);
53
		return BeanPropertyHelper.readProperty(source, propertyDescriptor);
54
	}
54
	}
55
55
56
	public boolean setValue(Object source, Object value) {
56
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
57
		if (source == null)
57
		if (source == null)
58
			return false;
58
			return null;
59
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, value);
59
		BeanPropertyHelper.writeProperty(source, propertyDescriptor, value);
60
		return true;
60
		return diff;
61
	}
61
	}
62
62
63
	public PropertyDescriptor getPropertyDescriptor() {
63
	public PropertyDescriptor getPropertyDescriptor() {
(-)src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderSingleSelectionProperty.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.viewers;
12
package org.eclipse.jface.internal.databinding.viewers;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
14
import org.eclipse.core.databinding.property.INativePropertyListener;
15
import org.eclipse.core.databinding.property.INativePropertyListener;
15
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
16
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
16
import org.eclipse.core.databinding.property.value.ValuePropertyChangeEvent;
17
import org.eclipse.core.databinding.property.value.ValuePropertyChangeEvent;
Lines 39-51 Link Here
39
		return null;
40
		return null;
40
	}
41
	}
41
42
42
	public boolean setValue(Object source, Object value) {
43
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
43
		if (source == null)
44
		if (source == null)
44
			return false;
45
			return null;
45
		((ISelectionProvider) source)
46
		((ISelectionProvider) source)
46
				.setSelection(value == null ? StructuredSelection.EMPTY
47
				.setSelection(value == null ? StructuredSelection.EMPTY
47
						: new StructuredSelection(value));
48
						: new StructuredSelection(value));
48
		return true;
49
		return diff;
49
	}
50
	}
50
51
51
	public INativePropertyListener adaptListener(
52
	public INativePropertyListener adaptListener(
(-)src/org/eclipse/jface/internal/databinding/viewers/ViewerInputProperty.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.viewers;
12
package org.eclipse.jface.internal.databinding.viewers;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
14
import org.eclipse.core.databinding.property.INativePropertyListener;
15
import org.eclipse.core.databinding.property.INativePropertyListener;
15
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
16
import org.eclipse.core.databinding.property.value.IValuePropertyChangeListener;
16
import org.eclipse.jface.viewers.Viewer;
17
import org.eclipse.jface.viewers.Viewer;
Lines 28-38 Link Here
28
		return ((Viewer) source).getInput();
29
		return ((Viewer) source).getInput();
29
	}
30
	}
30
31
31
	public boolean setValue(Object source, Object value) {
32
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
32
		if (source == null)
33
		if (source == null)
33
			return false;
34
			return null;
34
		((Viewer) source).setInput(value);
35
		((Viewer) source).setInput(value);
35
		return true;
36
		return diff;
36
	}
37
	}
37
38
38
	public INativePropertyListener adaptListener(
39
	public INativePropertyListener adaptListener(
(-)src/org/eclipse/jface/internal/databinding/viewers/StructuredViewerFiltersProperty.java (-3 / +3 lines)
Lines 35-43 Link Here
35
				.getFilters()));
35
				.getFilters()));
36
	}
36
	}
37
37
38
	public boolean setSet(Object source, Set set, SetDiff diff) {
38
	public SetDiff setSet(Object source, Set set, SetDiff diff) {
39
		if (source == null)
39
		if (source == null)
40
			return false;
40
			return null;
41
		StructuredViewer viewer = (StructuredViewer) source;
41
		StructuredViewer viewer = (StructuredViewer) source;
42
		viewer.getControl().setRedraw(false);
42
		viewer.getControl().setRedraw(false);
43
		try {
43
		try {
Lines 46-52 Link Here
46
		} finally {
46
		} finally {
47
			viewer.getControl().setRedraw(true);
47
			viewer.getControl().setRedraw(true);
48
		}
48
		}
49
		return true;
49
		return diff;
50
	}
50
	}
51
51
52
	public INativePropertyListener adaptListener(
52
	public INativePropertyListener adaptListener(
(-)src/org/eclipse/jface/internal/databinding/viewers/CheckableCheckedElementsProperty.java (-3 / +3 lines)
Lines 62-70 Link Here
62
		return new HashSet();
62
		return new HashSet();
63
	}
63
	}
64
64
65
	protected boolean setSet(Object source, Set set, SetDiff diff) {
65
	protected SetDiff setSet(Object source, Set set, SetDiff diff) {
66
		if (source == null)
66
		if (source == null)
67
			return false;
67
			return null;
68
		ICheckable checkable = (ICheckable) source;
68
		ICheckable checkable = (ICheckable) source;
69
		for (Iterator it = diff.getAdditions().iterator(); it.hasNext();) {
69
		for (Iterator it = diff.getAdditions().iterator(); it.hasNext();) {
70
			checkable.setChecked(it.next(), true);
70
			checkable.setChecked(it.next(), true);
Lines 72-78 Link Here
72
		for (Iterator it = diff.getRemovals().iterator(); it.hasNext();) {
72
		for (Iterator it = diff.getRemovals().iterator(); it.hasNext();) {
73
			checkable.setChecked(it.next(), false);
73
			checkable.setChecked(it.next(), false);
74
		}
74
		}
75
		return true;
75
		return diff;
76
	}
76
	}
77
77
78
	public INativePropertyListener adaptListener(
78
	public INativePropertyListener adaptListener(
(-)src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderMultipleSelectionProperty.java (-3 / +3 lines)
Lines 43-54 Link Here
43
		return Collections.EMPTY_LIST;
43
		return Collections.EMPTY_LIST;
44
	}
44
	}
45
45
46
	protected boolean setList(Object source, List list, ListDiff diff) {
46
	protected ListDiff setList(Object source, List list, ListDiff diff) {
47
		if (source == null)
47
		if (source == null)
48
			return false;
48
			return null;
49
		((ISelectionProvider) source)
49
		((ISelectionProvider) source)
50
				.setSelection(new StructuredSelection(list));
50
				.setSelection(new StructuredSelection(list));
51
		return true;
51
		return diff;
52
	}
52
	}
53
53
54
	public INativePropertyListener adaptListener(
54
	public INativePropertyListener adaptListener(
(-)src/org/eclipse/jface/internal/databinding/swt/WidgetBooleanValueProperty.java (-4 / +9 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.Diffs;
15
import org.eclipse.core.databinding.observable.value.ValueDiff;
16
14
/**
17
/**
15
 * @since 3.3
18
 * @since 3.3
16
 * 
19
 * 
Lines 36-48 Link Here
36
		return doGetBooleanValue(source) ? Boolean.TRUE : Boolean.FALSE;
39
		return doGetBooleanValue(source) ? Boolean.TRUE : Boolean.FALSE;
37
	}
40
	}
38
41
39
	public boolean setValue(Object source, Object value) {
42
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
40
		if (source == null)
43
		if (source == null)
41
			return false;
44
			return null;
42
		if (value == null)
45
		if (value == null) {
43
			value = Boolean.FALSE;
46
			value = Boolean.FALSE;
47
			diff = Diffs.createValueDiff(diff.getOldValue(), value);
48
		}
44
		doSetBooleanValue(source, ((Boolean) value).booleanValue());
49
		doSetBooleanValue(source, ((Boolean) value).booleanValue());
45
		return true;
50
		return diff;
46
	}
51
	}
47
52
48
	abstract boolean doGetBooleanValue(Object source);
53
	abstract boolean doGetBooleanValue(Object source);
(-)src/org/eclipse/jface/internal/databinding/swt/ControlStringListProperty.java (-3 / +3 lines)
Lines 28-39 Link Here
28
		return String.class;
28
		return String.class;
29
	}
29
	}
30
30
31
	protected boolean setList(Object source, List list, ListDiff diff) {
31
	protected ListDiff setList(Object source, List list, ListDiff diff) {
32
		if (source == null)
32
		if (source == null)
33
			return false;
33
			return null;
34
		String[] strings = (String[]) list.toArray(new String[list.size()]);
34
		String[] strings = (String[]) list.toArray(new String[list.size()]);
35
		doSetStringList((Control) source, strings);
35
		doSetStringList((Control) source, strings);
36
		return true;
36
		return diff;
37
	}
37
	}
38
38
39
	abstract void doSetStringList(Control control, String[] list);
39
	abstract void doSetStringList(Control control, String[] list);
(-)src/org/eclipse/jface/internal/databinding/swt/ControlBackgroundProperty.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
14
import org.eclipse.swt.graphics.Color;
15
import org.eclipse.swt.graphics.Color;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.Control;
16
17
Lines 27-37 Link Here
27
		return ((Control) source).getBackground();
28
		return ((Control) source).getBackground();
28
	}
29
	}
29
30
30
	public boolean setValue(Object source, Object value) {
31
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
31
		if (source == null)
32
		if (source == null)
32
			return false;
33
			return null;
33
		((Control) source).setBackground((Color) value);
34
		((Control) source).setBackground((Color) value);
34
		return true;
35
		return diff;
35
	}
36
	}
36
37
37
	public String toString() {
38
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/ControlSizeProperty.java (-3 / +4 lines)
Lines 12-17 Link Here
12
12
13
package org.eclipse.jface.internal.databinding.swt;
13
package org.eclipse.jface.internal.databinding.swt;
14
14
15
import org.eclipse.core.databinding.observable.value.ValueDiff;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.graphics.Point;
17
import org.eclipse.swt.graphics.Point;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Control;
Lines 36-46 Link Here
36
		return ((Control) source).getSize();
37
		return ((Control) source).getSize();
37
	}
38
	}
38
39
39
	public boolean setValue(Object source, Object value) {
40
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
40
		if (source == null)
41
		if (source == null)
41
			return false;
42
			return null;
42
		((Control) source).setSize((Point) value);
43
		((Control) source).setSize((Point) value);
43
		return true;
44
		return diff;
44
	}
45
	}
45
46
46
	public String toString() {
47
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/WidgetStringValueProperty.java (-3 / +5 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
15
14
/**
16
/**
15
 * @since 3.3
17
 * @since 3.3
16
 * 
18
 * 
Lines 32-42 Link Here
32
		return doGetStringValue(source);
34
		return doGetStringValue(source);
33
	}
35
	}
34
36
35
	public boolean setValue(Object source, Object value) {
37
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
36
		if (source == null)
38
		if (source == null)
37
			return false;
39
			return null;
38
		doSetStringValue(source, (String) value);
40
		doSetStringValue(source, (String) value);
39
		return true;
41
		return diff;
40
	}
42
	}
41
43
42
	abstract String doGetStringValue(Object source);
44
	abstract String doGetStringValue(Object source);
(-)src/org/eclipse/jface/internal/databinding/swt/ControlFontProperty.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
14
import org.eclipse.swt.graphics.Font;
15
import org.eclipse.swt.graphics.Font;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.Control;
16
17
Lines 27-37 Link Here
27
		return ((Control) source).getFont();
28
		return ((Control) source).getFont();
28
	}
29
	}
29
30
30
	public boolean setValue(Object source, Object value) {
31
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
31
		if (source == null)
32
		if (source == null)
32
			return false;
33
			return null;
33
		((Control) source).setFont((Font) value);
34
		((Control) source).setFont((Font) value);
34
		return true;
35
		return diff;
35
	}
36
	}
36
37
37
	public String toString() {
38
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/ControlBoundsProperty.java (-3 / +4 lines)
Lines 12-17 Link Here
12
12
13
package org.eclipse.jface.internal.databinding.swt;
13
package org.eclipse.jface.internal.databinding.swt;
14
14
15
import org.eclipse.core.databinding.observable.value.ValueDiff;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.graphics.Rectangle;
17
import org.eclipse.swt.graphics.Rectangle;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Control;
Lines 36-46 Link Here
36
		return ((Control) source).getBounds();
37
		return ((Control) source).getBounds();
37
	}
38
	}
38
39
39
	public boolean setValue(Object source, Object value) {
40
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
40
		if (source == null)
41
		if (source == null)
41
			return false;
42
			return null;
42
		((Control) source).setBounds((Rectangle) value);
43
		((Control) source).setBounds((Rectangle) value);
43
		return true;
44
		return diff;
44
	}
45
	}
45
46
46
	public String toString() {
47
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/ControlLocationProperty.java (-3 / +4 lines)
Lines 12-17 Link Here
12
12
13
package org.eclipse.jface.internal.databinding.swt;
13
package org.eclipse.jface.internal.databinding.swt;
14
14
15
import org.eclipse.core.databinding.observable.value.ValueDiff;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.graphics.Point;
17
import org.eclipse.swt.graphics.Point;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Control;
Lines 36-46 Link Here
36
		return ((Control) source).getLocation();
37
		return ((Control) source).getLocation();
37
	}
38
	}
38
39
39
	public boolean setValue(Object source, Object value) {
40
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
40
		if (source == null)
41
		if (source == null)
41
			return false;
42
			return null;
42
		((Control) source).setLocation((Point) value);
43
		((Control) source).setLocation((Point) value);
43
		return true;
44
		return diff;
44
	}
45
	}
45
46
46
	public String toString() {
47
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/ControlForegroundProperty.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
14
import org.eclipse.swt.graphics.Color;
15
import org.eclipse.swt.graphics.Color;
15
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.Control;
16
17
Lines 27-37 Link Here
27
		return ((Control) source).getForeground();
28
		return ((Control) source).getForeground();
28
	}
29
	}
29
30
30
	public boolean setValue(Object source, Object value) {
31
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
31
		if (source == null)
32
		if (source == null)
32
			return false;
33
			return null;
33
		((Control) source).setForeground((Color) value);
34
		((Control) source).setForeground((Color) value);
34
		return true;
35
		return diff;
35
	}
36
	}
36
37
37
	public String toString() {
38
	public String toString() {
(-)src/org/eclipse/jface/internal/databinding/swt/WidgetIntValueProperty.java (-3 / +5 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.jface.internal.databinding.swt;
12
package org.eclipse.jface.internal.databinding.swt;
13
13
14
import org.eclipse.core.databinding.observable.value.ValueDiff;
15
14
/**
16
/**
15
 * @since 3.3
17
 * @since 3.3
16
 * 
18
 * 
Lines 36-46 Link Here
36
		return new Integer(doGetIntValue(source));
38
		return new Integer(doGetIntValue(source));
37
	}
39
	}
38
40
39
	public boolean setValue(Object source, Object value) {
41
	public ValueDiff setValue(Object source, Object value, ValueDiff diff) {
40
		if (source == null)
42
		if (source == null)
41
			return false;
43
			return null;
42
		doSetIntValue(source, ((Integer) value).intValue());
44
		doSetIntValue(source, ((Integer) value).intValue());
43
		return true;
45
		return diff;
44
	}
46
	}
45
47
46
	abstract int doGetIntValue(Object source);
48
	abstract int doGetIntValue(Object source);

Return to bug 194734