Mercurial > projects > dwt2
comparison org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ScaleObservableValue.d @ 85:6be48cf9f95c
Work on databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 18 Apr 2009 13:54:50 +0200 |
parents | 0a55d2d5a946 |
children |
comparison
equal
deleted
inserted
replaced
84:fcf926c91ca4 | 85:6be48cf9f95c |
---|---|
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Peter Centgraf - bug 175763 | 10 * Peter Centgraf - bug 175763 |
11 *******************************************************************************/ | 11 *******************************************************************************/ |
12 module org.eclipse.jface.internal.databinding.swt.ScaleObservableValue; | 12 module org.eclipse.jface.internal.databinding.swt.ScaleObservableValue; |
13 import org.eclipse.jface.internal.databinding.swt.SWTProperties; | |
13 | 14 |
14 import java.lang.all; | 15 import java.lang.all; |
15 | 16 |
16 import org.eclipse.core.databinding.observable.Diffs; | 17 import org.eclipse.core.databinding.observable.Diffs; |
17 import org.eclipse.core.databinding.observable.Realm; | 18 import org.eclipse.core.databinding.observable.Realm; |
75 } | 76 } |
76 }); | 77 }); |
77 } else if (!attribute.equals(SWTProperties.MIN) | 78 } else if (!attribute.equals(SWTProperties.MIN) |
78 && !attribute.equals(SWTProperties.MAX)) { | 79 && !attribute.equals(SWTProperties.MAX)) { |
79 throw new IllegalArgumentException( | 80 throw new IllegalArgumentException( |
80 "Attribute name not valid: " + attribute); //$NON-NLS-1$ | 81 "Attribute name not valid: " ~ attribute); //$NON-NLS-1$ |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 public void doSetValue(Object value) { | 85 public void doSetValue(Object value) { |
85 int oldValue; | 86 int oldValue; |
96 scale.setMinimum(newValue); | 97 scale.setMinimum(newValue); |
97 } else if (attribute.equals(SWTProperties.MAX)) { | 98 } else if (attribute.equals(SWTProperties.MAX)) { |
98 oldValue = scale.getMaximum(); | 99 oldValue = scale.getMaximum(); |
99 scale.setMaximum(newValue); | 100 scale.setMaximum(newValue); |
100 } else { | 101 } else { |
101 Assert.isTrue(false, "invalid attribute name:" + attribute); //$NON-NLS-1$ | 102 Assert.isTrue(false, "invalid attribute name:" ~ attribute); //$NON-NLS-1$ |
102 return; | 103 return; |
103 } | 104 } |
104 | 105 |
105 notifyIfChanged(oldValue, newValue); | 106 notifyIfChanged(oldValue, newValue); |
106 } finally { | 107 } finally { |
108 } | 109 } |
109 } | 110 } |
110 | 111 |
111 public Object doGetValue() { | 112 public Object doGetValue() { |
112 int value = 0; | 113 int value = 0; |
113 if (attribute.opEquals(SWTProperties.SELECTION)) { | 114 if (attribute.equals(SWTProperties.SELECTION)) { |
114 value = scale.getSelection(); | 115 value = scale.getSelection(); |
115 } else if (attribute.equals(SWTProperties.MIN)) { | 116 } else if (attribute.equals(SWTProperties.MIN)) { |
116 value = scale.getMinimum(); | 117 value = scale.getMinimum(); |
117 } else if (attribute.equals(SWTProperties.MAX)) { | 118 } else if (attribute.equals(SWTProperties.MAX)) { |
118 value = scale.getMaximum(); | 119 value = scale.getMaximum(); |