View | Details | Raw Unified | Return to bug 262284 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jface/examples/databinding/snippets/Snippet026AnonymousBeanProperties.java (+4 lines)
Lines 222-227 Link Here
222
	 * and removeContact methods.
222
	 * and removeContact methods.
223
	 */
223
	 */
224
	public static class ContactGroupContactsProperty extends SimpleSetProperty {
224
	public static class ContactGroupContactsProperty extends SimpleSetProperty {
225
		public Object getSourceType() {
226
			return ContactGroup.class;
227
		}
228
225
		public Object getElementType() {
229
		public Object getElementType() {
226
			return Contact.class;
230
			return Contact.class;
227
		}
231
		}
(-)src/org/eclipse/core/internal/databinding/beans/BeanSetProperty.java (-2 / +9 lines)
Lines 31-51 Link Here
31
 * 
31
 * 
32
 */
32
 */
33
public class BeanSetProperty extends SimpleSetProperty {
33
public class BeanSetProperty extends SimpleSetProperty {
34
	private final Class beanClass;
34
	private final PropertyDescriptor propertyDescriptor;
35
	private final PropertyDescriptor propertyDescriptor;
35
	private final Class elementType;
36
	private final Class elementType;
36
37
37
	/**
38
	/**
39
	 * @param beanClass
38
	 * @param propertyDescriptor
40
	 * @param propertyDescriptor
39
	 * @param elementType
41
	 * @param elementType
40
	 */
42
	 */
41
	public BeanSetProperty(PropertyDescriptor propertyDescriptor,
43
	public BeanSetProperty(Class beanClass,
42
			Class elementType) {
44
			PropertyDescriptor propertyDescriptor, Class elementType) {
45
		this.beanClass = beanClass;
43
		this.propertyDescriptor = propertyDescriptor;
46
		this.propertyDescriptor = propertyDescriptor;
44
		this.elementType = elementType == null ? BeanPropertyHelper
47
		this.elementType = elementType == null ? BeanPropertyHelper
45
				.getCollectionPropertyElementType(propertyDescriptor)
48
				.getCollectionPropertyElementType(propertyDescriptor)
46
				: elementType;
49
				: elementType;
47
	}
50
	}
48
51
52
	public Object getSourceType() {
53
		return beanClass;
54
	}
55
49
	public Object getElementType() {
56
	public Object getElementType() {
50
		return elementType;
57
		return elementType;
51
	}
58
	}
(-)src/org/eclipse/core/internal/databinding/beans/BeanPropertyHelper.java (-1 / +1 lines)
Lines 209-215 Link Here
209
	 * @param propertyName
209
	 * @param propertyName
210
	 * @return property descriptor or <code>null</code>
210
	 * @return property descriptor or <code>null</code>
211
	 */
211
	 */
212
	/* package */public static PropertyDescriptor getValueTypePropertyDescriptor(
212
	public static PropertyDescriptor getValueTypePropertyDescriptor(
213
			IObservableValue observable, String propertyName) {
213
			IObservableValue observable, String propertyName) {
214
		if (observable.getValueType() != null)
214
		if (observable.getValueType() != null)
215
			return getPropertyDescriptor((Class) observable.getValueType(),
215
			return getPropertyDescriptor((Class) observable.getValueType(),
(-)src/org/eclipse/core/internal/databinding/beans/PojoValueProperty.java (-2 / +9 lines)
Lines 23-42 Link Here
23
 * 
23
 * 
24
 */
24
 */
25
public class PojoValueProperty extends SimpleValueProperty {
25
public class PojoValueProperty extends SimpleValueProperty {
26
	private final Class beanClass;
26
	private final PropertyDescriptor propertyDescriptor;
27
	private final PropertyDescriptor propertyDescriptor;
27
	private final Class valueType;
28
	private final Class valueType;
28
29
29
	/**
30
	/**
31
	 * @param beanClass
30
	 * @param propertyDescriptor
32
	 * @param propertyDescriptor
31
	 * @param valueType
33
	 * @param valueType
32
	 */
34
	 */
33
	public PojoValueProperty(PropertyDescriptor propertyDescriptor,
35
	public PojoValueProperty(Class beanClass,
34
			Class valueType) {
36
			PropertyDescriptor propertyDescriptor, Class valueType) {
37
		this.beanClass = beanClass;
35
		this.propertyDescriptor = propertyDescriptor;
38
		this.propertyDescriptor = propertyDescriptor;
36
		this.valueType = valueType == null ? propertyDescriptor
39
		this.valueType = valueType == null ? propertyDescriptor
37
				.getPropertyType() : valueType;
40
				.getPropertyType() : valueType;
38
	}
41
	}
39
42
43
	public Object getSourceType() {
44
		return beanClass;
45
	}
46
40
	public Object getValueType() {
47
	public Object getValueType() {
41
		return valueType;
48
		return valueType;
42
	}
49
	}
(-)src/org/eclipse/core/internal/databinding/beans/PojoSetProperty.java (-2 / +9 lines)
Lines 29-49 Link Here
29
 * 
29
 * 
30
 */
30
 */
31
public class PojoSetProperty extends SimpleSetProperty {
31
public class PojoSetProperty extends SimpleSetProperty {
32
	private final Class beanClass;
32
	private final PropertyDescriptor propertyDescriptor;
33
	private final PropertyDescriptor propertyDescriptor;
33
	private final Class elementType;
34
	private final Class elementType;
34
35
35
	/**
36
	/**
37
	 * @param beanClass
36
	 * @param propertyDescriptor
38
	 * @param propertyDescriptor
37
	 * @param elementType
39
	 * @param elementType
38
	 */
40
	 */
39
	public PojoSetProperty(PropertyDescriptor propertyDescriptor,
41
	public PojoSetProperty(Class beanClass,
40
			Class elementType) {
42
			PropertyDescriptor propertyDescriptor, Class elementType) {
43
		this.beanClass = beanClass;
41
		this.propertyDescriptor = propertyDescriptor;
44
		this.propertyDescriptor = propertyDescriptor;
42
		this.elementType = elementType == null ? BeanPropertyHelper
45
		this.elementType = elementType == null ? BeanPropertyHelper
43
				.getCollectionPropertyElementType(propertyDescriptor)
46
				.getCollectionPropertyElementType(propertyDescriptor)
44
				: elementType;
47
				: elementType;
45
	}
48
	}
46
49
50
	public Object getSourceType() {
51
		return beanClass;
52
	}
53
47
	public Object getElementType() {
54
	public Object getElementType() {
48
		return elementType;
55
		return elementType;
49
	}
56
	}
(-)src/org/eclipse/core/internal/databinding/beans/BeanListProperty.java (-2 / +9 lines)
Lines 30-50 Link Here
30
 * 
30
 * 
31
 */
31
 */
32
public class BeanListProperty extends SimpleListProperty {
32
public class BeanListProperty extends SimpleListProperty {
33
	private final Class beanClass;
33
	private final PropertyDescriptor propertyDescriptor;
34
	private final PropertyDescriptor propertyDescriptor;
34
	private final Class elementType;
35
	private final Class elementType;
35
36
36
	/**
37
	/**
38
	 * @param beanClass
37
	 * @param propertyDescriptor
39
	 * @param propertyDescriptor
38
	 * @param elementType
40
	 * @param elementType
39
	 */
41
	 */
40
	public BeanListProperty(PropertyDescriptor propertyDescriptor,
42
	public BeanListProperty(Class beanClass,
41
			Class elementType) {
43
			PropertyDescriptor propertyDescriptor, Class elementType) {
44
		this.beanClass = beanClass;
42
		this.propertyDescriptor = propertyDescriptor;
45
		this.propertyDescriptor = propertyDescriptor;
43
		this.elementType = elementType == null ? BeanPropertyHelper
46
		this.elementType = elementType == null ? BeanPropertyHelper
44
				.getCollectionPropertyElementType(propertyDescriptor)
47
				.getCollectionPropertyElementType(propertyDescriptor)
45
				: elementType;
48
				: elementType;
46
	}
49
	}
47
50
51
	public Object getSourceType() {
52
		return beanClass;
53
	}
54
48
	public Object getElementType() {
55
	public Object getElementType() {
49
		return elementType;
56
		return elementType;
50
	}
57
	}
(-)src/org/eclipse/core/internal/databinding/beans/PojoMapProperty.java (-2 / +10 lines)
Lines 26-47 Link Here
26
 * 
26
 * 
27
 */
27
 */
28
public class PojoMapProperty extends SimpleMapProperty {
28
public class PojoMapProperty extends SimpleMapProperty {
29
	private final Class beanClass;
29
	private final PropertyDescriptor propertyDescriptor;
30
	private final PropertyDescriptor propertyDescriptor;
30
	private final Class keyType;
31
	private final Class keyType;
31
	private final Class valueType;
32
	private final Class valueType;
32
33
33
	/**
34
	/**
35
	 * @param beanClass
34
	 * @param propertyDescriptor
36
	 * @param propertyDescriptor
35
	 * @param keyType
37
	 * @param keyType
36
	 * @param valueType
38
	 * @param valueType
37
	 */
39
	 */
38
	public PojoMapProperty(PropertyDescriptor propertyDescriptor,
40
	public PojoMapProperty(Class beanClass,
39
			Class keyType, Class valueType) {
41
			PropertyDescriptor propertyDescriptor, Class keyType,
42
			Class valueType) {
43
		this.beanClass = beanClass;
40
		this.propertyDescriptor = propertyDescriptor;
44
		this.propertyDescriptor = propertyDescriptor;
41
		this.keyType = keyType;
45
		this.keyType = keyType;
42
		this.valueType = valueType;
46
		this.valueType = valueType;
43
	}
47
	}
44
48
49
	public Object getSourceType() {
50
		return beanClass;
51
	}
52
45
	public Object getKeyType() {
53
	public Object getKeyType() {
46
		return keyType;
54
		return keyType;
47
	}
55
	}
(-)src/org/eclipse/core/internal/databinding/beans/BeanMapProperty.java (-2 / +10 lines)
Lines 28-49 Link Here
28
 * 
28
 * 
29
 */
29
 */
30
public class BeanMapProperty extends SimpleMapProperty {
30
public class BeanMapProperty extends SimpleMapProperty {
31
	private final Class beanClass;
31
	private final PropertyDescriptor propertyDescriptor;
32
	private final PropertyDescriptor propertyDescriptor;
32
	private final Class keyType;
33
	private final Class keyType;
33
	private final Class valueType;
34
	private final Class valueType;
34
35
35
	/**
36
	/**
37
	 * @param beanClass
36
	 * @param propertyDescriptor
38
	 * @param propertyDescriptor
37
	 * @param keyType
39
	 * @param keyType
38
	 * @param valueType
40
	 * @param valueType
39
	 */
41
	 */
40
	public BeanMapProperty(PropertyDescriptor propertyDescriptor,
42
	public BeanMapProperty(Class beanClass,
41
			Class keyType, Class valueType) {
43
			PropertyDescriptor propertyDescriptor, Class keyType,
44
			Class valueType) {
45
		this.beanClass = beanClass;
42
		this.propertyDescriptor = propertyDescriptor;
46
		this.propertyDescriptor = propertyDescriptor;
43
		this.keyType = keyType;
47
		this.keyType = keyType;
44
		this.valueType = valueType;
48
		this.valueType = valueType;
45
	}
49
	}
46
50
51
	public Object getSourceType() {
52
		return beanClass;
53
	}
54
47
	public Object getKeyType() {
55
	public Object getKeyType() {
48
		return keyType;
56
		return keyType;
49
	}
57
	}
(-)src/org/eclipse/core/internal/databinding/beans/PojoListProperty.java (-2 / +9 lines)
Lines 28-48 Link Here
28
 * 
28
 * 
29
 */
29
 */
30
public class PojoListProperty extends SimpleListProperty {
30
public class PojoListProperty extends SimpleListProperty {
31
	private final Class beanClass;
31
	private final PropertyDescriptor propertyDescriptor;
32
	private final PropertyDescriptor propertyDescriptor;
32
	private final Class elementType;
33
	private final Class elementType;
33
34
34
	/**
35
	/**
36
	 * @param beanClass
35
	 * @param propertyDescriptor
37
	 * @param propertyDescriptor
36
	 * @param elementType
38
	 * @param elementType
37
	 */
39
	 */
38
	public PojoListProperty(PropertyDescriptor propertyDescriptor,
40
	public PojoListProperty(Class beanClass,
39
			Class elementType) {
41
			PropertyDescriptor propertyDescriptor, Class elementType) {
42
		this.beanClass = beanClass;
40
		this.propertyDescriptor = propertyDescriptor;
43
		this.propertyDescriptor = propertyDescriptor;
41
		this.elementType = elementType == null ? BeanPropertyHelper
44
		this.elementType = elementType == null ? BeanPropertyHelper
42
				.getCollectionPropertyElementType(propertyDescriptor)
45
				.getCollectionPropertyElementType(propertyDescriptor)
43
				: elementType;
46
				: elementType;
44
	}
47
	}
45
48
49
	public Object getSourceType() {
50
		return beanClass;
51
	}
52
46
	public Object getElementType() {
53
	public Object getElementType() {
47
		return elementType;
54
		return elementType;
48
	}
55
	}
(-)src/org/eclipse/core/internal/databinding/beans/BeanValueProperty.java (-2 / +9 lines)
Lines 25-44 Link Here
25
 * 
25
 * 
26
 */
26
 */
27
public class BeanValueProperty extends SimpleValueProperty {
27
public class BeanValueProperty extends SimpleValueProperty {
28
	private final Class beanClass;
28
	private final PropertyDescriptor propertyDescriptor;
29
	private final PropertyDescriptor propertyDescriptor;
29
	private final Class valueType;
30
	private final Class valueType;
30
31
31
	/**
32
	/**
33
	 * @param beanClass
32
	 * @param propertyDescriptor
34
	 * @param propertyDescriptor
33
	 * @param valueType
35
	 * @param valueType
34
	 */
36
	 */
35
	public BeanValueProperty(PropertyDescriptor propertyDescriptor,
37
	public BeanValueProperty(Class beanClass,
36
			Class valueType) {
38
			PropertyDescriptor propertyDescriptor, Class valueType) {
39
		this.beanClass = beanClass;
37
		this.propertyDescriptor = propertyDescriptor;
40
		this.propertyDescriptor = propertyDescriptor;
38
		this.valueType = valueType == null ? propertyDescriptor
41
		this.valueType = valueType == null ? propertyDescriptor
39
				.getPropertyType() : valueType;
42
				.getPropertyType() : valueType;
40
	}
43
	}
41
44
45
	public Object getSourceType() {
46
		return beanClass;
47
	}
48
42
	public Object getValueType() {
49
	public Object getValueType() {
43
		return valueType;
50
		return valueType;
44
	}
51
	}
(-)src/org/eclipse/core/databinding/beans/PojoProperties.java (-5 / +8 lines)
Lines 118-124 Link Here
118
		} else {
118
		} else {
119
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
119
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
120
					beanClass, propertyNames[0]);
120
					beanClass, propertyNames[0]);
121
			property = new PojoValueProperty(propertyDescriptor, valueType);
121
			property = new PojoValueProperty(beanClass, propertyDescriptor,
122
					valueType);
122
		}
123
		}
123
124
124
		IBeanValueProperty beanProperty = new PojoValuePropertyDecorator(
125
		IBeanValueProperty beanProperty = new PojoValuePropertyDecorator(
Lines 243-249 Link Here
243
		} else {
244
		} else {
244
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
245
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
245
					beanClass, propertyName);
246
					beanClass, propertyName);
246
			property = new PojoSetProperty(propertyDescriptor, elementType);
247
			property = new PojoSetProperty(beanClass, propertyDescriptor,
248
					elementType);
247
		}
249
		}
248
		return new PojoSetPropertyDecorator(property, propertyDescriptor);
250
		return new PojoSetPropertyDecorator(property, propertyDescriptor);
249
	}
251
	}
Lines 316-322 Link Here
316
		} else {
318
		} else {
317
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
319
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
318
					beanClass, propertyName);
320
					beanClass, propertyName);
319
			property = new PojoListProperty(propertyDescriptor, elementType);
321
			property = new PojoListProperty(beanClass, propertyDescriptor,
322
					elementType);
320
		}
323
		}
321
		return new PojoListPropertyDecorator(property, propertyDescriptor);
324
		return new PojoListPropertyDecorator(property, propertyDescriptor);
322
	}
325
	}
Lines 395-402 Link Here
395
		} else {
398
		} else {
396
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
399
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
397
					beanClass, propertyName);
400
					beanClass, propertyName);
398
			property = new PojoMapProperty(propertyDescriptor, keyType,
401
			property = new PojoMapProperty(beanClass, propertyDescriptor,
399
					valueType);
402
					keyType, valueType);
400
		}
403
		}
401
		return new PojoMapPropertyDecorator(property, propertyDescriptor);
404
		return new PojoMapPropertyDecorator(property, propertyDescriptor);
402
	}
405
	}
(-)src/org/eclipse/core/databinding/beans/BeanProperties.java (-5 / +8 lines)
Lines 115-121 Link Here
115
		} else {
115
		} else {
116
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
116
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
117
					beanClass, propertyNames[0]);
117
					beanClass, propertyNames[0]);
118
			property = new BeanValueProperty(propertyDescriptor, valueType);
118
			property = new BeanValueProperty(beanClass, propertyDescriptor,
119
					valueType);
119
		}
120
		}
120
121
121
		IBeanValueProperty beanProperty = new BeanValuePropertyDecorator(
122
		IBeanValueProperty beanProperty = new BeanValuePropertyDecorator(
Lines 240-246 Link Here
240
		} else {
241
		} else {
241
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
242
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
242
					beanClass, propertyName);
243
					beanClass, propertyName);
243
			property = new BeanSetProperty(propertyDescriptor, elementType);
244
			property = new BeanSetProperty(beanClass, propertyDescriptor,
245
					elementType);
244
		}
246
		}
245
		return new BeanSetPropertyDecorator(property, propertyDescriptor);
247
		return new BeanSetPropertyDecorator(property, propertyDescriptor);
246
	}
248
	}
Lines 313-319 Link Here
313
		} else {
315
		} else {
314
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
316
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
315
					beanClass, propertyName);
317
					beanClass, propertyName);
316
			property = new BeanListProperty(propertyDescriptor, elementType);
318
			property = new BeanListProperty(beanClass, propertyDescriptor,
319
					elementType);
317
		}
320
		}
318
		return new BeanListPropertyDecorator(property, propertyDescriptor);
321
		return new BeanListPropertyDecorator(property, propertyDescriptor);
319
	}
322
	}
Lines 392-399 Link Here
392
		} else {
395
		} else {
393
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
396
			propertyDescriptor = BeanPropertyHelper.getPropertyDescriptor(
394
					beanClass, propertyName);
397
					beanClass, propertyName);
395
			property = new BeanMapProperty(propertyDescriptor, keyType,
398
			property = new BeanMapProperty(beanClass, propertyDescriptor,
396
					valueType);
399
					keyType, valueType);
397
		}
400
		}
398
		return new BeanMapPropertyDecorator(property, propertyDescriptor);
401
		return new BeanMapPropertyDecorator(property, propertyDescriptor);
399
	}
402
	}
(-)src/org/eclipse/jface/databinding/util/JFaceProperties.java (-1 / +1 lines)
Lines 41-47 Link Here
41
	 */
41
	 */
42
	public static IValueProperty value(Class clazz, String fieldName,
42
	public static IValueProperty value(Class clazz, String fieldName,
43
			String propertyName) {
43
			String propertyName) {
44
		return new JFaceProperty(fieldName, propertyName, clazz);
44
		return new JFaceProperty(clazz, fieldName, propertyName);
45
	}
45
	}
46
46
47
}
47
}
(-)src/org/eclipse/jface/internal/databinding/swt/ComboSingleSelectionIndexProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Combo.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((Combo) source).getSelectionIndex();
34
		return ((Combo) source).getSelectionIndex();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TextTextProperty.java (+4 lines)
Lines 59-64 Link Here
59
		return new int[] { SWT.Modify };
59
		return new int[] { SWT.Modify };
60
	}
60
	}
61
61
62
	public Object getSourceType() {
63
		return Text.class;
64
	}
65
62
	String doGetStringValue(Object source) {
66
	String doGetStringValue(Object source) {
63
		return ((Text) source).getText();
67
		return ((Text) source).getText();
64
	}
68
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TrayItemTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class TrayItemTooltipTextProperty extends WidgetStringValueProperty {
21
public class TrayItemTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return TrayItem.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((TrayItem) source).getToolTipText();
27
		return ((TrayItem) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ItemTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ItemTextProperty extends WidgetStringValueProperty {
20
public class ItemTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Item.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Item) source).getText();
26
		return ((Item) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlVisibleProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ControlVisibleProperty extends WidgetBooleanValueProperty {
20
public class ControlVisibleProperty extends WidgetBooleanValueProperty {
21
	public Object getSourceType() {
22
		return Control.class;
23
	}
24
21
	boolean doGetBooleanValue(Object source) {
25
	boolean doGetBooleanValue(Object source) {
22
		return ((Control) source).getVisible();
26
		return ((Control) source).getVisible();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlEnabledProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ControlEnabledProperty extends WidgetBooleanValueProperty {
20
public class ControlEnabledProperty extends WidgetBooleanValueProperty {
21
	public Object getSourceType() {
22
		return Control.class;
23
	}
24
21
	public boolean doGetBooleanValue(Object source) {
25
	public boolean doGetBooleanValue(Object source) {
22
		return ((Control) source).getEnabled();
26
		return ((Control) source).getEnabled();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ToolTipMessageProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ToolTipMessageProperty extends WidgetStringValueProperty {
20
public class ToolTipMessageProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return ToolTip.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((ToolTip) source).getMessage();
26
		return ((ToolTip) source).getMessage();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ListSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Selection);
26
		super(SWT.Selection);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return List.class;
31
	}
32
29
	String doGetStringValue(Object source) {
33
	String doGetStringValue(Object source) {
30
		List list = (List) source;
34
		List list = (List) source;
31
		int index = list.getSelectionIndex();
35
		int index = list.getSelectionIndex();
(-)src/org/eclipse/jface/internal/databinding/swt/ButtonSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Selection);
26
		super(SWT.Selection);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Button.class;
31
	}
32
29
	boolean doGetBooleanValue(Object source) {
33
	boolean doGetBooleanValue(Object source) {
30
		return ((Button) source).getSelection();
34
		return ((Button) source).getSelection();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/LabelImageProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class LabelImageProperty extends WidgetImageValueProperty {
21
public class LabelImageProperty extends WidgetImageValueProperty {
22
	public Object getSourceType() {
23
		return Label.class;
24
	}
25
22
	Image doGetImageValue(Object source) {
26
	Image doGetImageValue(Object source) {
23
		return ((Label) source).getImage();
27
		return ((Label) source).getImage();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TextMessageProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class TextMessageProperty extends WidgetStringValueProperty {
20
public class TextMessageProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Text.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Text) source).getMessage();
26
		return ((Text) source).getMessage();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TableColumnTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class TableColumnTooltipTextProperty extends WidgetStringValueProperty {
21
public class TableColumnTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return TableColumn.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((TableColumn) source).getToolTipText();
27
		return ((TableColumn) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlLocationProperty.java (+4 lines)
Lines 30-35 Link Here
30
		super(SWT.Move);
30
		super(SWT.Move);
31
	}
31
	}
32
32
33
	public Object getSourceType() {
34
		return Control.class;
35
	}
36
33
	public Object getValueType() {
37
	public Object getValueType() {
34
		return Point.class;
38
		return Point.class;
35
	}
39
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlForegroundProperty.java (+4 lines)
Lines 21-26 Link Here
21
 * 
21
 * 
22
 */
22
 */
23
public class ControlForegroundProperty extends WidgetValueProperty {
23
public class ControlForegroundProperty extends WidgetValueProperty {
24
	public Object getSourceType() {
25
		return Control.class;
26
	}
27
24
	public Object getValueType() {
28
	public Object getValueType() {
25
		return Color.class;
29
		return Color.class;
26
	}
30
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TreeColumnTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class TreeColumnTooltipTextProperty extends WidgetStringValueProperty {
21
public class TreeColumnTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return TreeColumn.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((TreeColumn) source).getToolTipText();
27
		return ((TreeColumn) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TextEditableProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class TextEditableProperty extends WidgetBooleanValueProperty {
20
public class TextEditableProperty extends WidgetBooleanValueProperty {
21
	public Object getSourceType() {
22
		return Text.class;
23
	}
24
21
	boolean doGetBooleanValue(Object source) {
25
	boolean doGetBooleanValue(Object source) {
22
		return ((Text) source).getEditable();
26
		return ((Text) source).getEditable();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ComboItemsProperty.java (+4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class ComboItemsProperty extends ControlStringListProperty {
24
public class ComboItemsProperty extends ControlStringListProperty {
25
	public Object getSourceType() {
26
		return Combo.class;
27
	}
28
25
	protected void doSetStringList(final Control control, String[] list,
29
	protected void doSetStringList(final Control control, String[] list,
26
			ListDiff diff) {
30
			ListDiff diff) {
27
		diff.accept(new ListDiffVisitor() {
31
		diff.accept(new ListDiffVisitor() {
(-)src/org/eclipse/jface/internal/databinding/swt/CLabelTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class CLabelTextProperty extends WidgetStringValueProperty {
20
public class CLabelTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return CLabel.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((CLabel) source).getText();
26
		return ((CLabel) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/LabelTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class LabelTextProperty extends WidgetStringValueProperty {
20
public class LabelTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Label.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Label) source).getText();
26
		return ((Label) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ListSingleSelectionIndexProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return List.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((List) source).getSelectionIndex();
34
		return ((List) source).getSelectionIndex();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CComboSingleSelectionIndexProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return CCombo.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((CCombo) source).getSelectionIndex();
34
		return ((CCombo) source).getSelectionIndex();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlSizeProperty.java (+4 lines)
Lines 30-35 Link Here
30
		super(SWT.Resize);
30
		super(SWT.Resize);
31
	}
31
	}
32
32
33
	public Object getSourceType() {
34
		return Control.class;
35
	}
36
33
	public Object getValueType() {
37
	public Object getValueType() {
34
		return Point.class;
38
		return Point.class;
35
	}
39
	}
(-)src/org/eclipse/jface/internal/databinding/swt/StyledTextTextProperty.java (+4 lines)
Lines 59-64 Link Here
59
		return new int[] { SWT.Modify };
59
		return new int[] { SWT.Modify };
60
	}
60
	}
61
61
62
	public Object getSourceType() {
63
		return StyledText.class;
64
	}
65
62
	String doGetStringValue(Object source) {
66
	String doGetStringValue(Object source) {
63
		return ((StyledText) source).getText();
67
		return ((StyledText) source).getText();
64
	}
68
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ButtonImageProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class ButtonImageProperty extends WidgetImageValueProperty {
21
public class ButtonImageProperty extends WidgetImageValueProperty {
22
	public Object getSourceType() {
23
		return Button.class;
24
	}
25
22
	Image doGetImageValue(Object source) {
26
	Image doGetImageValue(Object source) {
23
		return ((Button) source).getImage();
27
		return ((Button) source).getImage();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CComboItemsProperty.java (+4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class CComboItemsProperty extends ControlStringListProperty {
24
public class CComboItemsProperty extends ControlStringListProperty {
25
	public Object getSourceType() {
26
		return CCombo.class;
27
	}
28
25
	protected void doSetStringList(final Control control, String[] list,
29
	protected void doSetStringList(final Control control, String[] list,
26
			ListDiff diff) {
30
			ListDiff diff) {
27
		diff.accept(new ListDiffVisitor() {
31
		diff.accept(new ListDiffVisitor() {
(-)src/org/eclipse/jface/internal/databinding/swt/TableSingleSelectionIndexProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
26
		super(new int[] { SWT.Selection, SWT.DefaultSelection });
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Table.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((Table) source).getSelectionIndex();
34
		return ((Table) source).getSelectionIndex();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/SpinnerSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Modify);
26
		super(SWT.Modify);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Spinner.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((Spinner) source).getSelection();
34
		return ((Spinner) source).getSelection();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ScaleMinimumProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ScaleMinimumProperty extends WidgetIntValueProperty {
20
public class ScaleMinimumProperty extends WidgetIntValueProperty {
21
	public Object getSourceType() {
22
		return Scale.class;
23
	}
24
21
	int doGetIntValue(Object source) {
25
	int doGetIntValue(Object source) {
22
		return ((Scale) source).getMinimum();
26
		return ((Scale) source).getMinimum();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CLabelImageProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class CLabelImageProperty extends WidgetImageValueProperty {
21
public class CLabelImageProperty extends WidgetImageValueProperty {
22
	public Object getSourceType() {
23
		return CLabel.class;
24
	}
25
22
	Image doGetImageValue(Object source) {
26
	Image doGetImageValue(Object source) {
23
		return ((CLabel) source).getImage();
27
		return ((CLabel) source).getImage();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/SpinnerMaximumProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class SpinnerMaximumProperty extends WidgetIntValueProperty {
20
public class SpinnerMaximumProperty extends WidgetIntValueProperty {
21
	public Object getSourceType() {
22
		return Spinner.class;
23
	}
24
21
	int doGetIntValue(Object source) {
25
	int doGetIntValue(Object source) {
22
		return ((Spinner) source).getMaximum();
26
		return ((Spinner) source).getMaximum();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/SpinnerMinimumProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class SpinnerMinimumProperty extends WidgetIntValueProperty {
20
public class SpinnerMinimumProperty extends WidgetIntValueProperty {
21
	public Object getSourceType() {
22
		return Spinner.class;
23
	}
24
21
	int doGetIntValue(Object source) {
25
	int doGetIntValue(Object source) {
22
		return ((Spinner) source).getMinimum();
26
		return ((Spinner) source).getMinimum();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlFocusedProperty.java (+4 lines)
Lines 27-32 Link Here
27
		super(new int[] { SWT.FocusIn, SWT.FocusOut });
27
		super(new int[] { SWT.FocusIn, SWT.FocusOut });
28
	}
28
	}
29
29
30
	public Object getSourceType() {
31
		return Control.class;
32
	}
33
30
	public boolean doGetBooleanValue(Object source) {
34
	public boolean doGetBooleanValue(Object source) {
31
		return ((Control) source).isFocusControl();
35
		return ((Control) source).isFocusControl();
32
	}
36
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CComboTextProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Modify);
26
		super(SWT.Modify);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return CCombo.class;
31
	}
32
29
	String doGetStringValue(Object source) {
33
	String doGetStringValue(Object source) {
30
		return ((CCombo) source).getText();
34
		return ((CCombo) source).getText();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ComboTextProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Modify);
26
		super(SWT.Modify);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Combo.class;
31
	}
32
29
	String doGetStringValue(Object source) {
33
	String doGetStringValue(Object source) {
30
		return ((Combo) source).getText();
34
		return ((Combo) source).getText();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlFontProperty.java (+4 lines)
Lines 21-26 Link Here
21
 * 
21
 * 
22
 */
22
 */
23
public class ControlFontProperty extends WidgetValueProperty {
23
public class ControlFontProperty extends WidgetValueProperty {
24
	public Object getSourceType() {
25
		return Control.class;
26
	}
27
24
	public Object getValueType() {
28
	public Object getValueType() {
25
		return Font.class;
29
		return Font.class;
26
	}
30
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ItemImageProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class ItemImageProperty extends WidgetImageValueProperty {
21
public class ItemImageProperty extends WidgetImageValueProperty {
22
	public Object getSourceType() {
23
		return Item.class;
24
	}
25
22
	Image doGetImageValue(Object source) {
26
	Image doGetImageValue(Object source) {
23
		return ((Item) source).getImage();
27
		return ((Item) source).getImage();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CTabItemTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class CTabItemTooltipTextProperty extends WidgetStringValueProperty {
21
public class CTabItemTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return CTabItem.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((CTabItem) source).getToolTipText();
27
		return ((CTabItem) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ButtonTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ButtonTextProperty extends WidgetStringValueProperty {
20
public class ButtonTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Button.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Button) source).getText();
26
		return ((Button) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ShellTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ShellTextProperty extends WidgetStringValueProperty {
20
public class ShellTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Shell.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Shell) source).getText();
26
		return ((Shell) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/LinkTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class LinkTextProperty extends WidgetStringValueProperty {
20
public class LinkTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Link.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Link) source).getText();
26
		return ((Link) source).getText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ToolItemTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class ToolItemTooltipTextProperty extends WidgetStringValueProperty {
21
public class ToolItemTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return ToolItem.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((ToolItem) source).getToolTipText();
27
		return ((ToolItem) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/DateTimeSelectionProperty.java (+4 lines)
Lines 30-35 Link Here
30
		super(SWT.Selection);
30
		super(SWT.Selection);
31
	}
31
	}
32
32
33
	public Object getSourceType() {
34
		return DateTime.class;
35
	}
36
33
	public Object getValueType() {
37
	public Object getValueType() {
34
		return Date.class;
38
		return Date.class;
35
	}
39
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlBackgroundProperty.java (+4 lines)
Lines 21-26 Link Here
21
 * 
21
 * 
22
 */
22
 */
23
public class ControlBackgroundProperty extends WidgetValueProperty {
23
public class ControlBackgroundProperty extends WidgetValueProperty {
24
	public Object getSourceType() {
25
		return Control.class;
26
	}
27
24
	public Object getValueType() {
28
	public Object getValueType() {
25
		return Color.class;
29
		return Color.class;
26
	}
30
	}
(-)src/org/eclipse/jface/internal/databinding/swt/TabItemTooltipTextProperty.java (+4 lines)
Lines 19-24 Link Here
19
 * 
19
 * 
20
 */
20
 */
21
public class TabItemTooltipTextProperty extends WidgetStringValueProperty {
21
public class TabItemTooltipTextProperty extends WidgetStringValueProperty {
22
	public Object getSourceType() {
23
		return TabItem.class;
24
	}
25
22
	String doGetStringValue(Object source) {
26
	String doGetStringValue(Object source) {
23
		return ((TabItem) source).getToolTipText();
27
		return ((TabItem) source).getToolTipText();
24
	}
28
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlTooltipTextProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ControlTooltipTextProperty extends WidgetStringValueProperty {
20
public class ControlTooltipTextProperty extends WidgetStringValueProperty {
21
	public Object getSourceType() {
22
		return Control.class;
23
	}
24
21
	String doGetStringValue(Object source) {
25
	String doGetStringValue(Object source) {
22
		return ((Control) source).getToolTipText();
26
		return ((Control) source).getToolTipText();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ControlBoundsProperty.java (+4 lines)
Lines 30-35 Link Here
30
		super(new int[] { SWT.Resize, SWT.Move });
30
		super(new int[] { SWT.Resize, SWT.Move });
31
	}
31
	}
32
32
33
	public Object getSourceType() {
34
		return Control.class;
35
	}
36
33
	public Object getValueType() {
37
	public Object getValueType() {
34
		return Rectangle.class;
38
		return Rectangle.class;
35
	}
39
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ScaleMaximumProperty.java (+4 lines)
Lines 18-23 Link Here
18
 * 
18
 * 
19
 */
19
 */
20
public class ScaleMaximumProperty extends WidgetIntValueProperty {
20
public class ScaleMaximumProperty extends WidgetIntValueProperty {
21
	public Object getSourceType() {
22
		return Scale.class;
23
	}
24
21
	int doGetIntValue(Object source) {
25
	int doGetIntValue(Object source) {
22
		return ((Scale) source).getMaximum();
26
		return ((Scale) source).getMaximum();
23
	}
27
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ScaleSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Selection);
26
		super(SWT.Selection);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Scale.class;
31
	}
32
29
	int doGetIntValue(Object source) {
33
	int doGetIntValue(Object source) {
30
		return ((Scale) source).getSelection();
34
		return ((Scale) source).getSelection();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/CComboSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Modify);
26
		super(SWT.Modify);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return CCombo.class;
31
	}
32
29
	String doGetStringValue(Object source) {
33
	String doGetStringValue(Object source) {
30
		return ((CCombo) source).getText();
34
		return ((CCombo) source).getText();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/swt/ListItemsProperty.java (+4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class ListItemsProperty extends ControlStringListProperty {
24
public class ListItemsProperty extends ControlStringListProperty {
25
	public Object getSourceType() {
26
		return List.class;
27
	}
28
25
	protected void doSetStringList(final Control control, String[] items,
29
	protected void doSetStringList(final Control control, String[] items,
26
			ListDiff diff) {
30
			ListDiff diff) {
27
		diff.accept(new ListDiffVisitor() {
31
		diff.accept(new ListDiffVisitor() {
(-)src/org/eclipse/jface/internal/databinding/swt/ComboSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
		super(SWT.Modify);
26
		super(SWT.Modify);
27
	}
27
	}
28
28
29
	public Object getSourceType() {
30
		return Combo.class;
31
	}
32
29
	String doGetStringValue(Object source) {
33
	String doGetStringValue(Object source) {
30
		return ((Combo) source).getText();
34
		return ((Combo) source).getText();
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderSingleSelectionProperty.java (+4 lines)
Lines 26-31 Link Here
26
 */
26
 */
27
public class SelectionProviderSingleSelectionProperty extends
27
public class SelectionProviderSingleSelectionProperty extends
28
		ViewerValueProperty {
28
		ViewerValueProperty {
29
	public Object getSourceType() {
30
		return ISelectionProvider.class;
31
	}
32
29
	public Object getValueType() {
33
	public Object getValueType() {
30
		return null;
34
		return null;
31
	}
35
	}
(-)src/org/eclipse/jface/internal/databinding/viewers/ViewerInputProperty.java (-7 / +4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class ViewerInputProperty extends ViewerValueProperty {
24
public class ViewerInputProperty extends ViewerValueProperty {
25
	public Object getSourceType() {
26
		return Viewer.class;
27
	}
28
25
	public Object getValueType() {
29
	public Object getValueType() {
26
		return null;
30
		return null;
27
	}
31
	}
Lines 39-51 Link Here
39
		return null;
43
		return null;
40
	}
44
	}
41
45
42
	protected void doAddListener(Object source, INativePropertyListener listener) {
43
	}
44
45
	protected void doRemoveListener(Object source,
46
			INativePropertyListener listener) {
47
	}
48
49
	public String toString() {
46
	public String toString() {
50
		return "Viewer.input"; //$NON-NLS-1$
47
		return "Viewer.input"; //$NON-NLS-1$
51
	}
48
	}
(-)src/org/eclipse/jface/internal/databinding/viewers/StructuredViewerFiltersProperty.java (+4 lines)
Lines 28-33 Link Here
28
 * 
28
 * 
29
 */
29
 */
30
public class StructuredViewerFiltersProperty extends ViewerSetProperty {
30
public class StructuredViewerFiltersProperty extends ViewerSetProperty {
31
	public Object getSourceType() {
32
		return StructuredViewer.class;
33
	}
34
31
	public Object getElementType() {
35
	public Object getElementType() {
32
		return ViewerFilter.class;
36
		return ViewerFilter.class;
33
	}
37
	}
(-)src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderMultipleSelectionProperty.java (+4 lines)
Lines 30-35 Link Here
30
 */
30
 */
31
public class SelectionProviderMultipleSelectionProperty extends
31
public class SelectionProviderMultipleSelectionProperty extends
32
		ViewerListProperty {
32
		ViewerListProperty {
33
	public Object getSourceType() {
34
		return ISelectionProvider.class;
35
	}
36
33
	public Object getElementType() {
37
	public Object getElementType() {
34
		return Object.class;
38
		return Object.class;
35
	}
39
	}
(-)src/org/eclipse/jface/internal/databinding/viewers/CheckboxTreeViewerCheckedElementsProperty.java (+4 lines)
Lines 31-36 Link Here
31
		super(elementType);
31
		super(elementType);
32
	}
32
	}
33
33
34
	public Object getSourceType() {
35
		return CheckboxTreeViewer.class;
36
	}
37
34
	protected Set doGetSet(Object source) {
38
	protected Set doGetSet(Object source) {
35
		CheckboxTreeViewer viewer = (CheckboxTreeViewer) source;
39
		CheckboxTreeViewer viewer = (CheckboxTreeViewer) source;
36
		Set set = createElementSet(viewer);
40
		Set set = createElementSet(viewer);
(-)src/org/eclipse/jface/internal/databinding/viewers/CheckboxTableViewerCheckedElementsProperty.java (+4 lines)
Lines 31-36 Link Here
31
		super(elementType);
31
		super(elementType);
32
	}
32
	}
33
33
34
	public Object getSourceType() {
35
		return CheckboxTableViewer.class;
36
	}
37
34
	protected Set doGetSet(Object source) {
38
	protected Set doGetSet(Object source) {
35
		CheckboxTableViewer viewer = (CheckboxTableViewer) source;
39
		CheckboxTableViewer viewer = (CheckboxTableViewer) source;
36
		Set set = createElementSet(viewer);
40
		Set set = createElementSet(viewer);
(-)src/org/eclipse/jface/internal/databinding/viewers/CellEditorControlProperty.java (+4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class CellEditorControlProperty extends SimpleValueProperty {
24
public class CellEditorControlProperty extends SimpleValueProperty {
25
	public Object getSourceType() {
26
		return CellEditor.class;
27
	}
28
25
	public Object getValueType() {
29
	public Object getValueType() {
26
		return Control.class;
30
		return Control.class;
27
	}
31
	}
(-)src/org/eclipse/jface/internal/databinding/util/JFaceProperty.java (-7 / +13 lines)
Lines 28-33 Link Here
28
 */
28
 */
29
public class JFaceProperty extends SimpleValueProperty {
29
public class JFaceProperty extends SimpleValueProperty {
30
30
31
	private final Class sourceType;
31
	private Class returnType;
32
	private Class returnType;
32
	private Method setterMethod;
33
	private Method setterMethod;
33
	private Method getterMethod;
34
	private Method getterMethod;
Lines 92-120 Link Here
92
	}
93
	}
93
94
94
	/**
95
	/**
96
	 * @param sourceType
95
	 * @param fieldName
97
	 * @param fieldName
96
	 * @param property
98
	 * @param property
97
	 * @param clazz
98
	 */
99
	 */
99
	public JFaceProperty(String fieldName, String property, Class clazz) {
100
	public JFaceProperty(Class sourceType, String fieldName, String property) {
101
		this.sourceType = sourceType;
100
		this.property = property;
102
		this.property = property;
101
		// Create all the necessary method ahead of time to ensure they are
103
		// Create all the necessary method ahead of time to ensure they are
102
		// available
104
		// available
103
		try {
105
		try {
104
			try {
106
			try {
105
				String getterName = getGetterName(fieldName);
107
				String getterName = getGetterName(fieldName);
106
				getterMethod = clazz.getMethod(getterName, new Class[] {});
108
				getterMethod = sourceType.getMethod(getterName, new Class[] {});
107
			} catch (NoSuchMethodException e) {
109
			} catch (NoSuchMethodException e) {
108
				String getterName = getBooleanGetterName(fieldName);
110
				String getterName = getBooleanGetterName(fieldName);
109
				getterMethod = clazz.getMethod(getterName, new Class[] {});
111
				getterMethod = sourceType.getMethod(getterName, new Class[] {});
110
			}
112
			}
111
			returnType = getterMethod.getReturnType();
113
			returnType = getterMethod.getReturnType();
112
			setterMethod = clazz.getMethod(getSetterName(fieldName),
114
			setterMethod = sourceType.getMethod(getSetterName(fieldName),
113
					new Class[] { returnType });
115
					new Class[] { returnType });
114
			addPropertyListenerMethod = clazz
116
			addPropertyListenerMethod = sourceType
115
					.getMethod(
117
					.getMethod(
116
							"addPropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
118
							"addPropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
117
			removePropertyListenerMethod = clazz
119
			removePropertyListenerMethod = sourceType
118
					.getMethod(
120
					.getMethod(
119
							"removePropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
121
							"removePropertyChangeListener", new Class[] { IPropertyChangeListener.class }); //$NON-NLS-1$
120
		} catch (SecurityException e) {
122
		} catch (SecurityException e) {
Lines 124-129 Link Here
124
		}
126
		}
125
	}
127
	}
126
128
129
	public Object getSourceType() {
130
		return sourceType;
131
	}
132
127
	public INativePropertyListener adaptListener(
133
	public INativePropertyListener adaptListener(
128
			ISimplePropertyListener listener) {
134
			ISimplePropertyListener listener) {
129
		return new Listener(listener);
135
		return new Listener(listener);
(-)src/org/eclipse/jface/databinding/swt/WidgetListProperty.java (-4 / +1 lines)
Lines 34-43 Link Here
34
public abstract class WidgetListProperty extends SimpleListProperty implements
34
public abstract class WidgetListProperty extends SimpleListProperty implements
35
		IWidgetListProperty {
35
		IWidgetListProperty {
36
	public IObservableList observe(Object source) {
36
	public IObservableList observe(Object source) {
37
		if (source instanceof Widget) {
37
		return observe((Widget) source);
38
			return observe((Widget) source);
39
		}
40
		return super.observe(source);
41
	}
38
	}
42
39
43
	public IObservableList observe(Realm realm, Object source) {
40
	public IObservableList observe(Realm realm, Object source) {
(-)src/org/eclipse/jface/databinding/swt/WidgetValueProperty.java (-4 / +1 lines)
Lines 164-173 Link Here
164
	}
164
	}
165
165
166
	public IObservableValue observe(Object source) {
166
	public IObservableValue observe(Object source) {
167
		if (source instanceof Widget) {
167
		return observe((Widget) source);
168
			return observe((Widget) source);
169
		}
170
		return super.observe(source);
171
	}
168
	}
172
169
173
	public IObservableValue observe(Realm realm, Object source) {
170
	public IObservableValue observe(Realm realm, Object source) {
(-)src/org/eclipse/core/internal/databinding/property/set/SimplePropertyObservableSet.java (-2 / +2 lines)
Lines 53-60 Link Here
53
	 * @param source
53
	 * @param source
54
	 * @param property
54
	 * @param property
55
	 */
55
	 */
56
	public SimplePropertyObservableSet(Realm realm, Object source,
56
	public SimplePropertyObservableSet(Realm realm, final Object source,
57
			SimpleSetProperty property) {
57
			final SimpleSetProperty property) {
58
		super(realm);
58
		super(realm);
59
		this.source = source;
59
		this.source = source;
60
		this.property = property;
60
		this.property = property;
(-)src/org/eclipse/core/internal/databinding/property/set/SelfSetProperty.java (-7 / +4 lines)
Lines 33-38 Link Here
33
		this.elementType = elementType;
33
		this.elementType = elementType;
34
	}
34
	}
35
35
36
	public Object getSourceType() {
37
		return Set.class;
38
	}
39
36
	public Object getElementType() {
40
	public Object getElementType() {
37
		return elementType;
41
		return elementType;
38
	}
42
	}
Lines 49-59 Link Here
49
			ISimplePropertyListener listener) {
53
			ISimplePropertyListener listener) {
50
		return null; // no listener API
54
		return null; // no listener API
51
	}
55
	}
52
53
	protected void doAddListener(Object source, INativePropertyListener listener) {
54
	}
55
56
	protected void doRemoveListener(Object source,
57
			INativePropertyListener listener) {
58
	}
59
}
56
}
(-)src/org/eclipse/core/databinding/property/value/SimpleValueProperty.java (+22 lines)
Lines 23-28 Link Here
23
import org.eclipse.core.internal.databinding.property.value.MapSimpleValueObservableMap;
23
import org.eclipse.core.internal.databinding.property.value.MapSimpleValueObservableMap;
24
import org.eclipse.core.internal.databinding.property.value.SetSimpleValueObservableMap;
24
import org.eclipse.core.internal.databinding.property.value.SetSimpleValueObservableMap;
25
import org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue;
25
import org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue;
26
import org.eclipse.core.runtime.Assert;
26
27
27
/**
28
/**
28
 * Simplified abstract implementation of IValueProperty. This class takes care
29
 * Simplified abstract implementation of IValueProperty. This class takes care
Lines 44-49 Link Here
44
 */
45
 */
45
public abstract class SimpleValueProperty extends ValueProperty {
46
public abstract class SimpleValueProperty extends ValueProperty {
46
	/**
47
	/**
48
	 * Returns the type of source object this property may be used with.
49
	 * 
50
	 * @return the type of source object this property may be used with.
51
	 */
52
	public Object getSourceType() {
53
		return null;
54
	}
55
56
	/**
47
	 * Returns the value of the property on the specified source object
57
	 * Returns the value of the property on the specified source object
48
	 * 
58
	 * 
49
	 * @param source
59
	 * @param source
Lines 101-106 Link Here
101
			ISimplePropertyListener listener);
111
			ISimplePropertyListener listener);
102
112
103
	public IObservableValue observe(Realm realm, Object source) {
113
	public IObservableValue observe(Realm realm, Object source) {
114
		checkSourceType(source);
104
		return new SimplePropertyObservableValue(realm, source, this);
115
		return new SimplePropertyObservableValue(realm, source, this);
105
	}
116
	}
106
117
Lines 115-118 Link Here
115
	public IObservableMap observeDetail(IObservableMap master) {
126
	public IObservableMap observeDetail(IObservableMap master) {
116
		return new MapSimpleValueObservableMap(master, this);
127
		return new MapSimpleValueObservableMap(master, this);
117
	}
128
	}
129
130
	protected void checkSourceType(Object source) {
131
		if (source == null)
132
			return;
133
		Object sourceType = getSourceType();
134
		if (sourceType instanceof Class) {
135
			Class sourceClass = (Class) sourceType;
136
			Assert.isTrue(sourceClass.isInstance(source), "The source object " //$NON-NLS-1$
137
					+ source + " is not an instance of " + sourceClass); //$NON-NLS-1$
138
		}
139
	}
118
}
140
}
(-)src/org/eclipse/core/internal/databinding/property/value/SelfValueProperty.java (-12 / +9 lines)
Lines 20-36 Link Here
20
 * 
20
 * 
21
 */
21
 */
22
public final class SelfValueProperty extends SimpleValueProperty {
22
public final class SelfValueProperty extends SimpleValueProperty {
23
	private final Object valueType;
23
	private final Object selfType;
24
24
25
	/**
25
	/**
26
	 * @param valueType
26
	 * @param selfType
27
	 */
27
	 */
28
	public SelfValueProperty(Object valueType) {
28
	public SelfValueProperty(Object selfType) {
29
		this.valueType = valueType;
29
		this.selfType = selfType;
30
	}
31
32
	public Object getSourceType() {
33
		return selfType;
30
	}
34
	}
31
35
32
	public Object getValueType() {
36
	public Object getValueType() {
33
		return valueType;
37
		return selfType;
34
	}
38
	}
35
39
36
	protected Object doGetValue(Object source) {
40
	protected Object doGetValue(Object source) {
Lines 44-54 Link Here
44
			ISimplePropertyListener listener) {
48
			ISimplePropertyListener listener) {
45
		return null;
49
		return null;
46
	}
50
	}
47
48
	protected void doAddListener(Object source, INativePropertyListener listener) {
49
	}
50
51
	protected void doRemoveListener(Object source,
52
			INativePropertyListener listener) {
53
	}
54
}
51
}
(-)src/org/eclipse/core/internal/databinding/property/value/ObservableValueProperty.java (+4 lines)
Lines 45-50 Link Here
45
		this.valueType = valueType;
45
		this.valueType = valueType;
46
	}
46
	}
47
47
48
	public Object getSourceType() {
49
		return IObservableValue.class;
50
	}
51
48
	public Object getValueType() {
52
	public Object getValueType() {
49
		return valueType;
53
		return valueType;
50
	}
54
	}
(-)src/org/eclipse/core/internal/databinding/property/value/SimplePropertyObservableValue.java (-2 / +2 lines)
Lines 45-52 Link Here
45
	 * @param source
45
	 * @param source
46
	 * @param property
46
	 * @param property
47
	 */
47
	 */
48
	public SimplePropertyObservableValue(Realm realm, Object source,
48
	public SimplePropertyObservableValue(Realm realm, final Object source,
49
			SimpleValueProperty property) {
49
			final SimpleValueProperty property) {
50
		super(realm);
50
		super(realm);
51
		this.source = source;
51
		this.source = source;
52
		this.property = property;
52
		this.property = property;
(-)src/org/eclipse/core/databinding/property/list/SimpleListProperty.java (+22 lines)
Lines 21-26 Link Here
21
import org.eclipse.core.databinding.property.INativePropertyListener;
21
import org.eclipse.core.databinding.property.INativePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
23
import org.eclipse.core.internal.databinding.property.list.SimplePropertyObservableList;
23
import org.eclipse.core.internal.databinding.property.list.SimplePropertyObservableList;
24
import org.eclipse.core.runtime.Assert;
24
25
25
/**
26
/**
26
 * Simplified abstract implementation of IListProperty. This class takes care of
27
 * Simplified abstract implementation of IListProperty. This class takes care of
Lines 42-53 Link Here
42
 */
43
 */
43
public abstract class SimpleListProperty extends ListProperty {
44
public abstract class SimpleListProperty extends ListProperty {
44
	public IObservableList observe(Realm realm, Object source) {
45
	public IObservableList observe(Realm realm, Object source) {
46
		checkSourceType(source);
45
		return new SimplePropertyObservableList(realm, source, this);
47
		return new SimplePropertyObservableList(realm, source, this);
46
	}
48
	}
47
49
50
	protected void checkSourceType(Object source) {
51
		if (source == null)
52
			return;
53
		Object sourceType = getSourceType();
54
		if (sourceType instanceof Class) {
55
			Class sourceClass = (Class) sourceType;
56
			Assert.isTrue(sourceClass.isInstance(source), "The source object " //$NON-NLS-1$
57
					+ source + " is not an instance of " + sourceClass); //$NON-NLS-1$
58
		}
59
	}
60
48
	// Accessors
61
	// Accessors
49
62
50
	/**
63
	/**
64
	 * Returns the type of source object this property may be used with.
65
	 * 
66
	 * @return the type of source object this property may be used with.
67
	 */
68
	public Object getSourceType() {
69
		return null;
70
	}
71
72
	/**
51
	 * Returns an unmodifiable List with the current contents of the source's
73
	 * Returns an unmodifiable List with the current contents of the source's
52
	 * list property
74
	 * list property
53
	 * 
75
	 * 
(-)src/org/eclipse/core/internal/databinding/property/map/SelfMapProperty.java (-7 / +4 lines)
Lines 36-41 Link Here
36
		this.valueType = valueType;
36
		this.valueType = valueType;
37
	}
37
	}
38
38
39
	public Object getSourceType() {
40
		return Map.class;
41
	}
42
39
	public Object getKeyType() {
43
	public Object getKeyType() {
40
		return keyType;
44
		return keyType;
41
	}
45
	}
Lines 56-66 Link Here
56
			ISimplePropertyListener listener) {
60
			ISimplePropertyListener listener) {
57
		return null; // no listener API
61
		return null; // no listener API
58
	}
62
	}
59
60
	protected void doAddListener(Object source, INativePropertyListener listener) {
61
	}
62
63
	protected void doRemoveListener(Object source,
64
			INativePropertyListener listener) {
65
	}
66
}
63
}
(-)src/org/eclipse/core/internal/databinding/property/map/SimplePropertyObservableMap.java (-2 / +2 lines)
Lines 56-63 Link Here
56
	 * @param source
56
	 * @param source
57
	 * @param property
57
	 * @param property
58
	 */
58
	 */
59
	public SimplePropertyObservableMap(Realm realm, Object source,
59
	public SimplePropertyObservableMap(Realm realm, final Object source,
60
			SimpleMapProperty property) {
60
			final SimpleMapProperty property) {
61
		super(realm);
61
		super(realm);
62
		this.source = source;
62
		this.source = source;
63
		this.property = property;
63
		this.property = property;
(-)src/org/eclipse/core/internal/databinding/property/list/SimplePropertyObservableList.java (-2 / +2 lines)
Lines 56-63 Link Here
56
	 * @param source
56
	 * @param source
57
	 * @param property
57
	 * @param property
58
	 */
58
	 */
59
	public SimplePropertyObservableList(Realm realm, Object source,
59
	public SimplePropertyObservableList(Realm realm, final Object source,
60
			SimpleListProperty property) {
60
			final SimpleListProperty property) {
61
		super(realm);
61
		super(realm);
62
		this.source = source;
62
		this.source = source;
63
		this.property = property;
63
		this.property = property;
(-)src/org/eclipse/core/internal/databinding/property/list/SelfListProperty.java (-7 / +4 lines)
Lines 33-38 Link Here
33
		this.elementType = elementType;
33
		this.elementType = elementType;
34
	}
34
	}
35
35
36
	public Object getSourceType() {
37
		return List.class;
38
	}
39
36
	public Object getElementType() {
40
	public Object getElementType() {
37
		return elementType;
41
		return elementType;
38
	}
42
	}
Lines 49-59 Link Here
49
			ISimplePropertyListener listener) {
53
			ISimplePropertyListener listener) {
50
		return null; // no listener API
54
		return null; // no listener API
51
	}
55
	}
52
53
	protected void doAddListener(Object source, INativePropertyListener listener) {
54
	}
55
56
	protected void doRemoveListener(Object source,
57
			INativePropertyListener listener) {
58
	}
59
}
56
}
(-)src/org/eclipse/core/databinding/property/map/SimpleMapProperty.java (+22 lines)
Lines 21-26 Link Here
21
import org.eclipse.core.databinding.property.INativePropertyListener;
21
import org.eclipse.core.databinding.property.INativePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
23
import org.eclipse.core.internal.databinding.property.map.SimplePropertyObservableMap;
23
import org.eclipse.core.internal.databinding.property.map.SimplePropertyObservableMap;
24
import org.eclipse.core.runtime.Assert;
24
25
25
/**
26
/**
26
 * Simplified abstract implementation of IMapProperty. This class takes care of
27
 * Simplified abstract implementation of IMapProperty. This class takes care of
Lines 43-54 Link Here
43
 */
44
 */
44
public abstract class SimpleMapProperty extends MapProperty {
45
public abstract class SimpleMapProperty extends MapProperty {
45
	public IObservableMap observe(Realm realm, Object source) {
46
	public IObservableMap observe(Realm realm, Object source) {
47
		checkSourceType(source);
46
		return new SimplePropertyObservableMap(realm, source, this);
48
		return new SimplePropertyObservableMap(realm, source, this);
47
	}
49
	}
48
50
51
	protected void checkSourceType(Object source) {
52
		if (source == null)
53
			return;
54
		Object sourceType = getSourceType();
55
		if (sourceType instanceof Class) {
56
			Class sourceClass = (Class) sourceType;
57
			Assert.isTrue(sourceClass.isInstance(source), "The source object " //$NON-NLS-1$
58
					+ source + " is not an instance of " + sourceClass); //$NON-NLS-1$
59
		}
60
	}
61
49
	// Accessors
62
	// Accessors
50
63
51
	/**
64
	/**
65
	 * Returns the type of source object this property may be used with.
66
	 * 
67
	 * @return the type of source object this property may be used with.
68
	 */
69
	public Object getSourceType() {
70
		return null;
71
	}
72
73
	/**
52
	 * Returns an unmodifiable Map with the current contents of the source's map
74
	 * Returns an unmodifiable Map with the current contents of the source's map
53
	 * property.
75
	 * property.
54
	 * 
76
	 * 
(-)src/org/eclipse/core/databinding/property/set/SimpleSetProperty.java (+22 lines)
Lines 21-26 Link Here
21
import org.eclipse.core.databinding.property.INativePropertyListener;
21
import org.eclipse.core.databinding.property.INativePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
22
import org.eclipse.core.databinding.property.ISimplePropertyListener;
23
import org.eclipse.core.internal.databinding.property.set.SimplePropertyObservableSet;
23
import org.eclipse.core.internal.databinding.property.set.SimplePropertyObservableSet;
24
import org.eclipse.core.runtime.Assert;
24
25
25
/**
26
/**
26
 * Simplified abstract implementation of ISetProperty. This class takes care of
27
 * Simplified abstract implementation of ISetProperty. This class takes care of
Lines 42-53 Link Here
42
 */
43
 */
43
public abstract class SimpleSetProperty extends SetProperty {
44
public abstract class SimpleSetProperty extends SetProperty {
44
	public IObservableSet observe(Realm realm, Object source) {
45
	public IObservableSet observe(Realm realm, Object source) {
46
		checkSourceType(source);
45
		return new SimplePropertyObservableSet(realm, source, this);
47
		return new SimplePropertyObservableSet(realm, source, this);
46
	}
48
	}
47
49
50
	protected void checkSourceType(Object source) {
51
		if (source == null)
52
			return;
53
		Object sourceType = getSourceType();
54
		if (sourceType instanceof Class) {
55
			Class sourceClass = (Class) sourceType;
56
			Assert.isTrue(sourceClass.isInstance(source), "The source object " //$NON-NLS-1$
57
					+ source + " is not an instance of " + sourceClass); //$NON-NLS-1$
58
		}
59
	}
60
48
	// Accessors
61
	// Accessors
49
62
50
	/**
63
	/**
64
	 * Returns the type of source object this property may be used with.
65
	 * 
66
	 * @return the type of source object this property may be used with.
67
	 */
68
	public Object getSourceType() {
69
		return null;
70
	}
71
72
	/**
51
	 * Returns a Set with the current contents of the source's set property
73
	 * Returns a Set with the current contents of the source's set property
52
	 * 
74
	 * 
53
	 * @param source
75
	 * @param source
(-)src/org/eclipse/core/internal/databinding/BindingModelProperty.java (-7 / +4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class BindingModelProperty extends SimpleValueProperty {
24
public class BindingModelProperty extends SimpleValueProperty {
25
	public Object getSourceType() {
26
		return Binding.class;
27
	}
28
25
	public Object getValueType() {
29
	public Object getValueType() {
26
		return IObservable.class;
30
		return IObservable.class;
27
	}
31
	}
Lines 40-52 Link Here
40
		return null;
44
		return null;
41
	}
45
	}
42
46
43
	protected void doAddListener(Object source, INativePropertyListener listener) {
44
	}
45
46
	protected void doRemoveListener(Object source,
47
			INativePropertyListener listener) {
48
	}
49
50
	public String toString() {
47
	public String toString() {
51
		return "Binding#model <IObservable>"; //$NON-NLS-1$
48
		return "Binding#model <IObservable>"; //$NON-NLS-1$
52
	}
49
	}
(-)src/org/eclipse/core/internal/databinding/BindingTargetProperty.java (-7 / +4 lines)
Lines 22-27 Link Here
22
 * 
22
 * 
23
 */
23
 */
24
public class BindingTargetProperty extends SimpleValueProperty {
24
public class BindingTargetProperty extends SimpleValueProperty {
25
	public Object getSourceType() {
26
		return Binding.class;
27
	}
28
25
	public Object getValueType() {
29
	public Object getValueType() {
26
		return IObservable.class;
30
		return IObservable.class;
27
	}
31
	}
Lines 40-52 Link Here
40
		return null;
44
		return null;
41
	}
45
	}
42
46
43
	protected void doAddListener(Object source, INativePropertyListener listener) {
44
	}
45
46
	protected void doRemoveListener(Object source,
47
			INativePropertyListener listener) {
48
	}
49
50
	public String toString() {
47
	public String toString() {
51
		return "Binding#target <IObservable>"; //$NON-NLS-1$
48
		return "Binding#target <IObservable>"; //$NON-NLS-1$
52
	}
49
	}
(-)src/org/eclipse/core/internal/databinding/ValidationStatusProviderValidationStatusProperty.java (-7 / +4 lines)
Lines 23-28 Link Here
23
 */
23
 */
24
public final class ValidationStatusProviderValidationStatusProperty extends
24
public final class ValidationStatusProviderValidationStatusProperty extends
25
		SimpleValueProperty {
25
		SimpleValueProperty {
26
	public Object getSourceType() {
27
		return ValidationStatusProvider.class;
28
	}
29
26
	public Object getValueType() {
30
	public Object getValueType() {
27
		return IObservableValue.class;
31
		return IObservableValue.class;
28
	}
32
	}
Lines 41-53 Link Here
41
		return null;
45
		return null;
42
	}
46
	}
43
47
44
	protected void doAddListener(Object source, INativePropertyListener listener) {
45
	}
46
47
	protected void doRemoveListener(Object source,
48
			INativePropertyListener listener) {
49
	}
50
51
	public String toString() {
48
	public String toString() {
52
		return "ValidationStatusProvider#validationStatus <IObservableValue>"; //$NON-NLS-1$
49
		return "ValidationStatusProvider#validationStatus <IObservableValue>"; //$NON-NLS-1$
53
	}
50
	}

Return to bug 262284