1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.sensitivity.provider; |
8 | |
9 | |
10 | import java.util.Collection; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.common.notify.AdapterFactory; |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.sensitivity.DoubleParameterRange; |
26 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.DoubleParameterRange} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class DoubleParameterRangeItemProvider |
35 | extends DoubleParameterVariationItemProvider |
36 | implements |
37 | IEditingDomainItemProvider, |
38 | IStructuredItemContentProvider, |
39 | ITreeItemContentProvider, |
40 | IItemLabelProvider, |
41 | IItemPropertySource { |
42 | /** |
43 | * This constructs an instance from a factory and a notifier. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public DoubleParameterRangeItemProvider(AdapterFactory adapterFactory) { |
49 | super(adapterFactory); |
50 | } |
51 | |
52 | /** |
53 | * This returns the property descriptors for the adapted class. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | @Override |
59 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
60 | if (itemPropertyDescriptors == null) { |
61 | super.getPropertyDescriptors(object); |
62 | |
63 | addConsiderStepSizePropertyDescriptor(object); |
64 | addFirstValuePropertyDescriptor(object); |
65 | addLastValuePropertyDescriptor(object); |
66 | addStepSizePropertyDescriptor(object); |
67 | addStepCountPropertyDescriptor(object); |
68 | } |
69 | return itemPropertyDescriptors; |
70 | } |
71 | |
72 | /** |
73 | * This adds a property descriptor for the Consider Step Size feature. |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @generated |
77 | */ |
78 | protected void addConsiderStepSizePropertyDescriptor(Object object) { |
79 | itemPropertyDescriptors.add |
80 | (createItemPropertyDescriptor |
81 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
82 | getResourceLocator(), |
83 | getString("_UI_DoubleParameterRange_considerStepSize_feature"), |
84 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleParameterRange_considerStepSize_feature", "_UI_DoubleParameterRange_type"), |
85 | SensitivityPackage.Literals.DOUBLE_PARAMETER_RANGE__CONSIDER_STEP_SIZE, |
86 | true, |
87 | false, |
88 | false, |
89 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
90 | null, |
91 | null)); |
92 | } |
93 | |
94 | /** |
95 | * This adds a property descriptor for the First Value feature. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | protected void addFirstValuePropertyDescriptor(Object object) { |
101 | itemPropertyDescriptors.add |
102 | (createItemPropertyDescriptor |
103 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
104 | getResourceLocator(), |
105 | getString("_UI_DoubleParameterRange_firstValue_feature"), |
106 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleParameterRange_firstValue_feature", "_UI_DoubleParameterRange_type"), |
107 | SensitivityPackage.Literals.DOUBLE_PARAMETER_RANGE__FIRST_VALUE, |
108 | true, |
109 | false, |
110 | false, |
111 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
112 | null, |
113 | null)); |
114 | } |
115 | |
116 | /** |
117 | * This adds a property descriptor for the Last Value feature. |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | protected void addLastValuePropertyDescriptor(Object object) { |
123 | itemPropertyDescriptors.add |
124 | (createItemPropertyDescriptor |
125 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
126 | getResourceLocator(), |
127 | getString("_UI_DoubleParameterRange_lastValue_feature"), |
128 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleParameterRange_lastValue_feature", "_UI_DoubleParameterRange_type"), |
129 | SensitivityPackage.Literals.DOUBLE_PARAMETER_RANGE__LAST_VALUE, |
130 | true, |
131 | false, |
132 | false, |
133 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
134 | null, |
135 | null)); |
136 | } |
137 | |
138 | /** |
139 | * This adds a property descriptor for the Step Size feature. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | protected void addStepSizePropertyDescriptor(Object object) { |
145 | itemPropertyDescriptors.add |
146 | (createItemPropertyDescriptor |
147 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
148 | getResourceLocator(), |
149 | getString("_UI_DoubleParameterRange_stepSize_feature"), |
150 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleParameterRange_stepSize_feature", "_UI_DoubleParameterRange_type"), |
151 | SensitivityPackage.Literals.DOUBLE_PARAMETER_RANGE__STEP_SIZE, |
152 | true, |
153 | false, |
154 | false, |
155 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
156 | null, |
157 | null)); |
158 | } |
159 | |
160 | /** |
161 | * This adds a property descriptor for the Step Count feature. |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | protected void addStepCountPropertyDescriptor(Object object) { |
167 | itemPropertyDescriptors.add |
168 | (createItemPropertyDescriptor |
169 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
170 | getResourceLocator(), |
171 | getString("_UI_DoubleParameterRange_stepCount_feature"), |
172 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleParameterRange_stepCount_feature", "_UI_DoubleParameterRange_type"), |
173 | SensitivityPackage.Literals.DOUBLE_PARAMETER_RANGE__STEP_COUNT, |
174 | true, |
175 | false, |
176 | false, |
177 | ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
178 | null, |
179 | null)); |
180 | } |
181 | |
182 | /** |
183 | * This returns DoubleParameterRange.gif. |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | @Override |
189 | public Object getImage(Object object) { |
190 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DoubleParameterRange")); |
191 | } |
192 | |
193 | /** |
194 | * This returns the label text for the adapted class. |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated not |
198 | */ |
199 | @Override |
200 | public String getText(Object object) { |
201 | String doubleRange = "UNSPECIFIED"; |
202 | try { |
203 | doubleRange = ((DoubleParameterRange)object).getFirstValue() + " ... " |
204 | + ((DoubleParameterRange)object).getLastValue(); |
205 | } catch(Exception e) {} |
206 | return doubleRange + " <" + getString("_UI_DoubleParameterRange_type") + ">"; |
207 | } |
208 | |
209 | /** |
210 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
211 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | @Override |
217 | public void notifyChanged(Notification notification) { |
218 | updateChildren(notification); |
219 | |
220 | switch (notification.getFeatureID(DoubleParameterRange.class)) { |
221 | case SensitivityPackage.DOUBLE_PARAMETER_RANGE__CONSIDER_STEP_SIZE: |
222 | case SensitivityPackage.DOUBLE_PARAMETER_RANGE__FIRST_VALUE: |
223 | case SensitivityPackage.DOUBLE_PARAMETER_RANGE__LAST_VALUE: |
224 | case SensitivityPackage.DOUBLE_PARAMETER_RANGE__STEP_SIZE: |
225 | case SensitivityPackage.DOUBLE_PARAMETER_RANGE__STEP_COUNT: |
226 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
227 | return; |
228 | } |
229 | super.notifyChanged(notification); |
230 | } |
231 | |
232 | /** |
233 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
234 | * that can be created under this object. |
235 | * <!-- begin-user-doc --> |
236 | * <!-- end-user-doc --> |
237 | * @generated |
238 | */ |
239 | @Override |
240 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
241 | super.collectNewChildDescriptors(newChildDescriptors, object); |
242 | } |
243 | |
244 | } |