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.resultdecorator.provider.ResultdecoratorEditPlugin; |
11 | |
12 | import de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.RepositorydecoratorPackage; |
13 | import de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.ServiceResult; |
14 | |
15 | import java.util.Collection; |
16 | import java.util.List; |
17 | |
18 | import org.eclipse.emf.common.notify.AdapterFactory; |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.ResourceLocator; |
22 | |
23 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
32 | import org.eclipse.emf.edit.provider.ViewerNotification; |
33 | |
34 | /** |
35 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.ServiceResult} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class ServiceResultItemProvider |
41 | extends ItemProviderAdapter |
42 | implements |
43 | IEditingDomainItemProvider, |
44 | IStructuredItemContentProvider, |
45 | ITreeItemContentProvider, |
46 | IItemLabelProvider, |
47 | IItemPropertySource { |
48 | /** |
49 | * This constructs an instance from a factory and a notifier. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public ServiceResultItemProvider(AdapterFactory adapterFactory) { |
55 | super(adapterFactory); |
56 | } |
57 | |
58 | /** |
59 | * This returns the property descriptors for the adapted class. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | @Override |
65 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
66 | if (itemPropertyDescriptors == null) { |
67 | super.getPropertyDescriptors(object); |
68 | |
69 | addMeanResponseTimePropertyDescriptor(object); |
70 | addThroughputPropertyDescriptor(object); |
71 | addServiceEffectSpecification_ServiceResultPropertyDescriptor(object); |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This adds a property descriptor for the Mean Response Time feature. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | protected void addMeanResponseTimePropertyDescriptor(Object object) { |
83 | itemPropertyDescriptors.add |
84 | (createItemPropertyDescriptor |
85 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
86 | getResourceLocator(), |
87 | getString("_UI_ServiceResult_meanResponseTime_feature"), |
88 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceResult_meanResponseTime_feature", "_UI_ServiceResult_type"), |
89 | RepositorydecoratorPackage.Literals.SERVICE_RESULT__MEAN_RESPONSE_TIME, |
90 | true, |
91 | false, |
92 | false, |
93 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
94 | null, |
95 | null)); |
96 | } |
97 | |
98 | /** |
99 | * This adds a property descriptor for the Throughput feature. |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | protected void addThroughputPropertyDescriptor(Object object) { |
105 | itemPropertyDescriptors.add |
106 | (createItemPropertyDescriptor |
107 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
108 | getResourceLocator(), |
109 | getString("_UI_ServiceResult_throughput_feature"), |
110 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceResult_throughput_feature", "_UI_ServiceResult_type"), |
111 | RepositorydecoratorPackage.Literals.SERVICE_RESULT__THROUGHPUT, |
112 | true, |
113 | false, |
114 | false, |
115 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
116 | null, |
117 | null)); |
118 | } |
119 | |
120 | /** |
121 | * This adds a property descriptor for the Service Effect Specification Service Result feature. |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | protected void addServiceEffectSpecification_ServiceResultPropertyDescriptor(Object object) { |
127 | itemPropertyDescriptors.add |
128 | (createItemPropertyDescriptor |
129 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
130 | getResourceLocator(), |
131 | getString("_UI_ServiceResult_serviceEffectSpecification_ServiceResult_feature"), |
132 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceResult_serviceEffectSpecification_ServiceResult_feature", "_UI_ServiceResult_type"), |
133 | RepositorydecoratorPackage.Literals.SERVICE_RESULT__SERVICE_EFFECT_SPECIFICATION_SERVICE_RESULT, |
134 | true, |
135 | false, |
136 | true, |
137 | null, |
138 | null, |
139 | null)); |
140 | } |
141 | |
142 | /** |
143 | * This returns the label text for the adapted class. |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public String getText(Object object) { |
150 | ServiceResult serviceResult = (ServiceResult)object; |
151 | return getString("_UI_ServiceResult_type") + " " + serviceResult.getMeanResponseTime(); |
152 | } |
153 | |
154 | /** |
155 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
156 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | public void notifyChanged(Notification notification) { |
163 | updateChildren(notification); |
164 | |
165 | switch (notification.getFeatureID(ServiceResult.class)) { |
166 | case RepositorydecoratorPackage.SERVICE_RESULT__MEAN_RESPONSE_TIME: |
167 | case RepositorydecoratorPackage.SERVICE_RESULT__THROUGHPUT: |
168 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
169 | return; |
170 | } |
171 | super.notifyChanged(notification); |
172 | } |
173 | |
174 | /** |
175 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
176 | * that can be created under this object. |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | @Override |
182 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
183 | super.collectNewChildDescriptors(newChildDescriptors, object); |
184 | } |
185 | |
186 | /** |
187 | * Return the resource locator for this item provider's resources. |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public ResourceLocator getResourceLocator() { |
194 | return ResultdecoratorEditPlugin.INSTANCE; |
195 | } |
196 | |
197 | } |