1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resultdecorator.resourceenvironmentdecorator.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.core.entity.provider.NamedElementItemProvider; |
11 | |
12 | import de.uka.ipd.sdq.pcm.resultdecorator.provider.ResultdecoratorEditPlugin; |
13 | |
14 | import de.uka.ipd.sdq.pcm.resultdecorator.resourceenvironmentdecorator.ResourceenvironmentdecoratorPackage; |
15 | import de.uka.ipd.sdq.pcm.resultdecorator.resourceenvironmentdecorator.UtilisationResult; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
25 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
26 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
27 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
28 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
29 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
30 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
31 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
32 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
33 | import org.eclipse.emf.edit.provider.ViewerNotification; |
34 | |
35 | /** |
36 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.resultdecorator.resourceenvironmentdecorator.UtilisationResult} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class UtilisationResultItemProvider |
42 | extends NamedElementItemProvider |
43 | implements |
44 | IEditingDomainItemProvider, |
45 | IStructuredItemContentProvider, |
46 | ITreeItemContentProvider, |
47 | IItemLabelProvider, |
48 | IItemPropertySource { |
49 | /** |
50 | * This constructs an instance from a factory and a notifier. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public UtilisationResultItemProvider(AdapterFactory adapterFactory) { |
56 | super(adapterFactory); |
57 | } |
58 | |
59 | /** |
60 | * This returns the property descriptors for the adapted class. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
67 | if (itemPropertyDescriptors == null) { |
68 | super.getPropertyDescriptors(object); |
69 | |
70 | addNormalisedResourceUtilisationPropertyDescriptor(object); |
71 | addNormalisedWaitTimePropertyDescriptor(object); |
72 | addResourceUtilisationPropertyDescriptor(object); |
73 | addAverageWaitTimePropertyDescriptor(object); |
74 | addAverageQueueLengthPropertyDescriptor(object); |
75 | addMaxQueueLengthPropertyDescriptor(object); |
76 | } |
77 | return itemPropertyDescriptors; |
78 | } |
79 | |
80 | /** |
81 | * This adds a property descriptor for the Normalised Resource Utilisation feature. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | protected void addNormalisedResourceUtilisationPropertyDescriptor(Object object) { |
87 | itemPropertyDescriptors.add |
88 | (createItemPropertyDescriptor |
89 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
90 | getResourceLocator(), |
91 | getString("_UI_UtilisationResult_normalisedResourceUtilisation_feature"), |
92 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_normalisedResourceUtilisation_feature", "_UI_UtilisationResult_type"), |
93 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__NORMALISED_RESOURCE_UTILISATION, |
94 | true, |
95 | false, |
96 | false, |
97 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
98 | null, |
99 | null)); |
100 | } |
101 | |
102 | /** |
103 | * This adds a property descriptor for the Normalised Wait Time feature. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | protected void addNormalisedWaitTimePropertyDescriptor(Object object) { |
109 | itemPropertyDescriptors.add |
110 | (createItemPropertyDescriptor |
111 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
112 | getResourceLocator(), |
113 | getString("_UI_UtilisationResult_normalisedWaitTime_feature"), |
114 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_normalisedWaitTime_feature", "_UI_UtilisationResult_type"), |
115 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__NORMALISED_WAIT_TIME, |
116 | true, |
117 | false, |
118 | false, |
119 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
120 | null, |
121 | null)); |
122 | } |
123 | |
124 | /** |
125 | * This adds a property descriptor for the Resource Utilisation feature. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | protected void addResourceUtilisationPropertyDescriptor(Object object) { |
131 | itemPropertyDescriptors.add |
132 | (createItemPropertyDescriptor |
133 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
134 | getResourceLocator(), |
135 | getString("_UI_UtilisationResult_resourceUtilisation_feature"), |
136 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_resourceUtilisation_feature", "_UI_UtilisationResult_type"), |
137 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__RESOURCE_UTILISATION, |
138 | true, |
139 | false, |
140 | false, |
141 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
142 | null, |
143 | null)); |
144 | } |
145 | |
146 | /** |
147 | * This adds a property descriptor for the Average Wait Time feature. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | protected void addAverageWaitTimePropertyDescriptor(Object object) { |
153 | itemPropertyDescriptors.add |
154 | (createItemPropertyDescriptor |
155 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
156 | getResourceLocator(), |
157 | getString("_UI_UtilisationResult_averageWaitTime_feature"), |
158 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_averageWaitTime_feature", "_UI_UtilisationResult_type"), |
159 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__AVERAGE_WAIT_TIME, |
160 | true, |
161 | false, |
162 | false, |
163 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
164 | null, |
165 | null)); |
166 | } |
167 | |
168 | /** |
169 | * This adds a property descriptor for the Average Queue Length feature. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | protected void addAverageQueueLengthPropertyDescriptor(Object object) { |
175 | itemPropertyDescriptors.add |
176 | (createItemPropertyDescriptor |
177 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
178 | getResourceLocator(), |
179 | getString("_UI_UtilisationResult_averageQueueLength_feature"), |
180 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_averageQueueLength_feature", "_UI_UtilisationResult_type"), |
181 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__AVERAGE_QUEUE_LENGTH, |
182 | true, |
183 | false, |
184 | false, |
185 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
186 | null, |
187 | null)); |
188 | } |
189 | |
190 | /** |
191 | * This adds a property descriptor for the Max Queue Length feature. |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | protected void addMaxQueueLengthPropertyDescriptor(Object object) { |
197 | itemPropertyDescriptors.add |
198 | (createItemPropertyDescriptor |
199 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
200 | getResourceLocator(), |
201 | getString("_UI_UtilisationResult_maxQueueLength_feature"), |
202 | getString("_UI_PropertyDescriptor_description", "_UI_UtilisationResult_maxQueueLength_feature", "_UI_UtilisationResult_type"), |
203 | ResourceenvironmentdecoratorPackage.Literals.UTILISATION_RESULT__MAX_QUEUE_LENGTH, |
204 | true, |
205 | false, |
206 | false, |
207 | ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
208 | null, |
209 | null)); |
210 | } |
211 | |
212 | /** |
213 | * This returns the label text for the adapted class. |
214 | * <!-- begin-user-doc --> |
215 | * <!-- end-user-doc --> |
216 | * @generated |
217 | */ |
218 | @Override |
219 | public String getText(Object object) { |
220 | String label = ((UtilisationResult)object).getEntityName(); |
221 | return label == null || label.length() == 0 ? |
222 | getString("_UI_UtilisationResult_type") : |
223 | getString("_UI_UtilisationResult_type") + " " + label; |
224 | } |
225 | |
226 | /** |
227 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
228 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
229 | * <!-- begin-user-doc --> |
230 | * <!-- end-user-doc --> |
231 | * @generated |
232 | */ |
233 | @Override |
234 | public void notifyChanged(Notification notification) { |
235 | updateChildren(notification); |
236 | |
237 | switch (notification.getFeatureID(UtilisationResult.class)) { |
238 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__NORMALISED_RESOURCE_UTILISATION: |
239 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__NORMALISED_WAIT_TIME: |
240 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__RESOURCE_UTILISATION: |
241 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__AVERAGE_WAIT_TIME: |
242 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__AVERAGE_QUEUE_LENGTH: |
243 | case ResourceenvironmentdecoratorPackage.UTILISATION_RESULT__MAX_QUEUE_LENGTH: |
244 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
245 | return; |
246 | } |
247 | super.notifyChanged(notification); |
248 | } |
249 | |
250 | /** |
251 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
252 | * that can be created under this object. |
253 | * <!-- begin-user-doc --> |
254 | * <!-- end-user-doc --> |
255 | * @generated |
256 | */ |
257 | @Override |
258 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
259 | super.collectNewChildDescriptors(newChildDescriptors, object); |
260 | } |
261 | |
262 | /** |
263 | * Return the resource locator for this item provider's resources. |
264 | * <!-- begin-user-doc --> |
265 | * <!-- end-user-doc --> |
266 | * @generated |
267 | */ |
268 | @Override |
269 | public ResourceLocator getResourceLocator() { |
270 | return ResultdecoratorEditPlugin.INSTANCE; |
271 | } |
272 | |
273 | } |