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 (-6 / +6 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-264 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()
262
					.observe(mothercomboViewer), BeanProperties.value(
262
					.observe(mothercomboViewer), BeanProperties.value(
263
					Person.class, "mother").observeDetail(masterSelection),
263
					Person.class, "mother").observeDetail(masterSelection),
264
					null, null);
264
					null, null);
Lines 267-273 Link Here
267
			bindViewer(fatherComboViewer, viewModel.getPeople(), Person.class,
267
			bindViewer(fatherComboViewer, viewModel.getPeople(), Person.class,
268
					"name");
268
					"name");
269
269
270
			dbc.bindValue(SelectionProviderProperties.singleSelection()
270
			dbc.bindValue(ViewerProperties.singleSelection()
271
					.observe(fatherComboViewer), BeanProperties.value(
271
					.observe(fatherComboViewer), BeanProperties.value(
272
					Person.class, "father").observeDetail(masterSelection),
272
					Person.class, "father").observeDetail(masterSelection),
273
					null, null);
273
					null, null);
(-)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 (-197 / +34 lines)
Lines 26-60 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
/**
Lines 124-135 Link Here
124
				.observeDelayedValue(delay, observable), observable.getWidget());
98
				.observeDelayedValue(delay, observable), observable.getWidget());
125
	}
99
	}
126
100
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
	/**
101
	/**
134
	 * Returns an observable value tracking the enabled state of the given
102
	 * Returns an observable value tracking the enabled state of the given
135
	 * control
103
	 * control
Lines 140-146 Link Here
140
	 *         control
108
	 *         control
141
	 */
109
	 */
142
	public static ISWTObservableValue observeEnabled(Control control) {
110
	public static ISWTObservableValue observeEnabled(Control control) {
143
		return observeWidgetProperty(control, ControlProperties.enabled());
111
		return (ISWTObservableValue) WidgetProperties.enabled()
112
				.observe(control);
144
	}
113
	}
145
114
146
	/**
115
	/**
Lines 153-159 Link Here
153
	 *         control
122
	 *         control
154
	 */
123
	 */
155
	public static ISWTObservableValue observeVisible(Control control) {
124
	public static ISWTObservableValue observeVisible(Control control) {
156
		return observeWidgetProperty(control, ControlProperties.visible());
125
		return (ISWTObservableValue) WidgetProperties.visible()
126
				.observe(control);
157
	}
127
	}
158
128
159
	/**
129
	/**
Lines 175-203 Link Here
175
	 * @since 1.3
145
	 * @since 1.3
176
	 */
146
	 */
177
	public static ISWTObservableValue observeTooltipText(Widget widget) {
147
	public static ISWTObservableValue observeTooltipText(Widget widget) {
178
		if (widget instanceof Control) {
148
		return (ISWTObservableValue) WidgetProperties.tooltipText().observe(
179
			return observeTooltipText((Control) widget);
149
				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
	}
150
	}
202
151
203
	/**
152
	/**
Lines 210-216 Link Here
210
	 *         control
159
	 *         control
211
	 */
160
	 */
212
	public static ISWTObservableValue observeTooltipText(Control control) {
161
	public static ISWTObservableValue observeTooltipText(Control control) {
213
		return observeWidgetProperty(control, ControlProperties.toolTipText());
162
		return (ISWTObservableValue) WidgetProperties.tooltipText().observe(
163
				control);
214
	}
164
	}
215
165
216
	/**
166
	/**
Lines 231-255 Link Here
231
	 *             if <code>control</code> type is unsupported
181
	 *             if <code>control</code> type is unsupported
232
	 */
182
	 */
233
	public static ISWTObservableValue observeSelection(Control control) {
183
	public static ISWTObservableValue observeSelection(Control control) {
234
		IValueProperty property;
184
		return (ISWTObservableValue) WidgetProperties.selection().observe(
235
		if (control instanceof Spinner) {
185
				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
	}
186
	}
254
187
255
	/**
188
	/**
Lines 266-282 Link Here
266
	 *             if <code>control</code> type is unsupported
199
	 *             if <code>control</code> type is unsupported
267
	 */
200
	 */
268
	public static ISWTObservableValue observeMin(Control control) {
201
	public static ISWTObservableValue observeMin(Control control) {
269
		IValueProperty property;
202
		return (ISWTObservableValue) WidgetProperties.minimum()
270
		if (control instanceof Spinner) {
203
				.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
	}
204
	}
281
205
282
	/**
206
	/**
Lines 293-309 Link Here
293
	 *             if <code>control</code> type is unsupported
217
	 *             if <code>control</code> type is unsupported
294
	 */
218
	 */
295
	public static ISWTObservableValue observeMax(Control control) {
219
	public static ISWTObservableValue observeMax(Control control) {
296
		IValueProperty property;
220
		return (ISWTObservableValue) WidgetProperties.maximum()
297
		if (control instanceof Spinner) {
221
				.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
	}
222
	}
308
223
309
	/**
224
	/**
Lines 322-339 Link Here
322
	 *             if <code>control</code> type is unsupported
237
	 *             if <code>control</code> type is unsupported
323
	 */
238
	 */
324
	public static ISWTObservableValue observeText(Control control, int event) {
239
	public static ISWTObservableValue observeText(Control control, int event) {
325
		IValueProperty property;
240
		return (ISWTObservableValue) WidgetProperties.text(event).observe(
326
		if (control instanceof Text) {
241
				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
	}
242
	}
338
243
339
	/**
244
	/**
Lines 358-371 Link Here
358
	 * @since 1.3
263
	 * @since 1.3
359
	 */
264
	 */
360
	public static ISWTObservableValue observeText(Widget widget) {
265
	public static ISWTObservableValue observeText(Widget widget) {
361
		if (widget instanceof Control) {
266
		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
	}
267
	}
370
268
371
	/**
269
	/**
Lines 388-416 Link Here
388
	 *             if <code>control</code> type is unsupported
286
	 *             if <code>control</code> type is unsupported
389
	 */
287
	 */
390
	public static ISWTObservableValue observeText(Control control) {
288
	public static ISWTObservableValue observeText(Control control) {
391
		if (control instanceof Text || control instanceof StyledText) {
289
		return (ISWTObservableValue) WidgetProperties.text().observe(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
	}
290
	}
415
291
416
	/**
292
	/**
Lines 428-447 Link Here
428
	 *             if <code>control</code> type is unsupported
304
	 *             if <code>control</code> type is unsupported
429
	 */
305
	 */
430
	public static IObservableList observeItems(Control control) {
306
	public static IObservableList observeItems(Control control) {
431
		IListProperty property;
307
		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
	}
308
	}
446
309
447
	/**
310
	/**
Lines 461-481 Link Here
461
	 */
324
	 */
462
	public static ISWTObservableValue observeSingleSelectionIndex(
325
	public static ISWTObservableValue observeSingleSelectionIndex(
463
			Control control) {
326
			Control control) {
464
		IValueProperty property;
327
		return (ISWTObservableValue) WidgetProperties.singleSelectionIndex()
465
		if (control instanceof Table) {
328
				.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
	}
329
	}
480
330
481
	/**
331
	/**
Lines 488-494 Link Here
488
	 *         control
338
	 *         control
489
	 */
339
	 */
490
	public static ISWTObservableValue observeForeground(Control control) {
340
	public static ISWTObservableValue observeForeground(Control control) {
491
		return observeWidgetProperty(control, ControlProperties.foreground());
341
		return (ISWTObservableValue) WidgetProperties.foreground().observe(
342
				control);
492
	}
343
	}
493
344
494
	/**
345
	/**
Lines 501-507 Link Here
501
	 *         control
352
	 *         control
502
	 */
353
	 */
503
	public static ISWTObservableValue observeBackground(Control control) {
354
	public static ISWTObservableValue observeBackground(Control control) {
504
		return observeWidgetProperty(control, ControlProperties.background());
355
		return (ISWTObservableValue) WidgetProperties.background().observe(
356
				control);
505
	}
357
	}
506
358
507
	/**
359
	/**
Lines 512-518 Link Here
512
	 * @return an observable value tracking the font of the given control
364
	 * @return an observable value tracking the font of the given control
513
	 */
365
	 */
514
	public static ISWTObservableValue observeFont(Control control) {
366
	public static ISWTObservableValue observeFont(Control control) {
515
		return observeWidgetProperty(control, ControlProperties.font());
367
		return (ISWTObservableValue) WidgetProperties.font().observe(control);
516
	}
368
	}
517
369
518
	/**
370
	/**
Lines 524-530 Link Here
524
	 * @since 1.3
376
	 * @since 1.3
525
	 */
377
	 */
526
	public static ISWTObservableValue observeSize(Control control) {
378
	public static ISWTObservableValue observeSize(Control control) {
527
		return observeWidgetProperty(control, ControlProperties.size());
379
		return (ISWTObservableValue) WidgetProperties.size().observe(control);
528
	}
380
	}
529
381
530
	/**
382
	/**
Lines 536-542 Link Here
536
	 * @since 1.3
388
	 * @since 1.3
537
	 */
389
	 */
538
	public static ISWTObservableValue observeLocation(Control control) {
390
	public static ISWTObservableValue observeLocation(Control control) {
539
		return observeWidgetProperty(control, ControlProperties.location());
391
		return (ISWTObservableValue) WidgetProperties.location().observe(
392
				control);
540
	}
393
	}
541
394
542
	/**
395
	/**
Lines 548-554 Link Here
548
	 * @since 1.3
401
	 * @since 1.3
549
	 */
402
	 */
550
	public static ISWTObservableValue observeFocus(Control control) {
403
	public static ISWTObservableValue observeFocus(Control control) {
551
		return observeWidgetProperty(control, ControlProperties.focused());
404
		return (ISWTObservableValue) WidgetProperties.focused()
405
				.observe(control);
552
	}
406
	}
553
407
554
	/**
408
	/**
Lines 560-566 Link Here
560
	 * @since 1.3
414
	 * @since 1.3
561
	 */
415
	 */
562
	public static ISWTObservableValue observeBounds(Control control) {
416
	public static ISWTObservableValue observeBounds(Control control) {
563
		return observeWidgetProperty(control, ControlProperties.bounds());
417
		return (ISWTObservableValue) WidgetProperties.bounds().observe(control);
564
	}
418
	}
565
419
566
	/**
420
	/**
Lines 576-590 Link Here
576
	 *             if <code>control</code> type is unsupported
430
	 *             if <code>control</code> type is unsupported
577
	 */
431
	 */
578
	public static ISWTObservableValue observeEditable(Control control) {
432
	public static ISWTObservableValue observeEditable(Control control) {
579
		IValueProperty property;
433
		return (ISWTObservableValue) WidgetProperties.editable().observe(
580
		if (control instanceof Text) {
434
				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
	}
435
	}
589
436
590
	private static class DisplayRealm extends Realm {
437
	private static class DisplayRealm extends Realm {
Lines 623-642 Link Here
623
			}
470
			}
624
		}
471
		}
625
472
626
		/*
627
		 * (non-Javadoc)
628
		 * 
629
		 * @see java.lang.Object#hashCode()
630
		 */
631
		public int hashCode() {
473
		public int hashCode() {
632
			return (display == null) ? 0 : display.hashCode();
474
			return (display == null) ? 0 : display.hashCode();
633
		}
475
		}
634
476
635
		/*
636
		 * (non-Javadoc)
637
		 * 
638
		 * @see java.lang.Object#equals(java.lang.Object)
639
		 */
640
		public boolean equals(Object obj) {
477
		public boolean equals(Object obj) {
641
			if (this == obj)
478
			if (this == obj)
642
				return true;
479
				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 (+74 lines)
Lines 11-18 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;
16
28
17
/**
29
/**
18
 * A factory for creating properties of JFace Viewers
30
 * A factory for creating properties of JFace Viewers
Lines 28-31 Link Here
28
	public static IValueProperty input() {
40
	public static IValueProperty input() {
29
		return new ViewerInputProperty();
41
		return new ViewerInputProperty();
30
	}
42
	}
43
44
	/**
45
	 * Returns a set property for the checked elements of a
46
	 * {@link CheckboxTableViewer}, {@link CheckboxTreeViewer} or
47
	 * {@link ICheckable}.
48
	 * 
49
	 * @param elementType
50
	 *            the element type of the returned property
51
	 * 
52
	 * @return a set property for the checked elements of a
53
	 *         {@link CheckboxTableViewer}, {@link CheckboxTreeViewer} or
54
	 *         {@link ICheckable}.
55
	 */
56
	public static ISetProperty checkedElements(final Object elementType) {
57
		return new DelegatingSetProperty(elementType) {
58
			ISetProperty checkable = new CheckableCheckedElementsProperty(
59
					elementType);
60
			ISetProperty checkboxTableViewer = new CheckboxTableViewerCheckedElementsProperty(
61
					elementType);
62
			ISetProperty checkboxTreeViewer = new CheckboxTreeViewerCheckedElementsProperty(
63
					elementType);
64
65
			protected ISetProperty doGetDelegate(Object source) {
66
				if (source instanceof CheckboxTableViewer)
67
					return checkboxTableViewer;
68
				if (source instanceof CheckboxTreeViewer)
69
					return checkboxTreeViewer;
70
				return checkable;
71
			}
72
		};
73
	}
74
75
	/**
76
	 * Returns a value property for the single selection of a JFace
77
	 * ISelectionProvider.
78
	 * 
79
	 * @return a value property for the single selection of a JFace
80
	 *         ISelectionProvider.
81
	 */
82
	public static IValueProperty singleSelection() {
83
		return new SelectionProviderSingleSelectionProperty();
84
	}
85
86
	/**
87
	 * Returns a list property for the multiple selection of a JFace
88
	 * ISelectionProvider.
89
	 * 
90
	 * @return a list property for the multiple selection of a JFace
91
	 *         ISelectionProvider.
92
	 */
93
	public static IListProperty multipleSelection() {
94
		return new SelectionProviderMultipleSelectionProperty();
95
	}
96
97
	/**
98
	 * Returns a value property for the input of a JFace StructuredViewer.
99
	 * 
100
	 * @return a value property for the input of a JFace StructuredViewer.
101
	 */
102
	public static ISetProperty filters() {
103
		return new StructuredViewerFiltersProperty();
104
	}
31
}
105
}
(-)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 (+451 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
85
/**
86
 * A factory for creating properties of SWT controls.
87
 * 
88
 * @since 1.3
89
 */
90
public class WidgetProperties {
91
	/**
92
	 * Returns a value property for observing the background color of a
93
	 * {@link Control}.
94
	 * 
95
	 * @return a value property for observing the background color of a
96
	 *         {@link Control}.
97
	 */
98
	public static IValueProperty background() {
99
		return new ControlBackgroundProperty();
100
	}
101
102
	/**
103
	 * Returns a value property for observing the bounds of a {@link Control}.
104
	 * 
105
	 * @return a value property for observing the bounds of a {@link Control}.
106
	 */
107
	public static IValueProperty bounds() {
108
		return new ControlBoundsProperty();
109
	}
110
111
	/**
112
	 * Returns a value property for observing the editable state of a
113
	 * {@link Text}.
114
	 * 
115
	 * @return a value property for observing the editable state of a
116
	 *         {@link Text}.
117
	 */
118
	public static IValueProperty editable() {
119
		return new DelegatingValueProperty(Boolean.TYPE) {
120
			IValueProperty text = new TextEditableProperty();
121
122
			protected IValueProperty doGetDelegate(Object source) {
123
				if (source instanceof Text)
124
					return text;
125
				throw new IllegalArgumentException(
126
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
127
			}
128
		};
129
	}
130
131
	/**
132
	 * Returns a value property for observing the enablement state of a
133
	 * {@link Control}.
134
	 * 
135
	 * @return a value property for observing the enablement state of a
136
	 *         {@link Control}.
137
	 */
138
	public static IValueProperty enabled() {
139
		return new ControlEnabledProperty();
140
	}
141
142
	/**
143
	 * Returns a value property for observing the focus state of a
144
	 * {@link Control}.
145
	 * 
146
	 * @return a value property for observing the focus state of a
147
	 *         {@link Control}.
148
	 */
149
	public static IValueProperty focused() {
150
		return new ControlFocusedProperty();
151
	}
152
153
	/**
154
	 * Returns a value property for observing the font of a {@link Control}.
155
	 * 
156
	 * @return a value property for observing the font of a {@link Control}.
157
	 */
158
	public static IValueProperty font() {
159
		return new ControlFontProperty();
160
	}
161
162
	/**
163
	 * Returns a value property for observing the foreground color of a
164
	 * {@link Control}.
165
	 * 
166
	 * @return a value property for observing the foreground color of a
167
	 *         {@link Control}.
168
	 */
169
	public static IValueProperty foreground() {
170
		return new ControlForegroundProperty();
171
	}
172
173
	/**
174
	 * Returns a list property for observing the items of a {@link CCombo},
175
	 * {@link Combo} or {@link List}.
176
	 * 
177
	 * @return a list property for observing the items of a {@link CCombo},
178
	 *         {@link Combo} or {@link List}.
179
	 */
180
	public static IListProperty items() {
181
		return new DelegatingListProperty(String.class) {
182
			private IListProperty cCombo = new CComboItemsProperty();
183
			private IListProperty combo = new ComboItemsProperty();
184
			private IListProperty list = new ListItemsProperty();
185
186
			protected IListProperty doGetDelegate(Object source) {
187
				if (source instanceof CCombo)
188
					return cCombo;
189
				if (source instanceof Combo)
190
					return combo;
191
				if (source instanceof List)
192
					return list;
193
				throw new IllegalArgumentException(
194
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
195
			}
196
		};
197
	}
198
199
	/**
200
	 * Returns a value property for observing the location of a {@link Control}.
201
	 * 
202
	 * @return a value property for observing the location of a {@link Control}.
203
	 */
204
	public static IValueProperty location() {
205
		return new ControlLocationProperty();
206
	}
207
208
	/**
209
	 * Returns a value property for observing the maximum value of a
210
	 * {@link Scale} or {@link Spinner}.
211
	 * 
212
	 * @return a value property for observing the maximum value of a
213
	 *         {@link Scale} or {@link Spinner}.
214
	 */
215
	public static IValueProperty maximum() {
216
		return new DelegatingValueProperty(Integer.TYPE) {
217
			private IValueProperty scale = new ScaleMaximumProperty();
218
			private IValueProperty spinner = new SpinnerMaximumProperty();
219
220
			protected IValueProperty doGetDelegate(Object source) {
221
				if (source instanceof Scale)
222
					return scale;
223
				if (source instanceof Spinner)
224
					return spinner;
225
				throw new IllegalArgumentException(
226
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
227
			}
228
		};
229
	}
230
231
	/**
232
	 * Returns a value property for observing the minimum value of a
233
	 * {@link Scale} or {@link Spinner}.
234
	 * 
235
	 * @return a value property for observing the minimum value of a
236
	 *         {@link Scale} or {@link Spinner}.
237
	 */
238
	public static IValueProperty minimum() {
239
		return new DelegatingValueProperty(Integer.TYPE) {
240
			private IValueProperty scale = new ScaleMinimumProperty();
241
			private IValueProperty spinner = new SpinnerMinimumProperty();
242
243
			protected IValueProperty doGetDelegate(Object source) {
244
				if (source instanceof Scale)
245
					return scale;
246
				if (source instanceof Spinner)
247
					return spinner;
248
				throw new IllegalArgumentException(
249
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
250
			}
251
		};
252
	}
253
254
	/**
255
	 * Returns a value property for observing the selection state of a
256
	 * {@link Button}, {@link CCombo}, {@link Combo}, {@link List},
257
	 * {@link Scale} or {@link Spinner}.
258
	 * 
259
	 * @return a value property for observing the selection state of a
260
	 *         {@link Button}, {@link CCombo}, {@link Combo}, {@link List},
261
	 *         {@link Scale} or {@link Spinner}.
262
	 */
263
	public static IValueProperty selection() {
264
		return new DelegatingValueProperty() {
265
			private IValueProperty button = new ButtonSelectionProperty();
266
			private IValueProperty cCombo = new CComboSelectionProperty();
267
			private IValueProperty combo = new ComboSelectionProperty();
268
			private IValueProperty list = new ListSelectionProperty();
269
			private IValueProperty scale = new ScaleSelectionProperty();
270
			private IValueProperty spinner = new SpinnerSelectionProperty();
271
272
			protected IValueProperty doGetDelegate(Object source) {
273
				if (source instanceof Button)
274
					return button;
275
				if (source instanceof CCombo)
276
					return cCombo;
277
				if (source instanceof Combo)
278
					return combo;
279
				if (source instanceof List)
280
					return list;
281
				if (source instanceof Scale)
282
					return scale;
283
				if (source instanceof Spinner)
284
					return spinner;
285
				throw new IllegalArgumentException(
286
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
287
			}
288
		};
289
	}
290
291
	/**
292
	 * Returns a value property for observing the single selection index of a
293
	 * {@link CCombo}, {@link Combo}, {@link List} or {@link Table}.
294
	 * 
295
	 * @return a value property for the single selection index of a SWT Combo.
296
	 */
297
	public static IValueProperty singleSelectionIndex() {
298
		return new DelegatingValueProperty(Integer.TYPE) {
299
			private IValueProperty cCombo = new CComboSingleSelectionIndexProperty();
300
			private IValueProperty combo = new ComboSingleSelectionIndexProperty();
301
			private IValueProperty list = new ListSingleSelectionIndexProperty();
302
			private IValueProperty table = new TableSingleSelectionIndexProperty();
303
304
			protected IValueProperty doGetDelegate(Object source) {
305
				if (source instanceof CCombo)
306
					return cCombo;
307
				if (source instanceof Combo)
308
					return combo;
309
				if (source instanceof List)
310
					return list;
311
				if (source instanceof Table)
312
					return table;
313
				throw new IllegalArgumentException(
314
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
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 new IllegalArgumentException(
366
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
367
			}
368
		};
369
	}
370
371
	/**
372
	 * Returns a value property for observing the text of a {@link StyledText}
373
	 * or {@link Text}.
374
	 * 
375
	 * @param event
376
	 *            the SWT event type to register for change events. May be
377
	 *            {@link SWT#None}, {@link SWT#Modify} or {@link SWT#FocusOut}.
378
	 * 
379
	 * @return a value property for observing the text of a {@link StyledText}
380
	 *         or {@link Text}.
381
	 */
382
	public static IValueProperty text(final int event) {
383
		return new DelegatingValueProperty(String.class) {
384
			private IValueProperty styledText = new StyledTextTextProperty(
385
					event);
386
			private IValueProperty text = new TextTextProperty(event);
387
388
			protected IValueProperty doGetDelegate(Object source) {
389
				if (source instanceof StyledText)
390
					return styledText;
391
				if (source instanceof Text)
392
					return text;
393
				throw new IllegalArgumentException(
394
						"Widget [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
395
			}
396
		};
397
	}
398
399
	/**
400
	 * Returns a value property for observing the tooltip text of a
401
	 * {@link CTabItem}, {@link Control}, {@link TabItem}, {@link TableColumn},
402
	 * {@link ToolItem}, {@link TrayItem}, {@link TreeColumn} or
403
	 * {@link TreeItem}.
404
	 * 
405
	 * @return a value property for observing the tooltip text of a
406
	 *         {@link CTabItem}, {@link Control}, {@link TabItem},
407
	 *         {@link TableColumn}, {@link ToolItem}, {@link TrayItem},
408
	 *         {@link TreeColumn} or {@link TreeItem}.
409
	 */
410
	public static IValueProperty tooltipText() {
411
		return new DelegatingValueProperty(String.class) {
412
			private IValueProperty cTabItem = new CTabItemTooltipTextProperty();
413
			private IValueProperty control = new ControlTooltipTextProperty();
414
			private IValueProperty tabItem = new TabItemTooltipTextProperty();
415
			private IValueProperty tableColumn = new TableColumnTooltipTextProperty();
416
			private IValueProperty toolItem = new ToolItemTooltipTextProperty();
417
			private IValueProperty trayItem = new TrayItemTooltipTextProperty();
418
			private IValueProperty treeItem = new TreeItemTooltipTextProperty();
419
420
			protected IValueProperty doGetDelegate(Object source) {
421
				if (source instanceof CTabItem)
422
					return cTabItem;
423
				if (source instanceof Control)
424
					return control;
425
				if (source instanceof TabItem)
426
					return tabItem;
427
				if (source instanceof TableColumn)
428
					return tableColumn;
429
				if (source instanceof ToolItem)
430
					return toolItem;
431
				if (source instanceof TrayItem)
432
					return trayItem;
433
				if (source instanceof TreeItem)
434
					return treeItem;
435
				throw new IllegalArgumentException(
436
						"Item [" + source.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
437
			}
438
		};
439
	}
440
441
	/**
442
	 * Returns a value property for observing the visibility state of a
443
	 * {@link Control}.
444
	 * 
445
	 * @return a value property for observing the visibility state of a
446
	 *         {@link Control}.
447
	 */
448
	public static IValueProperty visible() {
449
		return new ControlVisibleProperty();
450
	}
451
}
(-)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/TableSingleSelectionObservableValueTest.java (-2 / +2 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().observe(realm, table);
113
		}
113
		}
114
114
115
		public Object getValueType(IObservableValue observable) {
115
		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/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/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/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/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/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) {
(-)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/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/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/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 (-2 / +2 lines)
Lines 22-29 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;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
28
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.custom.CCombo;
29
import org.eclipse.swt.custom.CCombo;
Lines 89-95 Link Here
89
		}
89
		}
90
90
91
		public IObservableValue createObservableValue(Realm realm) {
91
		public IObservableValue createObservableValue(Realm realm) {
92
			return new SWTObservableValueDecorator(CComboProperties.text()
92
			return new SWTObservableValueDecorator(WidgetProperties.text()
93
					.observe(realm, combo), combo);
93
					.observe(realm, combo), combo);
94
		}
94
		}
95
95
(-)src/org/eclipse/jface/tests/internal/databinding/swt/ComboObservableValueTextTest.java (-2 / +2 lines)
Lines 22-29 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;
26
import org.eclipse.jface.databinding.swt.WidgetProperties;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
27
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
28
import org.eclipse.swt.SWT;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.widgets.Combo;
29
import org.eclipse.swt.widgets.Combo;
Lines 90-96 Link Here
90
		}
90
		}
91
91
92
		public IObservableValue createObservableValue(Realm realm) {
92
		public IObservableValue createObservableValue(Realm realm) {
93
			return new SWTObservableValueDecorator(ComboProperties.text()
93
			return new SWTObservableValueDecorator(WidgetProperties.text()
94
					.observe(realm, combo), combo);
94
					.observe(realm, combo), combo);
95
		}
95
		}
96
96
(-)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/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/CComboObservableValueSelectionTest.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.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;
27
import org.eclipse.jface.databinding.swt.WidgetProperties;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
29
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.custom.CCombo;
30
import org.eclipse.swt.custom.CCombo;
Lines 91-97 Link Here
91
		}
91
		}
92
92
93
		public IObservableValue createObservableValue(Realm realm) {
93
		public IObservableValue createObservableValue(Realm realm) {
94
			return new SWTObservableValueDecorator(CComboProperties.selection()
94
			return new SWTObservableValueDecorator(WidgetProperties.selection()
95
					.observe(realm, combo), combo);
95
					.observe(realm, combo), combo);
96
		}
96
		}
97
97
(-)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 (-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.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;
27
import org.eclipse.jface.databinding.swt.WidgetProperties;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
28
import org.eclipse.jface.internal.databinding.swt.SWTObservableValueDecorator;
29
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.widgets.Combo;
30
import org.eclipse.swt.widgets.Combo;
Lines 93-99 Link Here
93
		}
93
		}
94
94
95
		public IObservableValue createObservableValue(Realm realm) {
95
		public IObservableValue createObservableValue(Realm realm) {
96
			return new SWTObservableValueDecorator(ComboProperties.selection()
96
			return new SWTObservableValueDecorator(WidgetProperties.selection()
97
					.observe(realm, combo), combo);
97
					.observe(realm, combo), combo);
98
		}
98
		}
99
99

Return to bug 194734