1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.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.repositorydecorator.ComponentResult; |
15 | import de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.RepositorydecoratorPackage; |
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.repositorydecorator.ComponentResult} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class ComponentResultItemProvider |
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 ComponentResultItemProvider(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 | addNormalisedResourceDemandPropertyDescriptor(object); |
71 | addNormalisedResponseTimePropertyDescriptor(object); |
72 | addAverageResourceDemandPropertyDescriptor(object); |
73 | addMeanResponseTimePropertyDescriptor(object); |
74 | addAverageNumberOfSentMessagesPropertyDescriptor(object); |
75 | } |
76 | return itemPropertyDescriptors; |
77 | } |
78 | |
79 | /** |
80 | * This adds a property descriptor for the Normalised Resource Demand feature. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | protected void addNormalisedResourceDemandPropertyDescriptor(Object object) { |
86 | itemPropertyDescriptors.add |
87 | (createItemPropertyDescriptor |
88 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
89 | getResourceLocator(), |
90 | getString("_UI_ComponentResult_normalisedResourceDemand_feature"), |
91 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentResult_normalisedResourceDemand_feature", "_UI_ComponentResult_type"), |
92 | RepositorydecoratorPackage.Literals.COMPONENT_RESULT__NORMALISED_RESOURCE_DEMAND, |
93 | true, |
94 | false, |
95 | false, |
96 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
97 | null, |
98 | null)); |
99 | } |
100 | |
101 | /** |
102 | * This adds a property descriptor for the Normalised Response Time feature. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected void addNormalisedResponseTimePropertyDescriptor(Object object) { |
108 | itemPropertyDescriptors.add |
109 | (createItemPropertyDescriptor |
110 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
111 | getResourceLocator(), |
112 | getString("_UI_ComponentResult_normalisedResponseTime_feature"), |
113 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentResult_normalisedResponseTime_feature", "_UI_ComponentResult_type"), |
114 | RepositorydecoratorPackage.Literals.COMPONENT_RESULT__NORMALISED_RESPONSE_TIME, |
115 | true, |
116 | false, |
117 | false, |
118 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
119 | null, |
120 | null)); |
121 | } |
122 | |
123 | /** |
124 | * This adds a property descriptor for the Average Resource Demand feature. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | protected void addAverageResourceDemandPropertyDescriptor(Object object) { |
130 | itemPropertyDescriptors.add |
131 | (createItemPropertyDescriptor |
132 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
133 | getResourceLocator(), |
134 | getString("_UI_ComponentResult_averageResourceDemand_feature"), |
135 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentResult_averageResourceDemand_feature", "_UI_ComponentResult_type"), |
136 | RepositorydecoratorPackage.Literals.COMPONENT_RESULT__AVERAGE_RESOURCE_DEMAND, |
137 | true, |
138 | false, |
139 | false, |
140 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
141 | null, |
142 | null)); |
143 | } |
144 | |
145 | /** |
146 | * This adds a property descriptor for the Mean Response Time feature. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | protected void addMeanResponseTimePropertyDescriptor(Object object) { |
152 | itemPropertyDescriptors.add |
153 | (createItemPropertyDescriptor |
154 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
155 | getResourceLocator(), |
156 | getString("_UI_ComponentResult_meanResponseTime_feature"), |
157 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentResult_meanResponseTime_feature", "_UI_ComponentResult_type"), |
158 | RepositorydecoratorPackage.Literals.COMPONENT_RESULT__MEAN_RESPONSE_TIME, |
159 | true, |
160 | false, |
161 | false, |
162 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
163 | null, |
164 | null)); |
165 | } |
166 | |
167 | /** |
168 | * This adds a property descriptor for the Average Number Of Sent Messages feature. |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | protected void addAverageNumberOfSentMessagesPropertyDescriptor(Object object) { |
174 | itemPropertyDescriptors.add |
175 | (createItemPropertyDescriptor |
176 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
177 | getResourceLocator(), |
178 | getString("_UI_ComponentResult_averageNumberOfSentMessages_feature"), |
179 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentResult_averageNumberOfSentMessages_feature", "_UI_ComponentResult_type"), |
180 | RepositorydecoratorPackage.Literals.COMPONENT_RESULT__AVERAGE_NUMBER_OF_SENT_MESSAGES, |
181 | true, |
182 | false, |
183 | false, |
184 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
185 | null, |
186 | null)); |
187 | } |
188 | |
189 | /** |
190 | * This returns the label text for the adapted class. |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | @Override |
196 | public String getText(Object object) { |
197 | String label = ((ComponentResult)object).getEntityName(); |
198 | return label == null || label.length() == 0 ? |
199 | getString("_UI_ComponentResult_type") : |
200 | getString("_UI_ComponentResult_type") + " " + label; |
201 | } |
202 | |
203 | /** |
204 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
205 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | @Override |
211 | public void notifyChanged(Notification notification) { |
212 | updateChildren(notification); |
213 | |
214 | switch (notification.getFeatureID(ComponentResult.class)) { |
215 | case RepositorydecoratorPackage.COMPONENT_RESULT__NORMALISED_RESOURCE_DEMAND: |
216 | case RepositorydecoratorPackage.COMPONENT_RESULT__NORMALISED_RESPONSE_TIME: |
217 | case RepositorydecoratorPackage.COMPONENT_RESULT__AVERAGE_RESOURCE_DEMAND: |
218 | case RepositorydecoratorPackage.COMPONENT_RESULT__MEAN_RESPONSE_TIME: |
219 | case RepositorydecoratorPackage.COMPONENT_RESULT__AVERAGE_NUMBER_OF_SENT_MESSAGES: |
220 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
221 | return; |
222 | } |
223 | super.notifyChanged(notification); |
224 | } |
225 | |
226 | /** |
227 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
228 | * that can be created under this object. |
229 | * <!-- begin-user-doc --> |
230 | * <!-- end-user-doc --> |
231 | * @generated |
232 | */ |
233 | @Override |
234 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
235 | super.collectNewChildDescriptors(newChildDescriptors, object); |
236 | } |
237 | |
238 | /** |
239 | * Return the resource locator for this item provider's resources. |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | @Override |
245 | public ResourceLocator getResourceLocator() { |
246 | return ResultdecoratorEditPlugin.INSTANCE; |
247 | } |
248 | |
249 | } |