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/jface/examples/databinding/snippets/Snippet025TableViewerWithPropertyDerivedColumns.java (-12 / +10 lines)
Lines 23-32 Link Here
23
import org.eclipse.core.databinding.observable.value.IObservableValue;
23
import org.eclipse.core.databinding.observable.value.IObservableValue;
24
import org.eclipse.core.databinding.property.Properties;
24
import org.eclipse.core.databinding.property.Properties;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
26
import org.eclipse.jface.databinding.swt.TextProperties;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
27
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
27
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
28
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
28
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
29
import org.eclipse.jface.databinding.viewers.SelectionProviderProperties;
29
import org.eclipse.jface.databinding.viewers.ViewerProperties;
30
import org.eclipse.jface.layout.GridDataFactory;
30
import org.eclipse.jface.layout.GridDataFactory;
31
import org.eclipse.jface.layout.GridLayoutFactory;
31
import org.eclipse.jface.layout.GridLayoutFactory;
32
import org.eclipse.jface.viewers.ComboViewer;
32
import org.eclipse.jface.viewers.ComboViewer;
Lines 247-256 Link Here
247
							"mother.mother.name", "mother.father.name",
247
							"mother.mother.name", "mother.father.name",
248
							"father.mother.name", "father.father.name" });
248
							"father.mother.name", "father.father.name" });
249
249
250
			IObservableValue masterSelection = SelectionProviderProperties
250
			IObservableValue masterSelection = ViewerProperties
251
					.singleSelection().observe(peopleViewer);
251
					.singleSelection().observe(peopleViewer);
252
252
253
			dbc.bindValue(TextProperties.text(SWT.Modify).observe(nameText),
253
			dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(nameText),
254
					BeanProperties.value(Person.class, "name").observeDetail(
254
					BeanProperties.value(Person.class, "name").observeDetail(
255
							masterSelection), null, null);
255
							masterSelection), null, null);
256
256
Lines 258-276 Link Here
258
			bindViewer(mothercomboViewer, viewModel.getPeople(), Person.class,
258
			bindViewer(mothercomboViewer, viewModel.getPeople(), Person.class,
259
					"name");
259
					"name");
260
260
261
			dbc.bindValue(SelectionProviderProperties.singleSelection()
261
			dbc.bindValue(ViewerProperties.singleSelection().observe(
262
					.observe(mothercomboViewer), BeanProperties.value(
262
					mothercomboViewer), BeanProperties.value(Person.class,
263
					Person.class, "mother").observeDetail(masterSelection),
263
					"mother").observeDetail(masterSelection), null, null);
264
					null, null);
265
264
266
			ComboViewer fatherComboViewer = new ComboViewer(fatherCombo);
265
			ComboViewer fatherComboViewer = new ComboViewer(fatherCombo);
267
			bindViewer(fatherComboViewer, viewModel.getPeople(), Person.class,
266
			bindViewer(fatherComboViewer, viewModel.getPeople(), Person.class,
268
					"name");
267
					"name");
269
268
270
			dbc.bindValue(SelectionProviderProperties.singleSelection()
269
			dbc.bindValue(ViewerProperties.singleSelection().observe(
271
					.observe(fatherComboViewer), BeanProperties.value(
270
					fatherComboViewer), BeanProperties.value(Person.class,
272
					Person.class, "father").observeDetail(masterSelection),
271
					"father").observeDetail(masterSelection), null, null);
273
					null, null);
274
		}
272
		}
275
273
276
		private void bindViewer(StructuredViewer viewer, IObservableList input,
274
		private void bindViewer(StructuredViewer viewer, IObservableList input,
(-)src/org/eclipse/jface/databinding/swt/ToolItemProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ToolItemTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT ToolItems
19
 * 
20
 * @since 1.3
21
 */
22
public class ToolItemProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT ToolItems.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT ToolItems.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new ToolItemTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ScaleProperties.java (-51 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ScaleMaximumProperty;
16
import org.eclipse.jface.internal.databinding.swt.ScaleMinimumProperty;
17
import org.eclipse.jface.internal.databinding.swt.ScaleSelectionProperty;
18
19
/**
20
 * A factory for creating properties of SWT Scales.
21
 * 
22
 * @since 1.3
23
 */
24
public class ScaleProperties {
25
	/**
26
	 * Returns a value property for the selected value of a SWT Scale.
27
	 * 
28
	 * @return a value property for the selected value of a SWT Scale.
29
	 */
30
	public static IValueProperty selection() {
31
		return new ScaleSelectionProperty();
32
	}
33
34
	/**
35
	 * Returns a value property for the minimum value of a SWT Scale.
36
	 * 
37
	 * @return a value property for the minimum value of a SWT Scale.
38
	 */
39
	public static IValueProperty minimum() {
40
		return new ScaleMinimumProperty();
41
	}
42
43
	/**
44
	 * Returns a value property for the maximum value of a SWT Scale.
45
	 * 
46
	 * @return a value property for the maximum value of a SWT Scale.
47
	 */
48
	public static IValueProperty maximum() {
49
		return new ScaleMaximumProperty();
50
	}
51
}
(-)src/org/eclipse/jface/databinding/swt/TextProperties.java (-46 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TextEditableProperty;
16
import org.eclipse.jface.internal.databinding.swt.TextTextProperty;
17
import org.eclipse.swt.SWT;
18
19
/**
20
 * A factory for creating properties of SWT Texts.
21
 * 
22
 * @since 1.3
23
 */
24
public class TextProperties {
25
	/**
26
	 * Returns a value property for the text of a SWT Text.
27
	 * 
28
	 * @param event
29
	 *            the SWT event type to register for change events. May be
30
	 *            {@link SWT#None}, {@link SWT#Modify} or {@link SWT#FocusOut}.
31
	 * 
32
	 * @return a value property for the text of a SWT Text.
33
	 */
34
	public static IValueProperty text(int event) {
35
		return new TextTextProperty(event);
36
	}
37
38
	/**
39
	 * Returns a value property for the editable state of a SWT Text.
40
	 * 
41
	 * @return a value property for the editable state of a SWT Text.
42
	 */
43
	public static IValueProperty editable() {
44
		return new TextEditableProperty();
45
	}
46
}
(-)src/org/eclipse/jface/databinding/swt/TrayItemProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TrayItemTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT TrayItems
19
 * 
20
 * @since 1.3
21
 */
22
public class TrayItemProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT TrayItems.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT TrayItems.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new TrayItemTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/LabelProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.LabelTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT Labels.
19
 * 
20
 * @since 1.3
21
 */
22
public class LabelProperties {
23
	/**
24
	 * Returns a value property for the text of a SWT Label.
25
	 * 
26
	 * @return a value property for the text of a SWT Label.
27
	 */
28
	public static IValueProperty text() {
29
		return new LabelTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/SpinnerProperties.java (-51 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.SpinnerMaximumProperty;
16
import org.eclipse.jface.internal.databinding.swt.SpinnerMinimumProperty;
17
import org.eclipse.jface.internal.databinding.swt.SpinnerSelectionProperty;
18
19
/**
20
 * A factory for creating properties of SWT Spinners.
21
 * 
22
 * @since 1.3
23
 */
24
public class SpinnerProperties {
25
	/**
26
	 * Returns a value property for the selected value of a SWT Spinner.
27
	 * 
28
	 * @return a value property for the selected value of a SWT Spinner.
29
	 */
30
	public static IValueProperty selection() {
31
		return new SpinnerSelectionProperty();
32
	}
33
34
	/**
35
	 * Returns a value property for the minimum value of a SWT Spinner.
36
	 * 
37
	 * @return a value property for the minimum value of a SWT Spinner.
38
	 */
39
	public static IValueProperty minimum() {
40
		return new SpinnerMinimumProperty();
41
	}
42
43
	/**
44
	 * Returns a value property for the maximum value of a SWT Spinner.
45
	 * 
46
	 * @return a value property for the maximum value of a SWT Spinner.
47
	 */
48
	public static IValueProperty maximum() {
49
		return new SpinnerMaximumProperty();
50
	}
51
}
(-)src/org/eclipse/jface/databinding/swt/TableProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TableSingleSelectionIndexProperty;
16
17
/**
18
 * A factory for creating properties of SWT Tables.
19
 * 
20
 * @since 1.3
21
 */
22
public class TableProperties {
23
	/**
24
	 * Returns a value property for the single selection index of a SWT Table.
25
	 * 
26
	 * @return a value property for the single selection index of a SWT Table.
27
	 */
28
	public static IValueProperty singleSelectionIndex() {
29
		return new TableSingleSelectionIndexProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ItemProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ItemTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT controls.
19
 * 
20
 * @since 1.3
21
 */
22
public class ItemProperties {
23
	/**
24
	 * Returns a value property for the text of a SWT Item.
25
	 * 
26
	 * @return a value property for the text of a SWT Item
27
	 */
28
	public static IValueProperty text() {
29
		return new ItemTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ControlProperties.java (-121 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ControlBackgroundProperty;
16
import org.eclipse.jface.internal.databinding.swt.ControlBoundsProperty;
17
import org.eclipse.jface.internal.databinding.swt.ControlEnabledProperty;
18
import org.eclipse.jface.internal.databinding.swt.ControlFocusedProperty;
19
import org.eclipse.jface.internal.databinding.swt.ControlFontProperty;
20
import org.eclipse.jface.internal.databinding.swt.ControlForegroundProperty;
21
import org.eclipse.jface.internal.databinding.swt.ControlLocationProperty;
22
import org.eclipse.jface.internal.databinding.swt.ControlSizeProperty;
23
import org.eclipse.jface.internal.databinding.swt.ControlTooltipTextProperty;
24
import org.eclipse.jface.internal.databinding.swt.ControlVisibleProperty;
25
26
/**
27
 * A factory for creating properties of SWT controls.
28
 * 
29
 * @since 1.3
30
 */
31
public class ControlProperties {
32
	/**
33
	 * Returns a value property for the enablement state of a SWT Control.
34
	 * 
35
	 * @return a value property for the enablement state of a SWT Control.
36
	 */
37
	public static IValueProperty enabled() {
38
		return new ControlEnabledProperty();
39
	}
40
41
	/**
42
	 * Returns a value property for the visibility state of a SWT Control.
43
	 * 
44
	 * @return a value property for the visibility state of a SWT Control.
45
	 */
46
	public static IValueProperty visible() {
47
		return new ControlVisibleProperty();
48
	}
49
50
	/**
51
	 * Returns a value property for the tooltip text of a SWT Control.
52
	 * 
53
	 * @return a value property for the tooltip text of a SWT Control.
54
	 */
55
	public static IValueProperty toolTipText() {
56
		return new ControlTooltipTextProperty();
57
	}
58
59
	/**
60
	 * Returns a value property for the foreground color of a SWT Control.
61
	 * 
62
	 * @return a value property for the foreground color of a SWT Control.
63
	 */
64
	public static IValueProperty foreground() {
65
		return new ControlForegroundProperty();
66
	}
67
68
	/**
69
	 * Returns a value property for the background color of a SWT Control.
70
	 * 
71
	 * @return a value property for the background color of a SWT Control.
72
	 */
73
	public static IValueProperty background() {
74
		return new ControlBackgroundProperty();
75
	}
76
77
	/**
78
	 * Returns a value property for the font of a SWT Control.
79
	 * 
80
	 * @return a value property for the font of a SWT Control.
81
	 */
82
	public static IValueProperty font() {
83
		return new ControlFontProperty();
84
	}
85
86
	/**
87
	 * Returns a value property for the size of a SWT Control.
88
	 * 
89
	 * @return a value property for the size of a SWT Control.
90
	 */
91
	public static IValueProperty size() {
92
		return new ControlSizeProperty();
93
	}
94
95
	/**
96
	 * Returns a value property for the location of a SWT Control.
97
	 * 
98
	 * @return a value property for the location of a SWT Control.
99
	 */
100
	public static IValueProperty location() {
101
		return new ControlLocationProperty();
102
	}
103
104
	/**
105
	 * Returns a value property for the bounds of a SWT Control.
106
	 * 
107
	 * @return a value property for the bounds of a SWT Control.
108
	 */
109
	public static IValueProperty bounds() {
110
		return new ControlBoundsProperty();
111
	}
112
113
	/**
114
	 * Returns a value property for the focus state of a SWT Control.
115
	 * 
116
	 * @return a value property for the focus state of a SWT Control.
117
	 */
118
	public static IValueProperty focused() {
119
		return new ControlFocusedProperty();
120
	}
121
}
(-)src/org/eclipse/jface/databinding/swt/CLabelProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.CLabelTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT Labels.
19
 * 
20
 * @since 1.3
21
 */
22
public class CLabelProperties {
23
	/**
24
	 * Returns a value property for the text of a SWT Label.
25
	 * 
26
	 * @return a value property for the text of a SWT Label.
27
	 */
28
	public static IValueProperty text() {
29
		return new CLabelTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/CTabItemProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.CTabItemTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT CTabItems
19
 * 
20
 * @since 1.3
21
 */
22
public class CTabItemProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT CTabItem.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT CTabItem.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new CTabItemTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/TreeColumnProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TreeItemTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT TabItems
19
 * 
20
 * @since 1.3
21
 */
22
public class TreeColumnProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT TreeColumn.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT TreeColumn.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new TreeItemTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/SWTObservables.java (-198 / +33 lines)
Lines 26-67 Link Here
26
import org.eclipse.core.databinding.observable.value.IObservableValue;
26
import org.eclipse.core.databinding.observable.value.IObservableValue;
27
import org.eclipse.core.databinding.observable.value.IVetoableValue;
27
import org.eclipse.core.databinding.observable.value.IVetoableValue;
28
import org.eclipse.core.databinding.observable.value.ValueChangingEvent;
28
import org.eclipse.core.databinding.observable.value.ValueChangingEvent;
29
import org.eclipse.core.databinding.property.list.IListProperty;
30
import org.eclipse.core.databinding.property.value.IValueProperty;
31
import org.eclipse.jface.internal.databinding.swt.SWTDelayedObservableValueDecorator;
29
import org.eclipse.jface.internal.databinding.swt.SWTDelayedObservableValueDecorator;
32
import org.eclipse.jface.internal.databinding.swt.SWTObservableListDecorator;
33
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
34
import org.eclipse.jface.internal.databinding.swt.SWTVetoableValueDecorator;
35
import org.eclipse.swt.SWT;
36
import org.eclipse.swt.custom.CCombo;
37
import org.eclipse.swt.custom.CLabel;
38
import org.eclipse.swt.custom.CTabItem;
39
import org.eclipse.swt.custom.StyledText;
40
import org.eclipse.swt.widgets.Button;
41
import org.eclipse.swt.widgets.Combo;
42
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Control;
43
import org.eclipse.swt.widgets.Display;
31
import org.eclipse.swt.widgets.Display;
44
import org.eclipse.swt.widgets.Item;
45
import org.eclipse.swt.widgets.Label;
46
import org.eclipse.swt.widgets.Link;
47
import org.eclipse.swt.widgets.List;
48
import org.eclipse.swt.widgets.Scale;
49
import org.eclipse.swt.widgets.Shell;
50
import org.eclipse.swt.widgets.Spinner;
51
import org.eclipse.swt.widgets.TabItem;
52
import org.eclipse.swt.widgets.Table;
53
import org.eclipse.swt.widgets.TableColumn;
54
import org.eclipse.swt.widgets.Text;
55
import org.eclipse.swt.widgets.ToolItem;
56
import org.eclipse.swt.widgets.TrayItem;
57
import org.eclipse.swt.widgets.TreeColumn;
58
import org.eclipse.swt.widgets.Widget;
32
import org.eclipse.swt.widgets.Widget;
59
33
60
/**
34
/**
61
 * A factory for creating observables for SWT widgets
35
 * A factory for creating observables for SWT widgets
62
 * 
36
 * 
63
 * @since 1.1
37
 * @since 1.1
64
 * 
65
 */
38
 */
66
public class SWTObservables {
39
public class SWTObservables {
67
40
Lines 124-135 Link Here
124
				.observeDelayedValue(delay, observable), observable.getWidget());
97
				.observeDelayedValue(delay, observable), observable.getWidget());
125
	}
98
	}
126
99
127
	private static ISWTObservableValue observeWidgetProperty(Widget widget,
128
			IValueProperty property) {
129
		return new SWTObservableValueDecorator(property.observe(getRealm(widget
130
				.getDisplay()), widget), widget);
131
	}
132
133
	/**
100
	/**
134
	 * Returns an observable value tracking the enabled state of the given
101
	 * Returns an observable value tracking the enabled state of the given
135
	 * control
102
	 * control
Lines 140-146 Link Here
140
	 *         control
107
	 *         control
141
	 */
108
	 */
142
	public static ISWTObservableValue observeEnabled(Control control) {
109
	public static ISWTObservableValue observeEnabled(Control control) {
143
		return observeWidgetProperty(control, ControlProperties.enabled());
110
		return (ISWTObservableValue) WidgetProperties.enabled()
111
				.observe(control);
144
	}
112
	}
145
113
146
	/**
114
	/**
Lines 153-159 Link Here
153
	 *         control
121
	 *         control
154
	 */
122
	 */
155
	public static ISWTObservableValue observeVisible(Control control) {
123
	public static ISWTObservableValue observeVisible(Control control) {
156
		return observeWidgetProperty(control, ControlProperties.visible());
124
		return (ISWTObservableValue) WidgetProperties.visible()
125
				.observe(control);
157
	}
126
	}
158
127
159
	/**
128
	/**
Lines 175-203 Link Here
175
	 * @since 1.3
144
	 * @since 1.3
176
	 */
145
	 */
177
	public static ISWTObservableValue observeTooltipText(Widget widget) {
146
	public static ISWTObservableValue observeTooltipText(Widget widget) {
178
		if (widget instanceof Control) {
147
		return (ISWTObservableValue) WidgetProperties.tooltipText().observe(
179
			return observeTooltipText((Control) widget);
148
				widget);
180
		}
181
182
		IValueProperty property;
183
		if (widget instanceof CTabItem) {
184
			property = CTabItemProperties.tooltipText();
185
		} else if (widget instanceof TabItem) {
186
			property = TabItemProperties.tooltipText();
187
		} else if (widget instanceof TableColumn) {
188
			property = TableColumnProperties.tooltipText();
189
		} else if (widget instanceof ToolItem) {
190
			property = ToolItemProperties.tooltipText();
191
		} else if (widget instanceof TrayItem) {
192
			property = TrayItemProperties.tooltipText();
193
		} else if (widget instanceof TreeColumn) {
194
			property = TreeColumnProperties.tooltipText();
195
		} else {
196
			throw new IllegalArgumentException(
197
					"Item [" + widget.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
198
		}
199
200
		return observeWidgetProperty(widget, property);
201
	}
149
	}
202
150
203
	/**
151
	/**
Lines 210-216 Link Here
210
	 *         control
158
	 *         control
211
	 */
159
	 */
212
	public static ISWTObservableValue observeTooltipText(Control control) {
160
	public static ISWTObservableValue observeTooltipText(Control control) {
213
		return observeWidgetProperty(control, ControlProperties.toolTipText());
161
		return observeTooltipText((Widget) control);
214
	}
162
	}
215
163
216
	/**
164
	/**
Lines 231-255 Link Here
231
	 *             if <code>control</code> type is unsupported
179
	 *             if <code>control</code> type is unsupported
232
	 */
180
	 */
233
	public static ISWTObservableValue observeSelection(Control control) {
181
	public static ISWTObservableValue observeSelection(Control control) {
234
		IValueProperty property;
182
		return (ISWTObservableValue) WidgetProperties.selection().observe(
235
		if (control instanceof Spinner) {
183
				control);
236
			property = SpinnerProperties.selection();
237
		} else if (control instanceof Button) {
238
			property = ButtonProperties.selection();
239
		} else if (control instanceof Combo) {
240
			property = ComboProperties.selection();
241
		} else if (control instanceof CCombo) {
242
			property = CComboProperties.selection();
243
		} else if (control instanceof List) {
244
			property = ListProperties.selection();
245
		} else if (control instanceof Scale) {
246
			property = ScaleProperties.selection();
247
		} else {
248
			throw new IllegalArgumentException(
249
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
250
		}
251
252
		return observeWidgetProperty(control, property);
253
	}
184
	}
254
185
255
	/**
186
	/**
Lines 266-282 Link Here
266
	 *             if <code>control</code> type is unsupported
197
	 *             if <code>control</code> type is unsupported
267
	 */
198
	 */
268
	public static ISWTObservableValue observeMin(Control control) {
199
	public static ISWTObservableValue observeMin(Control control) {
269
		IValueProperty property;
200
		return (ISWTObservableValue) WidgetProperties.minimum()
270
		if (control instanceof Spinner) {
201
				.observe(control);
271
			property = SpinnerProperties.minimum();
272
		} else if (control instanceof Scale) {
273
			property = ScaleProperties.minimum();
274
		} else {
275
			throw new IllegalArgumentException(
276
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
277
		}
278
279
		return observeWidgetProperty(control, property);
280
	}
202
	}
281
203
282
	/**
204
	/**
Lines 293-309 Link Here
293
	 *             if <code>control</code> type is unsupported
215
	 *             if <code>control</code> type is unsupported
294
	 */
216
	 */
295
	public static ISWTObservableValue observeMax(Control control) {
217
	public static ISWTObservableValue observeMax(Control control) {
296
		IValueProperty property;
218
		return (ISWTObservableValue) WidgetProperties.maximum()
297
		if (control instanceof Spinner) {
219
				.observe(control);
298
			property = SpinnerProperties.maximum();
299
		} else if (control instanceof Scale) {
300
			property = ScaleProperties.maximum();
301
		} else {
302
			throw new IllegalArgumentException(
303
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
304
		}
305
306
		return observeWidgetProperty(control, property);
307
	}
220
	}
308
221
309
	/**
222
	/**
Lines 322-339 Link Here
322
	 *             if <code>control</code> type is unsupported
235
	 *             if <code>control</code> type is unsupported
323
	 */
236
	 */
324
	public static ISWTObservableValue observeText(Control control, int event) {
237
	public static ISWTObservableValue observeText(Control control, int event) {
325
		IValueProperty property;
238
		return (ISWTObservableValue) WidgetProperties.text(event).observe(
326
		if (control instanceof Text) {
239
				control);
327
			property = TextProperties.text(event);
328
		} else if (control instanceof StyledText) {
329
			property = StyledTextProperties.text(event);
330
		} else {
331
			throw new IllegalArgumentException(
332
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
333
		}
334
335
		return new SWTVetoableValueDecorator(property.observe(getRealm(control
336
				.getDisplay()), control), control);
337
	}
240
	}
338
241
339
	/**
242
	/**
Lines 358-371 Link Here
358
	 * @since 1.3
261
	 * @since 1.3
359
	 */
262
	 */
360
	public static ISWTObservableValue observeText(Widget widget) {
263
	public static ISWTObservableValue observeText(Widget widget) {
361
		if (widget instanceof Control) {
264
		return (ISWTObservableValue) WidgetProperties.text().observe(widget);
362
			return observeText((Control) widget);
363
		} else if (widget instanceof Item) {
364
			return observeWidgetProperty(widget, ItemProperties.text());
365
		}
366
367
		throw new IllegalArgumentException(
368
				"Widget [" + widget.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
369
	}
265
	}
370
266
371
	/**
267
	/**
Lines 388-416 Link Here
388
	 *             if <code>control</code> type is unsupported
284
	 *             if <code>control</code> type is unsupported
389
	 */
285
	 */
390
	public static ISWTObservableValue observeText(Control control) {
286
	public static ISWTObservableValue observeText(Control control) {
391
		if (control instanceof Text || control instanceof StyledText) {
287
		return observeText((Widget) control);
392
			return observeText(control, SWT.None);
393
		}
394
395
		IValueProperty property;
396
		if (control instanceof Label) {
397
			property = LabelProperties.text();
398
		} else if (control instanceof Link) {
399
			property = LinkProperties.text();
400
		} else if (control instanceof CLabel) {
401
			property = CLabelProperties.text();
402
		} else if (control instanceof Combo) {
403
			property = ComboProperties.text();
404
		} else if (control instanceof CCombo) {
405
			property = CComboProperties.text();
406
		} else if (control instanceof Shell) {
407
			property = ShellProperties.text();
408
		} else {
409
			throw new IllegalArgumentException(
410
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
411
		}
412
413
		return observeWidgetProperty(control, property);
414
	}
288
	}
415
289
416
	/**
290
	/**
Lines 428-447 Link Here
428
	 *             if <code>control</code> type is unsupported
302
	 *             if <code>control</code> type is unsupported
429
	 */
303
	 */
430
	public static IObservableList observeItems(Control control) {
304
	public static IObservableList observeItems(Control control) {
431
		IListProperty property;
305
		return WidgetProperties.items().observe(control);
432
		if (control instanceof Combo) {
433
			property = ComboProperties.items();
434
		} else if (control instanceof CCombo) {
435
			property = CComboProperties.items();
436
		} else if (control instanceof List) {
437
			property = ListProperties.items();
438
		} else {
439
			throw new IllegalArgumentException(
440
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
441
		}
442
443
		return new SWTObservableListDecorator(property.observe(getRealm(control
444
				.getDisplay()), control), control);
445
	}
306
	}
446
307
447
	/**
308
	/**
Lines 461-481 Link Here
461
	 */
322
	 */
462
	public static ISWTObservableValue observeSingleSelectionIndex(
323
	public static ISWTObservableValue observeSingleSelectionIndex(
463
			Control control) {
324
			Control control) {
464
		IValueProperty property;
325
		return (ISWTObservableValue) WidgetProperties.singleSelectionIndex()
465
		if (control instanceof Table) {
326
				.observe(control);
466
			property = TableProperties.singleSelectionIndex();
467
		} else if (control instanceof Combo) {
468
			property = ComboProperties.singleSelectionIndex();
469
		} else if (control instanceof CCombo) {
470
			property = CComboProperties.singleSelectionIndex();
471
		} else if (control instanceof List) {
472
			property = ListProperties.singleSelectionIndex();
473
		} else {
474
			throw new IllegalArgumentException(
475
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
476
		}
477
478
		return observeWidgetProperty(control, property);
479
	}
327
	}
480
328
481
	/**
329
	/**
Lines 488-494 Link Here
488
	 *         control
336
	 *         control
489
	 */
337
	 */
490
	public static ISWTObservableValue observeForeground(Control control) {
338
	public static ISWTObservableValue observeForeground(Control control) {
491
		return observeWidgetProperty(control, ControlProperties.foreground());
339
		return (ISWTObservableValue) WidgetProperties.foreground().observe(
340
				control);
492
	}
341
	}
493
342
494
	/**
343
	/**
Lines 501-507 Link Here
501
	 *         control
350
	 *         control
502
	 */
351
	 */
503
	public static ISWTObservableValue observeBackground(Control control) {
352
	public static ISWTObservableValue observeBackground(Control control) {
504
		return observeWidgetProperty(control, ControlProperties.background());
353
		return (ISWTObservableValue) WidgetProperties.background().observe(
354
				control);
505
	}
355
	}
506
356
507
	/**
357
	/**
Lines 512-518 Link Here
512
	 * @return an observable value tracking the font of the given control
362
	 * @return an observable value tracking the font of the given control
513
	 */
363
	 */
514
	public static ISWTObservableValue observeFont(Control control) {
364
	public static ISWTObservableValue observeFont(Control control) {
515
		return observeWidgetProperty(control, ControlProperties.font());
365
		return (ISWTObservableValue) WidgetProperties.font().observe(control);
516
	}
366
	}
517
367
518
	/**
368
	/**
Lines 524-530 Link Here
524
	 * @since 1.3
374
	 * @since 1.3
525
	 */
375
	 */
526
	public static ISWTObservableValue observeSize(Control control) {
376
	public static ISWTObservableValue observeSize(Control control) {
527
		return observeWidgetProperty(control, ControlProperties.size());
377
		return (ISWTObservableValue) WidgetProperties.size().observe(control);
528
	}
378
	}
529
379
530
	/**
380
	/**
Lines 536-542 Link Here
536
	 * @since 1.3
386
	 * @since 1.3
537
	 */
387
	 */
538
	public static ISWTObservableValue observeLocation(Control control) {
388
	public static ISWTObservableValue observeLocation(Control control) {
539
		return observeWidgetProperty(control, ControlProperties.location());
389
		return (ISWTObservableValue) WidgetProperties.location().observe(
390
				control);
540
	}
391
	}
541
392
542
	/**
393
	/**
Lines 548-554 Link Here
548
	 * @since 1.3
399
	 * @since 1.3
549
	 */
400
	 */
550
	public static ISWTObservableValue observeFocus(Control control) {
401
	public static ISWTObservableValue observeFocus(Control control) {
551
		return observeWidgetProperty(control, ControlProperties.focused());
402
		return (ISWTObservableValue) WidgetProperties.focused()
403
				.observe(control);
552
	}
404
	}
553
405
554
	/**
406
	/**
Lines 560-566 Link Here
560
	 * @since 1.3
412
	 * @since 1.3
561
	 */
413
	 */
562
	public static ISWTObservableValue observeBounds(Control control) {
414
	public static ISWTObservableValue observeBounds(Control control) {
563
		return observeWidgetProperty(control, ControlProperties.bounds());
415
		return (ISWTObservableValue) WidgetProperties.bounds().observe(control);
564
	}
416
	}
565
417
566
	/**
418
	/**
Lines 576-590 Link Here
576
	 *             if <code>control</code> type is unsupported
428
	 *             if <code>control</code> type is unsupported
577
	 */
429
	 */
578
	public static ISWTObservableValue observeEditable(Control control) {
430
	public static ISWTObservableValue observeEditable(Control control) {
579
		IValueProperty property;
431
		return (ISWTObservableValue) WidgetProperties.editable().observe(
580
		if (control instanceof Text) {
432
				control);
581
			property = TextProperties.editable();
582
		} else {
583
			throw new IllegalArgumentException(
584
					"Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
585
		}
586
587
		return observeWidgetProperty(control, property);
588
	}
433
	}
589
434
590
	private static class DisplayRealm extends Realm {
435
	private static class DisplayRealm extends Realm {
Lines 623-642 Link Here
623
			}
468
			}
624
		}
469
		}
625
470
626
		/*
627
		 * (non-Javadoc)
628
		 * 
629
		 * @see java.lang.Object#hashCode()
630
		 */
631
		public int hashCode() {
471
		public int hashCode() {
632
			return (display == null) ? 0 : display.hashCode();
472
			return (display == null) ? 0 : display.hashCode();
633
		}
473
		}
634
474
635
		/*
636
		 * (non-Javadoc)
637
		 * 
638
		 * @see java.lang.Object#equals(java.lang.Object)
639
		 */
640
		public boolean equals(Object obj) {
475
		public boolean equals(Object obj) {
641
			if (this == obj)
476
			if (this == obj)
642
				return true;
477
				return true;
(-)src/org/eclipse/jface/databinding/swt/LinkProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.LinkTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT Links.
19
 * 
20
 * @since 1.3
21
 */
22
public class LinkProperties {
23
	/**
24
	 * Returns a value property for the text of a SWT Link.
25
	 * 
26
	 * @return a value property for the text of a SWT Link.
27
	 */
28
	public static IValueProperty text() {
29
		return new LinkTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ButtonProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ButtonSelectionProperty;
16
17
/**
18
 * A factory for creating properties of SWT Buttons.
19
 * 
20
 * @since 1.3
21
 */
22
public class ButtonProperties {
23
	/**
24
	 * Returns a value property for the selection state of a SWT Button.
25
	 * 
26
	 * @return a value property for the selection state of a SWT Button.
27
	 */
28
	public static IValueProperty selection() {
29
		return new ButtonSelectionProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/CComboProperties.java (-62 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.list.IListProperty;
15
import org.eclipse.core.databinding.property.value.IValueProperty;
16
import org.eclipse.jface.internal.databinding.swt.CComboItemsProperty;
17
import org.eclipse.jface.internal.databinding.swt.CComboSelectionProperty;
18
import org.eclipse.jface.internal.databinding.swt.CComboSingleSelectionIndexProperty;
19
import org.eclipse.jface.internal.databinding.swt.CComboTextProperty;
20
21
/**
22
 * A factory for creating properties of SWT CCombos
23
 * 
24
 * @since 1.3
25
 */
26
public class CComboProperties {
27
	/**
28
	 * Returns a value property for the selection text of a SWT CCombo.
29
	 * 
30
	 * @return a value property for the selection text of a SWT CCombo.
31
	 */
32
	public static IValueProperty selection() {
33
		return new CComboSelectionProperty();
34
	}
35
36
	/**
37
	 * Returns a value property for the text of a SWT CCombo.
38
	 * 
39
	 * @return a value property for the text of a SWT CCombo.
40
	 */
41
	public static IValueProperty text() {
42
		return new CComboTextProperty();
43
	}
44
45
	/**
46
	 * Returns a list property for the items of a SWT CCombo.
47
	 * 
48
	 * @return a list property for the items of a SWT CCombo.
49
	 */
50
	public static IListProperty items() {
51
		return new CComboItemsProperty();
52
	}
53
54
	/**
55
	 * Returns a value property for the single selection index of a SWT Combo.
56
	 * 
57
	 * @return a value property for the single selection index of a SWT Combo.
58
	 */
59
	public static IValueProperty singleSelectionIndex() {
60
		return new CComboSingleSelectionIndexProperty();
61
	}
62
}
(-)src/org/eclipse/jface/databinding/swt/StyledTextProperties.java (-36 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.StyledTextTextProperty;
16
import org.eclipse.swt.SWT;
17
18
/**
19
 * A factory for creating properties of SWT StyledTexts.
20
 * 
21
 * @since 1.3
22
 */
23
public class StyledTextProperties {
24
	/**
25
	 * Returns a value property for the text of a SWT StyledText.
26
	 * 
27
	 * @param event
28
	 *            the SWT event type to register for change events. May be
29
	 *            {@link SWT#None}, {@link SWT#Modify} or {@link SWT#FocusOut}.
30
	 * 
31
	 * @return a value property for the text of a SWT StyledText.
32
	 */
33
	public static IValueProperty text(int event) {
34
		return new StyledTextTextProperty(event);
35
	}
36
}
(-)src/org/eclipse/jface/databinding/swt/ShellProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.ShellTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT Shells.
19
 * 
20
 * @since 1.3
21
 */
22
public class ShellProperties {
23
	/**
24
	 * Returns a value property for the text of a SWT Shell.
25
	 * 
26
	 * @return a value property for the text of a SWT Shell.
27
	 */
28
	public static IValueProperty text() {
29
		return new ShellTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ListProperties.java (-52 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.list.IListProperty;
15
import org.eclipse.core.databinding.property.value.IValueProperty;
16
import org.eclipse.jface.internal.databinding.swt.ListItemsProperty;
17
import org.eclipse.jface.internal.databinding.swt.ListSelectionProperty;
18
import org.eclipse.jface.internal.databinding.swt.ListSingleSelectionIndexProperty;
19
20
/**
21
 * A factory for creating properties of SWT List controls.
22
 * 
23
 * @since 1.3
24
 */
25
public class ListProperties {
26
	/**
27
	 * Returns a value property for observing the selection text of a SWT List.
28
	 * 
29
	 * @return a value property for observing the selection text of a SWT List.
30
	 */
31
	public static IValueProperty selection() {
32
		return new ListSelectionProperty();
33
	}
34
35
	/**
36
	 * Returns a list property for observing the items in a SWT List.
37
	 * 
38
	 * @return a list property for observing the items in a SWT List.
39
	 */
40
	public static IListProperty items() {
41
		return new ListItemsProperty();
42
	}
43
44
	/**
45
	 * Returns a value property for the single selection index of a SWT List.
46
	 * 
47
	 * @return a value property for the single selection index of a SWT List.
48
	 */
49
	public static IValueProperty singleSelectionIndex() {
50
		return new ListSingleSelectionIndexProperty();
51
	}
52
}
(-)src/org/eclipse/jface/databinding/swt/TabItemProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TabItemTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT TabItems
19
 * 
20
 * @since 1.3
21
 */
22
public class TabItemProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT TabItem.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT TabItem.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new TabItemTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/swt/ComboProperties.java (-62 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.list.IListProperty;
15
import org.eclipse.core.databinding.property.value.IValueProperty;
16
import org.eclipse.jface.internal.databinding.swt.ComboItemsProperty;
17
import org.eclipse.jface.internal.databinding.swt.ComboSelectionProperty;
18
import org.eclipse.jface.internal.databinding.swt.ComboSingleSelectionIndexProperty;
19
import org.eclipse.jface.internal.databinding.swt.ComboTextProperty;
20
21
/**
22
 * A factory for creating properties of SWT Combos.
23
 * 
24
 * @since 1.3
25
 */
26
public class ComboProperties {
27
	/**
28
	 * Returns a value property for the selection text of a SWT Combo.
29
	 * 
30
	 * @return a value property for the selection text of a SWT Combo.
31
	 */
32
	public static IValueProperty selection() {
33
		return new ComboSelectionProperty();
34
	}
35
36
	/**
37
	 * Returns a value property for the text of a SWT Combo.
38
	 * 
39
	 * @return a value property for the text of a SWT Combo.
40
	 */
41
	public static IValueProperty text() {
42
		return new ComboTextProperty();
43
	}
44
45
	/**
46
	 * Returns a list property for the items of a SWT Combo.
47
	 * 
48
	 * @return a list property for the items of a SWT Combo.
49
	 */
50
	public static IListProperty items() {
51
		return new ComboItemsProperty();
52
	}
53
54
	/**
55
	 * Returns a value property for the single selection index of a SWT Combo.
56
	 * 
57
	 * @return a value property for the single selection index of a SWT Combo.
58
	 */
59
	public static IValueProperty singleSelectionIndex() {
60
		return new ComboSingleSelectionIndexProperty();
61
	}
62
}
(-)src/org/eclipse/jface/databinding/swt/TableColumnProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.value.IValueProperty;
15
import org.eclipse.jface.internal.databinding.swt.TableColumnTooltipTextProperty;
16
17
/**
18
 * A factory for creating properties of SWT TableColumns
19
 * 
20
 * @since 1.3
21
 */
22
public class TableColumnProperties {
23
	/**
24
	 * Returns a value property for the tooltip text of a SWT TableColumns.
25
	 * 
26
	 * @return a value property for the tooltip text of a SWT TableColumns.
27
	 */
28
	public static IValueProperty tooltipText() {
29
		return new TableColumnTooltipTextProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/viewers/ViewersObservables.java (-98 / +21 lines)
Lines 13-29 Link Here
13
package org.eclipse.jface.databinding.viewers;
13
package org.eclipse.jface.databinding.viewers;
14
14
15
import org.eclipse.core.databinding.observable.Observables;
15
import org.eclipse.core.databinding.observable.Observables;
16
import org.eclipse.core.databinding.observable.Realm;
17
import org.eclipse.core.databinding.observable.list.IObservableList;
16
import org.eclipse.core.databinding.observable.list.IObservableList;
18
import org.eclipse.core.databinding.observable.set.IObservableSet;
17
import org.eclipse.core.databinding.observable.set.IObservableSet;
19
import org.eclipse.core.databinding.observable.value.IObservableValue;
18
import org.eclipse.core.databinding.observable.value.IObservableValue;
20
import org.eclipse.core.databinding.property.list.IListProperty;
21
import org.eclipse.core.databinding.property.set.ISetProperty;
22
import org.eclipse.core.databinding.property.value.IValueProperty;
23
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.internal.databinding.swt.SWTDelayedObservableValueDecorator;
25
import org.eclipse.jface.internal.databinding.viewers.ViewerObservableListDecorator;
26
import org.eclipse.jface.internal.databinding.viewers.ViewerObservableSetDecorator;
27
import org.eclipse.jface.internal.databinding.viewers.ViewerObservableValueDecorator;
19
import org.eclipse.jface.internal.databinding.viewers.ViewerObservableValueDecorator;
28
import org.eclipse.jface.viewers.CheckboxTableViewer;
20
import org.eclipse.jface.viewers.CheckboxTableViewer;
29
import org.eclipse.jface.viewers.CheckboxTreeViewer;
21
import org.eclipse.jface.viewers.CheckboxTreeViewer;
Lines 32-38 Link Here
32
import org.eclipse.jface.viewers.IStructuredSelection;
24
import org.eclipse.jface.viewers.IStructuredSelection;
33
import org.eclipse.jface.viewers.StructuredViewer;
25
import org.eclipse.jface.viewers.StructuredViewer;
34
import org.eclipse.jface.viewers.Viewer;
26
import org.eclipse.jface.viewers.Viewer;
35
import org.eclipse.swt.widgets.Display;
36
27
37
/**
28
/**
38
 * Factory methods for creating observables for JFace viewers
29
 * Factory methods for creating observables for JFace viewers
Lines 40-106 Link Here
40
 * @since 1.1
31
 * @since 1.1
41
 */
32
 */
42
public class ViewersObservables {
33
public class ViewersObservables {
43
	private static Realm getDefaultRealm() {
34
	private static Object checkNull(Object obj) {
44
		return SWTObservables.getRealm(Display.getDefault());
45
	}
46
47
	private static Realm getRealm(Viewer viewer) {
48
		return SWTObservables.getRealm(viewer.getControl().getDisplay());
49
	}
50
51
	private static void checkNull(Object obj) {
52
		if (obj == null)
35
		if (obj == null)
53
			throw new IllegalArgumentException();
36
			throw new IllegalArgumentException();
54
	}
37
		return obj;
55
56
	private static IObservableValue observeProperty(Object source,
57
			IValueProperty property) {
58
		checkNull(source);
59
		if (source instanceof Viewer) {
60
			return observeViewerProperty((Viewer) source, property);
61
		}
62
		return property.observe(getDefaultRealm(), source);
63
	}
64
65
	private static IViewerObservableValue observeViewerProperty(Viewer viewer,
66
			IValueProperty property) {
67
		checkNull(viewer);
68
		return new ViewerObservableValueDecorator(property.observe(
69
				getRealm(viewer), viewer), viewer);
70
	}
71
72
	private static IObservableSet observeProperty(Object source,
73
			ISetProperty property) {
74
		checkNull(source);
75
		if (source instanceof Viewer) {
76
			return observeViewerProperty((Viewer) source, property);
77
		}
78
		return property.observe(getDefaultRealm(), source);
79
	}
80
81
	private static IViewerObservableSet observeViewerProperty(Viewer viewer,
82
			ISetProperty property) {
83
		checkNull(viewer);
84
		return new ViewerObservableSetDecorator(property.observe(
85
				getRealm(viewer), viewer), viewer);
86
	}
87
88
	private static IObservableList observeProperty(Object source,
89
			IListProperty property) {
90
		checkNull(source);
91
		if (source instanceof Viewer) {
92
			return observeViewerProperty((Viewer) source, property);
93
		}
94
		Realm realm = getDefaultRealm();
95
		return property.observe(realm, source);
96
	}
97
98
	private static IViewerObservableList observeViewerProperty(Viewer viewer,
99
			IListProperty property) {
100
		checkNull(viewer);
101
		Realm realm = getRealm(viewer);
102
		return new ViewerObservableListDecorator(property
103
				.observe(realm, viewer), viewer);
104
	}
38
	}
105
39
106
	/**
40
	/**
Lines 126-136 Link Here
126
	 */
60
	 */
127
	public static IViewerObservableValue observeDelayedValue(int delay,
61
	public static IViewerObservableValue observeDelayedValue(int delay,
128
			IViewerObservableValue observable) {
62
			IViewerObservableValue observable) {
129
		Viewer viewer = observable.getViewer();
63
		return new ViewerObservableValueDecorator(Observables
130
		return new ViewerObservableValueDecorator(
64
				.observeDelayedValue(delay, observable), observable.getViewer());
131
				new SWTDelayedObservableValueDecorator(Observables
132
						.observeDelayedValue(delay, observable), viewer
133
						.getControl()), viewer);
134
	}
65
	}
135
66
136
	/**
67
	/**
Lines 146-153 Link Here
146
	 */
77
	 */
147
	public static IObservableValue observeSingleSelection(
78
	public static IObservableValue observeSingleSelection(
148
			ISelectionProvider selectionProvider) {
79
			ISelectionProvider selectionProvider) {
149
		return observeProperty(selectionProvider, SelectionProviderProperties
80
		return ViewerProperties.singleSelection().observe(
150
				.singleSelection());
81
				checkNull(selectionProvider));
151
	}
82
	}
152
83
153
	/**
84
	/**
Lines 170-177 Link Here
170
	 */
101
	 */
171
	public static IObservableList observeMultiSelection(
102
	public static IObservableList observeMultiSelection(
172
			ISelectionProvider selectionProvider) {
103
			ISelectionProvider selectionProvider) {
173
		return observeProperty(selectionProvider, SelectionProviderProperties
104
		return ViewerProperties.multipleSelection().observe(
174
				.multipleSelection());
105
				checkNull(selectionProvider));
175
	}
106
	}
176
107
177
	/**
108
	/**
Lines 188-195 Link Here
188
	 * @since 1.2
119
	 * @since 1.2
189
	 */
120
	 */
190
	public static IViewerObservableValue observeSingleSelection(Viewer viewer) {
121
	public static IViewerObservableValue observeSingleSelection(Viewer viewer) {
191
		return observeViewerProperty(viewer, SelectionProviderProperties
122
		return (IViewerObservableValue) ViewerProperties.singleSelection()
192
				.singleSelection());
123
				.observe(checkNull(viewer));
193
	}
124
	}
194
125
195
	/**
126
	/**
Lines 210-217 Link Here
210
	 * @since 1.2
141
	 * @since 1.2
211
	 */
142
	 */
212
	public static IViewerObservableList observeMultiSelection(Viewer viewer) {
143
	public static IViewerObservableList observeMultiSelection(Viewer viewer) {
213
		return observeViewerProperty(viewer, SelectionProviderProperties
144
		return (IViewerObservableList) ViewerProperties.multipleSelection()
214
				.multipleSelection());
145
				.observe(checkNull(viewer));
215
	}
146
	}
216
147
217
	/**
148
	/**
Lines 226-232 Link Here
226
	 * @since 1.2
157
	 * @since 1.2
227
	 */
158
	 */
228
	public static IObservableValue observeInput(Viewer viewer) {
159
	public static IObservableValue observeInput(Viewer viewer) {
229
		return observeViewerProperty(viewer, ViewerProperties.input());
160
		return ViewerProperties.input().observe(checkNull(viewer));
230
	}
161
	}
231
162
232
	/**
163
	/**
Lines 243-258 Link Here
243
	 */
174
	 */
244
	public static IObservableSet observeCheckedElements(ICheckable checkable,
175
	public static IObservableSet observeCheckedElements(ICheckable checkable,
245
			Object elementType) {
176
			Object elementType) {
246
		if (checkable instanceof CheckboxTableViewer) {
177
		return ViewerProperties.checkedElements(elementType).observe(
247
			return observeCheckedElements((CheckboxTableViewer) checkable,
178
				checkNull(checkable));
248
					elementType);
249
		}
250
		if (checkable instanceof CheckboxTreeViewer) {
251
			return observeCheckedElements((CheckboxTreeViewer) checkable,
252
					elementType);
253
		}
254
		return observeProperty(checkable, CheckableProperties
255
				.checkedElements(elementType));
256
	}
179
	}
257
180
258
	/**
181
	/**
Lines 270-277 Link Here
270
	 */
193
	 */
271
	public static IViewerObservableSet observeCheckedElements(
194
	public static IViewerObservableSet observeCheckedElements(
272
			CheckboxTableViewer viewer, Object elementType) {
195
			CheckboxTableViewer viewer, Object elementType) {
273
		return observeViewerProperty(viewer, CheckboxTableViewerProperties
196
		return (IViewerObservableSet) ViewerProperties.checkedElements(
274
				.checkedElements(elementType));
197
				elementType).observe(checkNull(viewer));
275
	}
198
	}
276
199
277
	/**
200
	/**
Lines 289-296 Link Here
289
	 */
212
	 */
290
	public static IViewerObservableSet observeCheckedElements(
213
	public static IViewerObservableSet observeCheckedElements(
291
			CheckboxTreeViewer viewer, Object elementType) {
214
			CheckboxTreeViewer viewer, Object elementType) {
292
		return observeViewerProperty(viewer, CheckboxTreeViewerProperties
215
		return (IViewerObservableSet) ViewerProperties.checkedElements(
293
				.checkedElements(elementType));
216
				elementType).observe(checkNull(viewer));
294
	}
217
	}
295
218
296
	/**
219
	/**
Lines 311-317 Link Here
311
	 * @since 1.3
234
	 * @since 1.3
312
	 */
235
	 */
313
	public static IViewerObservableSet observeFilters(StructuredViewer viewer) {
236
	public static IViewerObservableSet observeFilters(StructuredViewer viewer) {
314
		return observeViewerProperty(viewer, StructuredViewerProperties
237
		return (IViewerObservableSet) ViewerProperties.filters().observe(
315
				.filters());
238
				checkNull(viewer));
316
	}
239
	}
317
}
240
}
(-)src/org/eclipse/jface/databinding/viewers/StructuredViewerProperties.java (-31 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.viewers;
13
14
import org.eclipse.core.databinding.property.set.ISetProperty;
15
import org.eclipse.jface.internal.databinding.viewers.StructuredViewerFiltersProperty;
16
17
/**
18
 * A factory for creating properties of JFace StructuredViewers
19
 * 
20
 * @since 1.3
21
 */
22
public class StructuredViewerProperties {
23
	/**
24
	 * Returns a value property for the input of a JFace StructuredViewer.
25
	 * 
26
	 * @return a value property for the input of a JFace StructuredViewer.
27
	 */
28
	public static ISetProperty filters() {
29
		return new StructuredViewerFiltersProperty();
30
	}
31
}
(-)src/org/eclipse/jface/databinding/viewers/ViewerProperties.java (-3 / +82 lines)
Lines 11-31 Link Here
11
11
12
package org.eclipse.jface.databinding.viewers;
12
package org.eclipse.jface.databinding.viewers;
13
13
14
import org.eclipse.core.databinding.property.list.IListProperty;
15
import org.eclipse.core.databinding.property.set.DelegatingSetProperty;
16
import org.eclipse.core.databinding.property.set.ISetProperty;
14
import org.eclipse.core.databinding.property.value.IValueProperty;
17
import org.eclipse.core.databinding.property.value.IValueProperty;
18
import org.eclipse.jface.internal.databinding.viewers.CheckableCheckedElementsProperty;
19
import org.eclipse.jface.internal.databinding.viewers.CheckboxTableViewerCheckedElementsProperty;
20
import org.eclipse.jface.internal.databinding.viewers.CheckboxTreeViewerCheckedElementsProperty;
21
import org.eclipse.jface.internal.databinding.viewers.SelectionProviderMultipleSelectionProperty;
22
import org.eclipse.jface.internal.databinding.viewers.SelectionProviderSingleSelectionProperty;
23
import org.eclipse.jface.internal.databinding.viewers.StructuredViewerFiltersProperty;
15
import org.eclipse.jface.internal.databinding.viewers.ViewerInputProperty;
24
import org.eclipse.jface.internal.databinding.viewers.ViewerInputProperty;
25
import org.eclipse.jface.viewers.CheckboxTableViewer;
26
import org.eclipse.jface.viewers.CheckboxTreeViewer;
27
import org.eclipse.jface.viewers.ICheckable;
28
import org.eclipse.jface.viewers.ISelectionProvider;
29
import org.eclipse.jface.viewers.StructuredViewer;
30
import org.eclipse.jface.viewers.Viewer;
16
31
17
/**
32
/**
18
 * A factory for creating properties of JFace Viewers
33
 * A factory for creating properties of JFace {@link Viewer viewers}.
19
 * 
34
 * 
20
 * @since 1.3
35
 * @since 1.3
21
 */
36
 */
22
public class ViewerProperties {
37
public class ViewerProperties {
23
	/**
38
	/**
24
	 * Returns a value property for the input of a JFace Viewer.
39
	 * Returns a set property for observing the checked elements of a
40
	 * {@link CheckboxTableViewer}, {@link CheckboxTreeViewer} or
41
	 * {@link ICheckable}.
25
	 * 
42
	 * 
26
	 * @return a value property for the input of a JFace Viewer.
43
	 * @param elementType
44
	 *            the element type of the returned property
45
	 * 
46
	 * @return a set property for observing the checked elements of a
47
	 *         {@link CheckboxTableViewer}, {@link CheckboxTreeViewer} or
48
	 *         {@link ICheckable}.
49
	 */
50
	public static ISetProperty checkedElements(final Object elementType) {
51
		return new DelegatingSetProperty(elementType) {
52
			ISetProperty checkable = new CheckableCheckedElementsProperty(
53
					elementType);
54
			ISetProperty checkboxTableViewer = new CheckboxTableViewerCheckedElementsProperty(
55
					elementType);
56
			ISetProperty checkboxTreeViewer = new CheckboxTreeViewerCheckedElementsProperty(
57
					elementType);
58
59
			protected ISetProperty doGetDelegate(Object source) {
60
				if (source instanceof CheckboxTableViewer)
61
					return checkboxTableViewer;
62
				if (source instanceof CheckboxTreeViewer)
63
					return checkboxTreeViewer;
64
				return checkable;
65
			}
66
		};
67
	}
68
69
	/**
70
	 * Returns a value property for observing the input of a
71
	 * {@link StructuredViewer}.
72
	 * 
73
	 * @return a value property for observing the input of a
74
	 *         {@link StructuredViewer}.
75
	 */
76
	public static ISetProperty filters() {
77
		return new StructuredViewerFiltersProperty();
78
	}
79
80
	/**
81
	 * Returns a value property for observing the input of a {@link Viewer}.
82
	 * 
83
	 * @return a value property for observing the input of a {@link Viewer}.
27
	 */
84
	 */
28
	public static IValueProperty input() {
85
	public static IValueProperty input() {
29
		return new ViewerInputProperty();
86
		return new ViewerInputProperty();
30
	}
87
	}
88
89
	/**
90
	 * Returns a list property for observing the multiple selection of an
91
	 * {@link ISelectionProvider}.
92
	 * 
93
	 * @return a list property for observing the multiple selection of an
94
	 *         {@link ISelectionProvider}.
95
	 */
96
	public static IListProperty multipleSelection() {
97
		return new SelectionProviderMultipleSelectionProperty();
98
	}
99
100
	/**
101
	 * Returns a value property for observing the single selection of a
102
	 * {@link ISelectionProvider}.
103
	 * 
104
	 * @return a value property for observing the single selection of a
105
	 *         {@link ISelectionProvider}.
106
	 */
107
	public static IValueProperty singleSelection() {
108
		return new SelectionProviderSingleSelectionProperty();
109
	}
31
}
110
}
(-)src/org/eclipse/jface/databinding/viewers/CheckboxTreeViewerProperties.java (-36 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.viewers;
13
14
import org.eclipse.core.databinding.property.set.ISetProperty;
15
import org.eclipse.jface.internal.databinding.viewers.CheckboxTreeViewerCheckedElementsProperty;
16
17
/**
18
 * A factory for creating properties of JFace CheckboxTreeViewer
19
 * 
20
 * @since 1.3
21
 */
22
public class CheckboxTreeViewerProperties {
23
	/**
24
	 * Returns a set property for the checked elements of a JFace
25
	 * CheckboxTreeViewer.
26
	 * 
27
	 * @param elementType
28
	 *            the element type of the returned property
29
	 * 
30
	 * @return a set property for the checked elements of a JFace
31
	 *         CheckboxTreeViewer.
32
	 */
33
	public static ISetProperty checkedElements(Object elementType) {
34
		return new CheckboxTreeViewerCheckedElementsProperty(elementType);
35
	}
36
}
(-)src/org/eclipse/jface/databinding/viewers/SelectionProviderProperties.java (-46 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.viewers;
13
14
import org.eclipse.core.databinding.property.list.IListProperty;
15
import org.eclipse.core.databinding.property.value.IValueProperty;
16
import org.eclipse.jface.internal.databinding.viewers.SelectionProviderMultipleSelectionProperty;
17
import org.eclipse.jface.internal.databinding.viewers.SelectionProviderSingleSelectionProperty;
18
19
/**
20
 * A factory for creating properties of JFace ISelectionProviders
21
 * 
22
 * @since 1.3
23
 */
24
public class SelectionProviderProperties {
25
	/**
26
	 * Returns a value property for the single selection of a JFace
27
	 * ISelectionProvider.
28
	 * 
29
	 * @return a value property for the single selection of a JFace
30
	 *         ISelectionProvider.
31
	 */
32
	public static IValueProperty singleSelection() {
33
		return new SelectionProviderSingleSelectionProperty();
34
	}
35
36
	/**
37
	 * Returns a list property for the multiple selection of a JFace
38
	 * ISelectionProvider.
39
	 * 
40
	 * @return a list property for the multiple selection of a JFace
41
	 *         ISelectionProvider.
42
	 */
43
	public static IListProperty multipleSelection() {
44
		return new SelectionProviderMultipleSelectionProperty();
45
	}
46
}
(-)src/org/eclipse/jface/databinding/viewers/CheckboxTableViewerProperties.java (-36 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.viewers;
13
14
import org.eclipse.core.databinding.property.set.ISetProperty;
15
import org.eclipse.jface.internal.databinding.viewers.CheckboxTableViewerCheckedElementsProperty;
16
17
/**
18
 * A factory for creating properties of JFace CheckboxTableViewer
19
 * 
20
 * @since 1.3
21
 */
22
public class CheckboxTableViewerProperties {
23
	/**
24
	 * Returns a set property for the checked elements of a JFace
25
	 * CheckboxTableViewer.
26
	 * 
27
	 * @param elementType
28
	 *            the element type of the returned property
29
	 * 
30
	 * @return a set property for the checked elements of a JFace
31
	 *         CheckboxTableViewer.
32
	 */
33
	public static ISetProperty checkedElements(Object elementType) {
34
		return new CheckboxTableViewerCheckedElementsProperty(elementType);
35
	}
36
}
(-)src/org/eclipse/jface/databinding/viewers/CheckableProperties.java (-34 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.viewers;
13
14
import org.eclipse.core.databinding.property.set.ISetProperty;
15
import org.eclipse.jface.internal.databinding.viewers.CheckableCheckedElementsProperty;
16
17
/**
18
 * A factory for creating properties of JFace ICheckables
19
 * 
20
 * @since 1.3
21
 */
22
public class CheckableProperties {
23
	/**
24
	 * Returns a set property for the checked elements of a JFace ICheckable.
25
	 * 
26
	 * @param elementType
27
	 *            the element type of the returned property
28
	 * 
29
	 * @return a set property for the checked elements of a JFace ICheckable.
30
	 */
31
	public static ISetProperty checkedElements(Object elementType) {
32
		return new CheckableCheckedElementsProperty(elementType);
33
	}
34
}
(-)src/org/eclipse/jface/internal/databinding/swt/TextTextProperty.java (+8 lines)
Lines 11-18 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.IObservableValue;
15
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
14
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Text;
17
import org.eclipse.swt.widgets.Text;
18
import org.eclipse.swt.widgets.Widget;
16
19
17
/**
20
/**
18
 * @since 3.3
21
 * @since 3.3
Lines 49-52 Link Here
49
	public String toString() {
52
	public String toString() {
50
		return "Text.text <String>"; //$NON-NLS-1$
53
		return "Text.text <String>"; //$NON-NLS-1$
51
	}
54
	}
55
56
	protected ISWTObservableValue wrapObservable(IObservableValue observable,
57
			Widget widget) {
58
		return new SWTVetoableValueDecorator(observable, widget);
59
	}
52
}
60
}
(-)src/org/eclipse/jface/internal/databinding/swt/WidgetValueProperty.java (+11 lines)
Lines 12-21 Link Here
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.Realm;
14
import org.eclipse.core.databinding.observable.Realm;
15
import org.eclipse.core.databinding.observable.value.IObservableValue;
15
import org.eclipse.core.databinding.property.INativePropertyListener;
16
import org.eclipse.core.databinding.property.INativePropertyListener;
16
import org.eclipse.core.databinding.property.IPropertyChangeListener;
17
import org.eclipse.core.databinding.property.IPropertyChangeListener;
17
import org.eclipse.core.databinding.property.PropertyChangeEvent;
18
import org.eclipse.core.databinding.property.PropertyChangeEvent;
18
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
19
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
20
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
19
import org.eclipse.jface.databinding.swt.SWTObservables;
21
import org.eclipse.jface.databinding.swt.SWTObservables;
20
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.widgets.Event;
23
import org.eclipse.swt.widgets.Event;
Lines 86-89 Link Here
86
					WidgetValueProperty.this));
88
					WidgetValueProperty.this));
87
		}
89
		}
88
	}
90
	}
91
92
	public IObservableValue observe(Realm realm, Object source) {
93
		return wrapObservable(super.observe(realm, source), (Widget) source);
94
	}
95
96
	protected ISWTObservableValue wrapObservable(
97
			IObservableValue observable, Widget widget) {
98
		return new SWTObservableValueDecorator(observable, widget);
99
	}
89
}
100
}
(-)src/org/eclipse/jface/internal/databinding/swt/WidgetListProperty.java (+5 lines)
Lines 12-17 Link Here
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.Realm;
14
import org.eclipse.core.databinding.observable.Realm;
15
import org.eclipse.core.databinding.observable.list.IObservableList;
15
import org.eclipse.core.databinding.property.list.SimpleListProperty;
16
import org.eclipse.core.databinding.property.list.SimpleListProperty;
16
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.swt.widgets.Widget;
18
import org.eclipse.swt.widgets.Widget;
Lines 26-29 Link Here
26
			return SWTObservables.getRealm(((Widget) source).getDisplay());
27
			return SWTObservables.getRealm(((Widget) source).getDisplay());
27
		return super.getPreferredRealm(source);
28
		return super.getPreferredRealm(source);
28
	}
29
	}
30
31
	public IObservableList observe(Realm realm, Object source) {
32
		return new SWTObservableListDecorator(super.observe(realm, source), (Widget) source);
33
	}
29
}
34
}
(-)src/org/eclipse/jface/internal/databinding/swt/SWTVetoableValueDecorator.java (-2 / +9 lines)
Lines 37-46 Link Here
37
37
38
	private IObservableValue decorated;
38
	private IObservableValue decorated;
39
	private Widget widget;
39
	private Widget widget;
40
	private boolean updating;
40
41
41
	private IValueChangeListener valueListener = new IValueChangeListener() {
42
	private IValueChangeListener valueListener = new IValueChangeListener() {
42
		public void handleValueChange(ValueChangeEvent event) {
43
		public void handleValueChange(ValueChangeEvent event) {
43
			fireValueChange(event.diff);
44
			if (!updating)
45
				fireValueChange(event.diff);
44
		}
46
		}
45
	};
47
	};
46
48
Lines 102-108 Link Here
102
104
103
	protected void doSetApprovedValue(Object value) {
105
	protected void doSetApprovedValue(Object value) {
104
		checkRealm();
106
		checkRealm();
105
		decorated.setValue(value);
107
		updating = true;
108
		try {
109
			decorated.setValue(value);
110
		} finally {
111
			updating = false;
112
		}
106
	}
113
	}
107
114
108
	protected Object doGetValue() {
115
	protected Object doGetValue() {
(-)src/org/eclipse/jface/internal/databinding/swt/StyledTextTextProperty.java (+8 lines)
Lines 11-18 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.IObservableValue;
15
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
14
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.custom.StyledText;
17
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.widgets.Widget;
16
19
17
/**
20
/**
18
 * @since 3.3
21
 * @since 3.3
Lines 49-52 Link Here
49
	public String toString() {
52
	public String toString() {
50
		return "StyledText.text <String>"; //$NON-NLS-1$
53
		return "StyledText.text <String>"; //$NON-NLS-1$
51
	}
54
	}
55
56
	protected ISWTObservableValue wrapObservable(IObservableValue observable,
57
			Widget widget) {
58
		return new SWTVetoableValueDecorator(observable, widget);
59
	}
52
}
60
}
(-)src/org/eclipse/jface/internal/databinding/viewers/ViewerListProperty.java (+9 lines)
Lines 12-17 Link Here
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.Realm;
14
import org.eclipse.core.databinding.observable.Realm;
15
import org.eclipse.core.databinding.observable.list.IObservableList;
15
import org.eclipse.core.databinding.property.list.SimpleListProperty;
16
import org.eclipse.core.databinding.property.list.SimpleListProperty;
16
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.jface.viewers.Viewer;
Lines 28-31 Link Here
28
		}
29
		}
29
		return super.getPreferredRealm(source);
30
		return super.getPreferredRealm(source);
30
	}
31
	}
32
33
	public IObservableList observe(Realm realm, Object source) {
34
		IObservableList observable = super.observe(realm, source);
35
		if (source instanceof Viewer)
36
			observable = new ViewerObservableListDecorator(observable,
37
					(Viewer) source);
38
		return observable;
39
	}
31
}
40
}
(-)src/org/eclipse/jface/internal/databinding/viewers/ViewerSetProperty.java (+8 lines)
Lines 12-17 Link Here
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.Realm;
14
import org.eclipse.core.databinding.observable.Realm;
15
import org.eclipse.core.databinding.observable.set.IObservableSet;
15
import org.eclipse.core.databinding.property.set.SimpleSetProperty;
16
import org.eclipse.core.databinding.property.set.SimpleSetProperty;
16
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.jface.viewers.Viewer;
Lines 28-31 Link Here
28
		}
29
		}
29
		return super.getPreferredRealm(source);
30
		return super.getPreferredRealm(source);
30
	}
31
	}
32
33
	public IObservableSet observe(Realm realm, Object source) {
34
		IObservableSet observable = super.observe(realm, source);
35
		if (source instanceof Viewer)
36
			return new ViewerObservableSetDecorator(observable, (Viewer) source);
37
		return observable;
38
	}
31
}
39
}
(-)src/org/eclipse/jface/internal/databinding/viewers/ViewerValueProperty.java (+9 lines)
Lines 12-17 Link Here
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.Realm;
14
import org.eclipse.core.databinding.observable.Realm;
15
import org.eclipse.core.databinding.observable.value.IObservableValue;
15
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
16
import org.eclipse.core.databinding.property.value.SimpleValueProperty;
16
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.databinding.swt.SWTObservables;
17
import org.eclipse.jface.viewers.Viewer;
18
import org.eclipse.jface.viewers.Viewer;
Lines 28-31 Link Here
28
		}
29
		}
29
		return super.getPreferredRealm(source);
30
		return super.getPreferredRealm(source);
30
	}
31
	}
32
33
	public IObservableValue observe(Realm realm, Object source) {
34
		IObservableValue observable = super.observe(realm, source);
35
		if (source instanceof Viewer)
36
			observable = new ViewerObservableValueDecorator(observable,
37
					(Viewer) source);
38
		return observable;
39
	}
31
}
40
}
(-)src/org/eclipse/jface/databinding/swt/WidgetProperties.java (+448 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Matthew Hall and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Matthew Hall - initial API and implementation (bug 194734)
10
 ******************************************************************************/
11
12
package org.eclipse.jface.databinding.swt;
13
14
import org.eclipse.core.databinding.property.list.DelegatingListProperty;
15
import org.eclipse.core.databinding.property.list.IListProperty;
16
import org.eclipse.core.databinding.property.value.DelegatingValueProperty;
17
import org.eclipse.core.databinding.property.value.IValueProperty;
18
import org.eclipse.jface.internal.databinding.swt.ButtonSelectionProperty;
19
import org.eclipse.jface.internal.databinding.swt.CComboItemsProperty;
20
import org.eclipse.jface.internal.databinding.swt.CComboSelectionProperty;
21
import org.eclipse.jface.internal.databinding.swt.CComboSingleSelectionIndexProperty;
22
import org.eclipse.jface.internal.databinding.swt.CComboTextProperty;
23
import org.eclipse.jface.internal.databinding.swt.CLabelTextProperty;
24
import org.eclipse.jface.internal.databinding.swt.CTabItemTooltipTextProperty;
25
import org.eclipse.jface.internal.databinding.swt.ComboItemsProperty;
26
import org.eclipse.jface.internal.databinding.swt.ComboSelectionProperty;
27
import org.eclipse.jface.internal.databinding.swt.ComboSingleSelectionIndexProperty;
28
import org.eclipse.jface.internal.databinding.swt.ComboTextProperty;
29
import org.eclipse.jface.internal.databinding.swt.ControlBackgroundProperty;
30
import org.eclipse.jface.internal.databinding.swt.ControlBoundsProperty;
31
import org.eclipse.jface.internal.databinding.swt.ControlEnabledProperty;
32
import org.eclipse.jface.internal.databinding.swt.ControlFocusedProperty;
33
import org.eclipse.jface.internal.databinding.swt.ControlFontProperty;
34
import org.eclipse.jface.internal.databinding.swt.ControlForegroundProperty;
35
import org.eclipse.jface.internal.databinding.swt.ControlLocationProperty;
36
import org.eclipse.jface.internal.databinding.swt.ControlSizeProperty;
37
import org.eclipse.jface.internal.databinding.swt.ControlTooltipTextProperty;
38
import org.eclipse.jface.internal.databinding.swt.ControlVisibleProperty;
39
import org.eclipse.jface.internal.databinding.swt.ItemTextProperty;
40
import org.eclipse.jface.internal.databinding.swt.LabelTextProperty;
41
import org.eclipse.jface.internal.databinding.swt.LinkTextProperty;
42
import org.eclipse.jface.internal.databinding.swt.ListItemsProperty;
43
import org.eclipse.jface.internal.databinding.swt.ListSelectionProperty;
44
import org.eclipse.jface.internal.databinding.swt.ListSingleSelectionIndexProperty;
45
import org.eclipse.jface.internal.databinding.swt.ScaleMaximumProperty;
46
import org.eclipse.jface.internal.databinding.swt.ScaleMinimumProperty;
47
import org.eclipse.jface.internal.databinding.swt.ScaleSelectionProperty;
48
import org.eclipse.jface.internal.databinding.swt.ShellTextProperty;
49
import org.eclipse.jface.internal.databinding.swt.SpinnerMaximumProperty;
50
import org.eclipse.jface.internal.databinding.swt.SpinnerMinimumProperty;
51
import org.eclipse.jface.internal.databinding.swt.SpinnerSelectionProperty;
52
import org.eclipse.jface.internal.databinding.swt.StyledTextTextProperty;
53
import org.eclipse.jface.internal.databinding.swt.TabItemTooltipTextProperty;
54
import org.eclipse.jface.internal.databinding.swt.TableColumnTooltipTextProperty;
55
import org.eclipse.jface.internal.databinding.swt.TableSingleSelectionIndexProperty;
56
import org.eclipse.jface.internal.databinding.swt.TextEditableProperty;
57
import org.eclipse.jface.internal.databinding.swt.TextTextProperty;
58
import org.eclipse.jface.internal.databinding.swt.ToolItemTooltipTextProperty;
59
import org.eclipse.jface.internal.databinding.swt.TrayItemTooltipTextProperty;
60
import org.eclipse.jface.internal.databinding.swt.TreeItemTooltipTextProperty;
61
import org.eclipse.swt.SWT;
62
import org.eclipse.swt.custom.CCombo;
63
import org.eclipse.swt.custom.CLabel;
64
import org.eclipse.swt.custom.CTabItem;
65
import org.eclipse.swt.custom.StyledText;
66
import org.eclipse.swt.widgets.Button;
67
import org.eclipse.swt.widgets.Combo;
68
import org.eclipse.swt.widgets.Control;
69
import org.eclipse.swt.widgets.Item;
70
import org.eclipse.swt.widgets.Label;
71
import org.eclipse.swt.widgets.Link;
72
import org.eclipse.swt.widgets.List;
73
import org.eclipse.swt.widgets.Scale;
74
import org.eclipse.swt.widgets.Shell;
75
import org.eclipse.swt.widgets.Spinner;
76
import org.eclipse.swt.widgets.TabItem;
77
import org.eclipse.swt.widgets.Table;
78
import org.eclipse.swt.widgets.TableColumn;
79
import org.eclipse.swt.widgets.Text;
80
import org.eclipse.swt.widgets.ToolItem;
81
import org.eclipse.swt.widgets.TrayItem;
82
import org.eclipse.swt.widgets.TreeColumn;
83
import org.eclipse.swt.widgets.TreeItem;
84
import org.eclipse.swt.widgets.Widget;
85
86
/**
87
 * A factory for creating properties of SWT {@link Widget widgets}.
88
 * 
89
 * @since 1.3
90
 */
91
public class WidgetProperties {
92
	private static RuntimeException notSupported(Object source) {
93
		return new IllegalArgumentException(
94
				"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
95
	}
96
97
	/**
98
	 * Returns a value property for observing the background color of a
99
	 * {@link Control}.
100
	 * 
101
	 * @return a value property for observing the background color of a
102
	 *         {@link Control}.
103
	 */
104
	public static IValueProperty background() {
105
		return new ControlBackgroundProperty();
106
	}
107
108
	/**
109
	 * Returns a value property for observing the bounds of a {@link Control}.
110
	 * 
111
	 * @return a value property for observing the bounds of a {@link Control}.
112
	 */
113
	public static IValueProperty bounds() {
114
		return new ControlBoundsProperty();
115
	}
116
117
	/**
118
	 * Returns a value property for observing the editable state of a
119
	 * {@link Text}.
120
	 * 
121
	 * @return a value property for observing the editable state of a
122
	 *         {@link Text}.
123
	 */
124
	public static IValueProperty editable() {
125
		return new DelegatingValueProperty(Boolean.TYPE) {
126
			IValueProperty text = new TextEditableProperty();
127
128
			protected IValueProperty doGetDelegate(Object source) {
129
				if (source instanceof Text)
130
					return text;
131
				throw notSupported(source);
132
			}
133
		};
134
	}
135
136
	/**
137
	 * Returns a value property for observing the enablement state of a
138
	 * {@link Control}.
139
	 * 
140
	 * @return a value property for observing the enablement state of a
141
	 *         {@link Control}.
142
	 */
143
	public static IValueProperty enabled() {
144
		return new ControlEnabledProperty();
145
	}
146
147
	/**
148
	 * Returns a value property for observing the focus state of a
149
	 * {@link Control}.
150
	 * 
151
	 * @return a value property for observing the focus state of a
152
	 *         {@link Control}.
153
	 */
154
	public static IValueProperty focused() {
155
		return new ControlFocusedProperty();
156
	}
157
158
	/**
159
	 * Returns a value property for observing the font of a {@link Control}.
160
	 * 
161
	 * @return a value property for observing the font of a {@link Control}.
162
	 */
163
	public static IValueProperty font() {
164
		return new ControlFontProperty();
165
	}
166
167
	/**
168
	 * Returns a value property for observing the foreground color of a
169
	 * {@link Control}.
170
	 * 
171
	 * @return a value property for observing the foreground color of a
172
	 *         {@link Control}.
173
	 */
174
	public static IValueProperty foreground() {
175
		return new ControlForegroundProperty();
176
	}
177
178
	/**
179
	 * Returns a list property for observing the items of a {@link CCombo},
180
	 * {@link Combo} or {@link List}.
181
	 * 
182
	 * @return a list property for observing the items of a {@link CCombo},
183
	 *         {@link Combo} or {@link List}.
184
	 */
185
	public static IListProperty items() {
186
		return new DelegatingListProperty(String.class) {
187
			private IListProperty cCombo = new CComboItemsProperty();
188
			private IListProperty combo = new ComboItemsProperty();
189
			private IListProperty list = new ListItemsProperty();
190
191
			protected IListProperty doGetDelegate(Object source) {
192
				if (source instanceof CCombo)
193
					return cCombo;
194
				if (source instanceof Combo)
195
					return combo;
196
				if (source instanceof List)
197
					return list;
198
				throw notSupported(source);
199
			}
200
		};
201
	}
202
203
	/**
204
	 * Returns a value property for observing the location of a {@link Control}.
205
	 * 
206
	 * @return a value property for observing the location of a {@link Control}.
207
	 */
208
	public static IValueProperty location() {
209
		return new ControlLocationProperty();
210
	}
211
212
	/**
213
	 * Returns a value property for observing the maximum value of a
214
	 * {@link Scale} or {@link Spinner}.
215
	 * 
216
	 * @return a value property for observing the maximum value of a
217
	 *         {@link Scale} or {@link Spinner}.
218
	 */
219
	public static IValueProperty maximum() {
220
		return new DelegatingValueProperty(Integer.TYPE) {
221
			private IValueProperty scale = new ScaleMaximumProperty();
222
			private IValueProperty spinner = new SpinnerMaximumProperty();
223
224
			protected IValueProperty doGetDelegate(Object source) {
225
				if (source instanceof Scale)
226
					return scale;
227
				if (source instanceof Spinner)
228
					return spinner;
229
				throw notSupported(source);
230
			}
231
		};
232
	}
233
234
	/**
235
	 * Returns a value property for observing the minimum value of a
236
	 * {@link Scale} or {@link Spinner}.
237
	 * 
238
	 * @return a value property for observing the minimum value of a
239
	 *         {@link Scale} or {@link Spinner}.
240
	 */
241
	public static IValueProperty minimum() {
242
		return new DelegatingValueProperty(Integer.TYPE) {
243
			private IValueProperty scale = new ScaleMinimumProperty();
244
			private IValueProperty spinner = new SpinnerMinimumProperty();
245
246
			protected IValueProperty doGetDelegate(Object source) {
247
				if (source instanceof Scale)
248
					return scale;
249
				if (source instanceof Spinner)
250
					return spinner;
251
				throw notSupported(source);
252
			}
253
		};
254
	}
255
256
	/**
257
	 * Returns a value property for observing the selection state of a
258
	 * {@link Button}, {@link CCombo}, {@link Combo}, {@link List},
259
	 * {@link Scale} or {@link Spinner}.
260
	 * 
261
	 * @return a value property for observing the selection state of a
262
	 *         {@link Button}, {@link CCombo}, {@link Combo}, {@link List},
263
	 *         {@link Scale} or {@link Spinner}.
264
	 */
265
	public static IValueProperty selection() {
266
		return new DelegatingValueProperty() {
267
			private IValueProperty button = new ButtonSelectionProperty();
268
			private IValueProperty cCombo = new CComboSelectionProperty();
269
			private IValueProperty combo = new ComboSelectionProperty();
270
			private IValueProperty list = new ListSelectionProperty();
271
			private IValueProperty scale = new ScaleSelectionProperty();
272
			private IValueProperty spinner = new SpinnerSelectionProperty();
273
274
			protected IValueProperty doGetDelegate(Object source) {
275
				if (source instanceof Button)
276
					return button;
277
				if (source instanceof CCombo)
278
					return cCombo;
279
				if (source instanceof Combo)
280
					return combo;
281
				if (source instanceof List)
282
					return list;
283
				if (source instanceof Scale)
284
					return scale;
285
				if (source instanceof Spinner)
286
					return spinner;
287
				throw notSupported(source);
288
			}
289
		};
290
	}
291
292
	/**
293
	 * Returns a value property for observing the single selection index of a
294
	 * {@link CCombo}, {@link Combo}, {@link List} or {@link Table}.
295
	 * 
296
	 * @return a value property for the single selection index of a SWT Combo.
297
	 */
298
	public static IValueProperty singleSelectionIndex() {
299
		return new DelegatingValueProperty(Integer.TYPE) {
300
			private IValueProperty cCombo = new CComboSingleSelectionIndexProperty();
301
			private IValueProperty combo = new ComboSingleSelectionIndexProperty();
302
			private IValueProperty list = new ListSingleSelectionIndexProperty();
303
			private IValueProperty table = new TableSingleSelectionIndexProperty();
304
305
			protected IValueProperty doGetDelegate(Object source) {
306
				if (source instanceof CCombo)
307
					return cCombo;
308
				if (source instanceof Combo)
309
					return combo;
310
				if (source instanceof List)
311
					return list;
312
				if (source instanceof Table)
313
					return table;
314
				throw notSupported(source);
315
			}
316
		};
317
	}
318
319
	/**
320
	 * Returns a value property for observing the size of a {@link Control}.
321
	 * 
322
	 * @return a value property for observing the size of a {@link Control}.
323
	 */
324
	public static IValueProperty size() {
325
		return new ControlSizeProperty();
326
	}
327
328
	/**
329
	 * Returns a value property for observing the text of a {@link CCombo},
330
	 * {@link CLabel}, {@link Combo}, {@link Label}, {@link Item}, {@link Link},
331
	 * {@link Shell} or {@link Text}.
332
	 * 
333
	 * @return a value property for observing the text of a {@link CCombo},
334
	 *         {@link CLabel}, {@link Combo}, {@link Label}, {@link Item},
335
	 *         {@link Link}, {@link Shell} or {@link Text}.
336
	 */
337
	public static IValueProperty text() {
338
		return new DelegatingValueProperty(String.class) {
339
			private IValueProperty cCombo = new CComboTextProperty();
340
			private IValueProperty cLabel = new CLabelTextProperty();
341
			private IValueProperty combo = new ComboTextProperty();
342
			private IValueProperty item = new ItemTextProperty();
343
			private IValueProperty label = new LabelTextProperty();
344
			private IValueProperty link = new LinkTextProperty();
345
			private IValueProperty shell = new ShellTextProperty();
346
			private IValueProperty text = new TextTextProperty(SWT.None);
347
348
			protected IValueProperty doGetDelegate(Object source) {
349
				if (source instanceof CCombo)
350
					return cCombo;
351
				if (source instanceof CLabel)
352
					return cLabel;
353
				if (source instanceof Combo)
354
					return combo;
355
				if (source instanceof Item)
356
					return item;
357
				if (source instanceof Label)
358
					return label;
359
				if (source instanceof Link)
360
					return link;
361
				if (source instanceof Shell)
362
					return shell;
363
				if (source instanceof Text)
364
					return text;
365
				throw notSupported(source);
366
			}
367
		};
368
	}
369
370
	/**
371
	 * Returns a value property for observing the text of a {@link StyledText}
372
	 * or {@link Text}.
373
	 * 
374
	 * @param event
375
	 *            the SWT event type to register for change events. May be
376
	 *            {@link SWT#None}, {@link SWT#Modify} or {@link SWT#FocusOut}.
377
	 * 
378
	 * @return a value property for observing the text of a {@link StyledText}
379
	 *         or {@link Text}.
380
	 */
381
	public static IValueProperty text(final int event) {
382
		return new DelegatingValueProperty(String.class) {
383
			private IValueProperty styledText = new StyledTextTextProperty(
384
					event);
385
			private IValueProperty text = new TextTextProperty(event);
386
387
			protected IValueProperty doGetDelegate(Object source) {
388
				if (source instanceof StyledText)
389
					return styledText;
390
				if (source instanceof Text)
391
					return text;
392
				throw notSupported(source);
393
			}
394
		};
395
	}
396
397
	/**
398
	 * Returns a value property for observing the tooltip text of a
399
	 * {@link CTabItem}, {@link Control}, {@link TabItem}, {@link TableColumn},
400
	 * {@link ToolItem}, {@link TrayItem}, {@link TreeColumn} or
401
	 * {@link TreeItem}.
402
	 * 
403
	 * @return a value property for observing the tooltip text of a
404
	 *         {@link CTabItem}, {@link Control}, {@link TabItem},
405
	 *         {@link TableColumn}, {@link ToolItem}, {@link TrayItem},
406
	 *         {@link TreeColumn} or {@link TreeItem}.
407
	 */
408
	public static IValueProperty tooltipText() {
409
		return new DelegatingValueProperty(String.class) {
410
			private IValueProperty cTabItem = new CTabItemTooltipTextProperty();
411
			private IValueProperty control = new ControlTooltipTextProperty();
412
			private IValueProperty tabItem = new TabItemTooltipTextProperty();
413
			private IValueProperty tableColumn = new TableColumnTooltipTextProperty();
414
			private IValueProperty toolItem = new ToolItemTooltipTextProperty();
415
			private IValueProperty trayItem = new TrayItemTooltipTextProperty();
416
			private IValueProperty treeItem = new TreeItemTooltipTextProperty();
417
418
			protected IValueProperty doGetDelegate(Object source) {
419
				if (source instanceof CTabItem)
420
					return cTabItem;
421
				if (source instanceof Control)
422
					return control;
423
				if (source instanceof TabItem)
424
					return tabItem;
425
				if (source instanceof TableColumn)
426
					return tableColumn;
427
				if (source instanceof ToolItem)
428
					return toolItem;
429
				if (source instanceof TrayItem)
430
					return trayItem;
431
				if (source instanceof TreeItem)
432
					return treeItem;
433
				throw notSupported(source);
434
			}
435
		};
436
	}
437
438
	/**
439
	 * Returns a value property for observing the visibility state of a
440
	 * {@link Control}.
441
	 * 
442
	 * @return a value property for observing the visibility state of a
443
	 *         {@link Control}.
444
	 */
445
	public static IValueProperty visible() {
446
		return new ControlVisibleProperty();
447
	}
448
}
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ScaleObservableValueMaxTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.ScaleProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Scale;
28
import org.eclipse.swt.widgets.Scale;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return ScaleProperties.maximum().observe(realm, scale);
100
			return WidgetProperties.maximum().observe(realm, scale);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ScaleObservableValueMinTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.ScaleProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Scale;
28
import org.eclipse.swt.widgets.Scale;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return ScaleProperties.minimum().observe(realm, scale);
100
			return WidgetProperties.minimum().observe(realm, scale);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/TableSingleSelectionObservableValueTest.java (-2 / +3 lines)
Lines 23-29 Link Here
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
26
import org.eclipse.jface.databinding.swt.TableProperties;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
27
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Display;
29
import org.eclipse.swt.widgets.Shell;
29
import org.eclipse.swt.widgets.Shell;
Lines 109-115 Link Here
109
		}
109
		}
110
110
111
		public IObservableValue createObservableValue(Realm realm) {
111
		public IObservableValue createObservableValue(Realm realm) {
112
			return TableProperties.singleSelectionIndex().observe(realm, table);
112
			return WidgetProperties.singleSelectionIndex()
113
					.observe(realm, table);
113
		}
114
		}
114
115
115
		public Object getValueType(IObservableValue observable) {
116
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ShellObservableValueTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
22
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
23
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.ShellProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase;
26
import org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase;
27
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Shell;
28
28
Lines 112-118 Link Here
112
		}
112
		}
113
113
114
		public IObservableValue createObservableValue(Realm realm) {
114
		public IObservableValue createObservableValue(Realm realm) {
115
			return ShellProperties.text().observe(realm, shell);
115
			return WidgetProperties.text().observe(realm, shell);
116
		}
116
		}
117
117
118
		public Object getValueType(IObservableValue observable) {
118
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/CLabelObservableValueTest.java (-2 / +2 lines)
Lines 21-28 Link Here
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.CLabelProperties;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.custom.CLabel;
27
import org.eclipse.swt.custom.CLabel;
28
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Display;
Lines 90-96 Link Here
90
		}
90
		}
91
91
92
		public IObservableValue createObservableValue(Realm realm) {
92
		public IObservableValue createObservableValue(Realm realm) {
93
			return CLabelProperties.text().observe(realm, label);
93
			return WidgetProperties.text().observe(realm, label);
94
		}
94
		}
95
95
96
		public void change(IObservable observable) {
96
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ScaleObservableValueSelectionTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.ScaleProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Scale;
28
import org.eclipse.swt.widgets.Scale;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return ScaleProperties.selection().observe(realm, scale);
100
			return WidgetProperties.selection().observe(realm, scale);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/StyledTextObservableValueModifyTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.core.databinding.observable.value.IObservableValue;
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
25
import org.eclipse.jface.databinding.swt.StyledTextProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.custom.StyledText;
27
import org.eclipse.swt.custom.StyledText;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
Lines 55-61 Link Here
55
		}
55
		}
56
56
57
		public IObservableValue createObservableValue(Realm realm) {
57
		public IObservableValue createObservableValue(Realm realm) {
58
			return StyledTextProperties.text(SWT.Modify).observe(realm, text);
58
			return WidgetProperties.text(SWT.Modify).observe(realm, text);
59
		}
59
		}
60
60
61
		public Object getValueType(IObservableValue observable) {
61
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/CComboObservableValueTextTest.java (-4 / +2 lines)
Lines 22-30 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
25
import org.eclipse.jface.databinding.swt.CComboProperties;
26
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
28
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.custom.CCombo;
28
import org.eclipse.swt.custom.CCombo;
30
import org.eclipse.swt.widgets.Display;
29
import org.eclipse.swt.widgets.Display;
Lines 89-96 Link Here
89
		}
88
		}
90
89
91
		public IObservableValue createObservableValue(Realm realm) {
90
		public IObservableValue createObservableValue(Realm realm) {
92
			return new SWTObservableValueDecorator(CComboProperties.text()
91
			return WidgetProperties.text().observe(realm, combo);
93
					.observe(realm, combo), combo);
94
		}
92
		}
95
93
96
		public void change(IObservable observable) {
94
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/TextObservableValueFocusOutTest.java (-2 / +2 lines)
Lines 21-27 Link Here
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.TextProperties;
24
import org.eclipse.jface.databinding.swt.WidgetProperties;
25
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Text;
27
import org.eclipse.swt.widgets.Text;
Lines 54-60 Link Here
54
		}
54
		}
55
55
56
		public IObservableValue createObservableValue(Realm realm) {
56
		public IObservableValue createObservableValue(Realm realm) {
57
			return TextProperties.text(SWT.FocusOut).observe(realm, text);
57
			return WidgetProperties.text(SWT.FocusOut).observe(realm, text);
58
		}
58
		}
59
59
60
		public Object getValueType(IObservableValue observable) {
60
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ComboObservableValueTextTest.java (-4 / +2 lines)
Lines 22-30 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
25
import org.eclipse.jface.databinding.swt.ComboProperties;
26
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
28
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.widgets.Combo;
28
import org.eclipse.swt.widgets.Combo;
30
import org.eclipse.swt.widgets.Display;
29
import org.eclipse.swt.widgets.Display;
Lines 90-97 Link Here
90
		}
89
		}
91
90
92
		public IObservableValue createObservableValue(Realm realm) {
91
		public IObservableValue createObservableValue(Realm realm) {
93
			return new SWTObservableValueDecorator(ComboProperties.text()
92
			return WidgetProperties.text().observe(realm, combo);
94
					.observe(realm, combo), combo);
95
		}
93
		}
96
94
97
		public void change(IObservable observable) {
95
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/SpinnerObservableValueSelectionTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SpinnerProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return SpinnerProperties.selection().observe(realm, spinner);
100
			return WidgetProperties.selection().observe(realm, spinner);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/TextEditableObservableValueTest.java (-2 / +2 lines)
Lines 21-27 Link Here
21
import org.eclipse.jface.databinding.conformance.ObservableDelegateTest;
21
import org.eclipse.jface.databinding.conformance.ObservableDelegateTest;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.TextProperties;
24
import org.eclipse.jface.databinding.swt.WidgetProperties;
25
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Text;
27
import org.eclipse.swt.widgets.Text;
Lines 102-108 Link Here
102
		}
102
		}
103
103
104
		public IObservableValue createObservableValue(Realm realm) {
104
		public IObservableValue createObservableValue(Realm realm) {
105
			return TextProperties.editable().observe(realm, text);
105
			return WidgetProperties.editable().observe(realm, text);
106
		}
106
		}
107
107
108
		public Object getValueType(IObservableValue observable) {
108
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ComboObservableValueTest.java (-3 / +3 lines)
Lines 17-24 Link Here
17
import org.eclipse.core.databinding.observable.value.IObservableValue;
17
import org.eclipse.core.databinding.observable.value.IObservableValue;
18
import org.eclipse.core.databinding.property.value.IValueProperty;
18
import org.eclipse.core.databinding.property.value.IValueProperty;
19
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
19
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
20
import org.eclipse.jface.databinding.swt.ComboProperties;
21
import org.eclipse.jface.databinding.swt.SWTObservables;
20
import org.eclipse.jface.databinding.swt.SWTObservables;
21
import org.eclipse.jface.databinding.swt.WidgetProperties;
22
import org.eclipse.jface.internal.databinding.swt.ComboSelectionProperty;
22
import org.eclipse.jface.internal.databinding.swt.ComboSelectionProperty;
23
import org.eclipse.jface.internal.databinding.swt.ComboTextProperty;
23
import org.eclipse.jface.internal.databinding.swt.ComboTextProperty;
24
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
24
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
Lines 56-63 Link Here
56
	}
56
	}
57
57
58
	public void testSetValueWithNull() {
58
	public void testSetValueWithNull() {
59
		testSetValueWithNull(ComboProperties.text());
59
		testSetValueWithNull(WidgetProperties.text());
60
		testSetValueWithNull(ComboProperties.selection());
60
		testSetValueWithNull(WidgetProperties.selection());
61
	}
61
	}
62
62
63
	protected void testSetValueWithNull(IValueProperty property) {
63
	protected void testSetValueWithNull(IValueProperty property) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/LabelObservableValueTest.java (-2 / +2 lines)
Lines 21-28 Link Here
21
import org.eclipse.jface.databinding.conformance.ObservableDelegateTest;
21
import org.eclipse.jface.databinding.conformance.ObservableDelegateTest;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.LabelProperties;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Label;
Lines 93-99 Link Here
93
		}
93
		}
94
94
95
		public IObservableValue createObservableValue(Realm realm) {
95
		public IObservableValue createObservableValue(Realm realm) {
96
			return LabelProperties.text().observe(realm, label);
96
			return WidgetProperties.text().observe(realm, label);
97
		}
97
		}
98
98
99
		public void change(IObservable observable) {
99
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/TextObservableValueTest.java (-7 / +7 lines)
Lines 17-23 Link Here
17
import org.eclipse.core.databinding.observable.Realm;
17
import org.eclipse.core.databinding.observable.Realm;
18
import org.eclipse.core.databinding.observable.value.IObservableValue;
18
import org.eclipse.core.databinding.observable.value.IObservableValue;
19
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
19
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
20
import org.eclipse.jface.databinding.swt.TextProperties;
20
import org.eclipse.jface.databinding.swt.WidgetProperties;
21
import org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase;
21
import org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase;
22
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.widgets.Shell;
23
import org.eclipse.swt.widgets.Shell;
Lines 47-62 Link Here
47
	 */
47
	 */
48
	public void testConstructorUpdateEventTypes() {
48
	public void testConstructorUpdateEventTypes() {
49
		try {
49
		try {
50
			TextProperties.text(SWT.None);
50
			WidgetProperties.text(SWT.None);
51
			TextProperties.text(SWT.FocusOut);
51
			WidgetProperties.text(SWT.FocusOut);
52
			TextProperties.text(SWT.Modify);
52
			WidgetProperties.text(SWT.Modify);
53
			assertTrue(true);
53
			assertTrue(true);
54
		} catch (IllegalArgumentException e) {
54
		} catch (IllegalArgumentException e) {
55
			fail();
55
			fail();
56
		}
56
		}
57
57
58
		try {
58
		try {
59
			TextProperties.text(SWT.Verify);
59
			WidgetProperties.text(SWT.Verify);
60
			fail();
60
			fail();
61
		} catch (IllegalArgumentException e) {
61
		} catch (IllegalArgumentException e) {
62
			assertTrue(true);
62
			assertTrue(true);
Lines 69-75 Link Here
69
	 * @throws Exception
69
	 * @throws Exception
70
	 */
70
	 */
71
	public void testGetValueBeforeFocusOutChangeEventsFire() throws Exception {
71
	public void testGetValueBeforeFocusOutChangeEventsFire() throws Exception {
72
		IObservableValue observableValue = TextProperties.text(SWT.FocusOut)
72
		IObservableValue observableValue = WidgetProperties.text(SWT.FocusOut)
73
				.observe(Realm.getDefault(), text);
73
				.observe(Realm.getDefault(), text);
74
		observableValue.addValueChangeListener(listener);
74
		observableValue.addValueChangeListener(listener);
75
75
Lines 96-102 Link Here
96
	}
96
	}
97
97
98
	public void testDispose() throws Exception {
98
	public void testDispose() throws Exception {
99
		IObservableValue observableValue = TextProperties.text(SWT.Modify)
99
		IObservableValue observableValue = WidgetProperties.text(SWT.Modify)
100
				.observe(Realm.getDefault(), text);
100
				.observe(Realm.getDefault(), text);
101
		ValueChangeEventTracker testCounterValueChangeListener = new ValueChangeEventTracker();
101
		ValueChangeEventTracker testCounterValueChangeListener = new ValueChangeEventTracker();
102
		observableValue.addValueChangeListener(testCounterValueChangeListener);
102
		observableValue.addValueChangeListener(testCounterValueChangeListener);
(-)src/org/eclipse/jface/tests/internal/databinding/swt/StyledTextObservableValueFocusOutTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.core.databinding.observable.value.IObservableValue;
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
25
import org.eclipse.jface.databinding.swt.StyledTextProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.custom.StyledText;
27
import org.eclipse.swt.custom.StyledText;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
Lines 55-61 Link Here
55
		}
55
		}
56
56
57
		public IObservableValue createObservableValue(Realm realm) {
57
		public IObservableValue createObservableValue(Realm realm) {
58
			return StyledTextProperties.text(SWT.FocusOut).observe(realm, text);
58
			return WidgetProperties.text(SWT.FocusOut).observe(realm, text);
59
		}
59
		}
60
60
61
		public Object getValueType(IObservableValue observable) {
61
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/CComboObservableValueSelectionTest.java (-4 / +2 lines)
Lines 22-31 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
25
import org.eclipse.jface.databinding.swt.CComboProperties;
26
import org.eclipse.jface.databinding.swt.ISWTObservable;
25
import org.eclipse.jface.databinding.swt.ISWTObservable;
27
import org.eclipse.jface.databinding.swt.SWTObservables;
26
import org.eclipse.jface.databinding.swt.SWTObservables;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
27
import org.eclipse.jface.databinding.swt.WidgetProperties;
29
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.custom.CCombo;
29
import org.eclipse.swt.custom.CCombo;
31
import org.eclipse.swt.widgets.Display;
30
import org.eclipse.swt.widgets.Display;
Lines 91-98 Link Here
91
		}
90
		}
92
91
93
		public IObservableValue createObservableValue(Realm realm) {
92
		public IObservableValue createObservableValue(Realm realm) {
94
			return new SWTObservableValueDecorator(CComboProperties.selection()
93
			return WidgetProperties.selection().observe(realm, combo);
95
					.observe(realm, combo), combo);
96
		}
94
		}
97
95
98
		public void change(IObservable observable) {
96
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/CComboSingleSelectionObservableValueTest.java (-2 / +2 lines)
Lines 21-28 Link Here
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.CComboProperties;
25
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
26
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
27
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.custom.CCombo;
28
import org.eclipse.swt.custom.CCombo;
Lines 78-84 Link Here
78
		}
78
		}
79
79
80
		public IObservableValue createObservableValue(Realm realm) {
80
		public IObservableValue createObservableValue(Realm realm) {
81
			return CComboProperties.singleSelectionIndex()
81
			return WidgetProperties.singleSelectionIndex()
82
					.observe(realm, combo);
82
					.observe(realm, combo);
83
		}
83
		}
84
84
(-)src/org/eclipse/jface/tests/internal/databinding/swt/SpinnerObservableValueMinTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SpinnerProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return SpinnerProperties.minimum().observe(realm, spinner);
100
			return WidgetProperties.minimum().observe(realm, spinner);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/CComboObservableValueTest.java (-3 / +3 lines)
Lines 18-26 Link Here
18
import org.eclipse.core.databinding.observable.value.IObservableValue;
18
import org.eclipse.core.databinding.observable.value.IObservableValue;
19
import org.eclipse.core.databinding.property.value.IValueProperty;
19
import org.eclipse.core.databinding.property.value.IValueProperty;
20
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
20
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
21
import org.eclipse.jface.databinding.swt.CComboProperties;
22
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
21
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
23
import org.eclipse.jface.databinding.swt.SWTObservables;
22
import org.eclipse.jface.databinding.swt.SWTObservables;
23
import org.eclipse.jface.databinding.swt.WidgetProperties;
24
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
24
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
25
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.custom.CCombo;
26
import org.eclipse.swt.custom.CCombo;
Lines 56-63 Link Here
56
	}
56
	}
57
57
58
	public void testSetValueWithNull() {
58
	public void testSetValueWithNull() {
59
		testSetValueWithNull(CComboProperties.text());
59
		testSetValueWithNull(WidgetProperties.text());
60
		testSetValueWithNull(CComboProperties.selection());
60
		testSetValueWithNull(WidgetProperties.selection());
61
	}
61
	}
62
62
63
	protected void testSetValueWithNull(IValueProperty property) {
63
	protected void testSetValueWithNull(IValueProperty property) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/TextObservableValueModifyTest.java (-2 / +2 lines)
Lines 21-27 Link Here
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
21
import org.eclipse.core.databinding.observable.value.IObservableValue;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.TextProperties;
24
import org.eclipse.jface.databinding.swt.WidgetProperties;
25
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Shell;
27
import org.eclipse.swt.widgets.Text;
27
import org.eclipse.swt.widgets.Text;
Lines 54-60 Link Here
54
		}
54
		}
55
55
56
		public IObservableValue createObservableValue(Realm realm) {
56
		public IObservableValue createObservableValue(Realm realm) {
57
			return TextProperties.text(SWT.Modify).observe(realm, text);
57
			return WidgetProperties.text(SWT.Modify).observe(realm, text);
58
		}
58
		}
59
59
60
		public Object getValueType(IObservableValue observable) {
60
		public Object getValueType(IObservableValue observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ComboObservableValueSelectionTest.java (-4 / +2 lines)
Lines 22-31 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
25
import org.eclipse.jface.databinding.swt.ComboProperties;
26
import org.eclipse.jface.databinding.swt.ISWTObservable;
25
import org.eclipse.jface.databinding.swt.ISWTObservable;
27
import org.eclipse.jface.databinding.swt.SWTObservables;
26
import org.eclipse.jface.databinding.swt.SWTObservables;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
27
import org.eclipse.jface.databinding.swt.WidgetProperties;
29
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.widgets.Combo;
29
import org.eclipse.swt.widgets.Combo;
31
import org.eclipse.swt.widgets.Display;
30
import org.eclipse.swt.widgets.Display;
Lines 93-100 Link Here
93
		}
92
		}
94
93
95
		public IObservableValue createObservableValue(Realm realm) {
94
		public IObservableValue createObservableValue(Realm realm) {
96
			return new SWTObservableValueDecorator(ComboProperties.selection()
95
			return WidgetProperties.selection().observe(realm, combo);
97
					.observe(realm, combo), combo);
98
		}
96
		}
99
97
100
		public void change(IObservable observable) {
98
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/SpinnerObservableValueMaxTest.java (-2 / +2 lines)
Lines 22-28 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
24
import org.eclipse.jface.databinding.swt.SWTObservables;
25
import org.eclipse.jface.databinding.swt.SpinnerProperties;
25
import org.eclipse.jface.databinding.swt.WidgetProperties;
26
import org.eclipse.swt.SWT;
26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.widgets.Display;
27
import org.eclipse.swt.widgets.Display;
28
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Shell;
Lines 97-103 Link Here
97
		}
97
		}
98
98
99
		public IObservableValue createObservableValue(Realm realm) {
99
		public IObservableValue createObservableValue(Realm realm) {
100
			return SpinnerProperties.maximum().observe(realm, spinner);
100
			return WidgetProperties.maximum().observe(realm, spinner);
101
		}
101
		}
102
102
103
		public void change(IObservable observable) {
103
		public void change(IObservable observable) {
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ButtonObservableValueTest.java (-2 / +2 lines)
Lines 22-30 Link Here
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
22
import org.eclipse.jface.databinding.conformance.delegate.AbstractObservableValueContractDelegate;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
23
import org.eclipse.jface.databinding.conformance.swt.SWTMutableObservableValueContractTest;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
24
import org.eclipse.jface.databinding.conformance.util.ValueChangeEventTracker;
25
import org.eclipse.jface.databinding.swt.ButtonProperties;
26
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
25
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
27
import org.eclipse.jface.databinding.swt.SWTObservables;
26
import org.eclipse.jface.databinding.swt.SWTObservables;
27
import org.eclipse.jface.databinding.swt.WidgetProperties;
28
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
28
import org.eclipse.jface.tests.databinding.AbstractSWTTestCase;
29
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.widgets.Button;
30
import org.eclipse.swt.widgets.Button;
Lines 132-138 Link Here
132
		}
132
		}
133
133
134
		public IObservableValue createObservableValue(Realm realm) {
134
		public IObservableValue createObservableValue(Realm realm) {
135
			return ButtonProperties.selection().observe(realm, button);
135
			return WidgetProperties.selection().observe(realm, button);
136
		}
136
		}
137
137
138
		public Object getValueType(IObservableValue observable) {
138
		public Object getValueType(IObservableValue observable) {

Return to bug 194734