1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.aggregatedUsageContext.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextFactory; |
10 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextPackage; |
11 | import de.uka.ipd.sdq.context.aggregatedUsageContext.ServiceExecutionContext; |
12 | |
13 | import de.uka.ipd.sdq.context.computed_usage.provider.ContextEditPlugin; |
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.ecore.EStructuralFeature; |
24 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
25 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
26 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
27 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
28 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
29 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
31 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
32 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
33 | import org.eclipse.emf.edit.provider.ViewerNotification; |
34 | |
35 | /** |
36 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.ServiceExecutionContext} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class ServiceExecutionContextItemProvider |
42 | extends ItemProviderAdapter |
43 | implements |
44 | IEditingDomainItemProvider, |
45 | IStructuredItemContentProvider, |
46 | ITreeItemContentProvider, |
47 | IItemLabelProvider, |
48 | IItemPropertySource { |
49 | /** |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
55 | |
56 | /** |
57 | * This constructs an instance from a factory and a notifier. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | public ServiceExecutionContextItemProvider(AdapterFactory adapterFactory) { |
63 | super(adapterFactory); |
64 | } |
65 | |
66 | /** |
67 | * This returns the property descriptors for the adapted class. |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | @Override |
73 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
74 | if (itemPropertyDescriptors == null) { |
75 | super.getPropertyDescriptors(object); |
76 | |
77 | addGlobalExecutionFrequencyPropertyDescriptor(object); |
78 | addAllocationContext_ServiceExecutionContextPropertyDescriptor(object); |
79 | addDescribedSEFF_ServiceExecutionContextPropertyDescriptor(object); |
80 | addUsageScenario_ServiceExecutionContextPropertyDescriptor(object); |
81 | addReceivedAggregatedCommunication_AggregatedCommunicationPropertyDescriptor(object); |
82 | } |
83 | return itemPropertyDescriptors; |
84 | } |
85 | |
86 | /** |
87 | * This adds a property descriptor for the Global Execution Frequency feature. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | protected void addGlobalExecutionFrequencyPropertyDescriptor(Object object) { |
93 | itemPropertyDescriptors.add |
94 | (createItemPropertyDescriptor |
95 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
96 | getResourceLocator(), |
97 | getString("_UI_ServiceExecutionContext_globalExecutionFrequency_feature"), |
98 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceExecutionContext_globalExecutionFrequency_feature", "_UI_ServiceExecutionContext_type"), |
99 | AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__GLOBAL_EXECUTION_FREQUENCY, |
100 | true, |
101 | false, |
102 | false, |
103 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
104 | null, |
105 | null)); |
106 | } |
107 | |
108 | /** |
109 | * This adds a property descriptor for the Allocation Context Service Execution Context feature. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | protected void addAllocationContext_ServiceExecutionContextPropertyDescriptor(Object object) { |
115 | itemPropertyDescriptors.add |
116 | (createItemPropertyDescriptor |
117 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
118 | getResourceLocator(), |
119 | getString("_UI_ServiceExecutionContext_allocationContext_ServiceExecutionContext_feature"), |
120 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceExecutionContext_allocationContext_ServiceExecutionContext_feature", "_UI_ServiceExecutionContext_type"), |
121 | AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__ALLOCATION_CONTEXT_SERVICE_EXECUTION_CONTEXT, |
122 | true, |
123 | false, |
124 | true, |
125 | null, |
126 | null, |
127 | null)); |
128 | } |
129 | |
130 | /** |
131 | * This adds a property descriptor for the Described SEFF Service Execution Context feature. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | protected void addDescribedSEFF_ServiceExecutionContextPropertyDescriptor(Object object) { |
137 | itemPropertyDescriptors.add |
138 | (createItemPropertyDescriptor |
139 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
140 | getResourceLocator(), |
141 | getString("_UI_ServiceExecutionContext_describedSEFF_ServiceExecutionContext_feature"), |
142 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceExecutionContext_describedSEFF_ServiceExecutionContext_feature", "_UI_ServiceExecutionContext_type"), |
143 | AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__DESCRIBED_SEFF_SERVICE_EXECUTION_CONTEXT, |
144 | true, |
145 | false, |
146 | true, |
147 | null, |
148 | null, |
149 | null)); |
150 | } |
151 | |
152 | /** |
153 | * This adds a property descriptor for the Usage Scenario Service Execution Context feature. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | protected void addUsageScenario_ServiceExecutionContextPropertyDescriptor(Object object) { |
159 | itemPropertyDescriptors.add |
160 | (createItemPropertyDescriptor |
161 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
162 | getResourceLocator(), |
163 | getString("_UI_ServiceExecutionContext_usageScenario_ServiceExecutionContext_feature"), |
164 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceExecutionContext_usageScenario_ServiceExecutionContext_feature", "_UI_ServiceExecutionContext_type"), |
165 | AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__USAGE_SCENARIO_SERVICE_EXECUTION_CONTEXT, |
166 | true, |
167 | false, |
168 | true, |
169 | null, |
170 | null, |
171 | null)); |
172 | } |
173 | |
174 | /** |
175 | * This adds a property descriptor for the Received Aggregated Communication Aggregated Communication feature. |
176 | * <!-- begin-user-doc --> |
177 | * <!-- end-user-doc --> |
178 | * @generated |
179 | */ |
180 | protected void addReceivedAggregatedCommunication_AggregatedCommunicationPropertyDescriptor(Object object) { |
181 | itemPropertyDescriptors.add |
182 | (createItemPropertyDescriptor |
183 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
184 | getResourceLocator(), |
185 | getString("_UI_ServiceExecutionContext_receivedAggregatedCommunication_AggregatedCommunication_feature"), |
186 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceExecutionContext_receivedAggregatedCommunication_AggregatedCommunication_feature", "_UI_ServiceExecutionContext_type"), |
187 | AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__RECEIVED_AGGREGATED_COMMUNICATION_AGGREGATED_COMMUNICATION, |
188 | true, |
189 | false, |
190 | true, |
191 | null, |
192 | null, |
193 | null)); |
194 | } |
195 | |
196 | /** |
197 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
198 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
199 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | @Override |
205 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
206 | if (childrenFeatures == null) { |
207 | super.getChildrenFeatures(object); |
208 | childrenFeatures.add(AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__AGGREGATED_RESOURCE_DEMANDS_SERVICE_EXECUTION_CONTEXT); |
209 | childrenFeatures.add(AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__SENT_AGGREGATED_COMMUNICATIONS_SERVICE_EXECUTION_CONTEXT); |
210 | } |
211 | return childrenFeatures; |
212 | } |
213 | |
214 | /** |
215 | * <!-- begin-user-doc --> |
216 | * <!-- end-user-doc --> |
217 | * @generated |
218 | */ |
219 | @Override |
220 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
221 | // Check the type of the specified child object and return the proper feature to use for |
222 | // adding (see {@link AddCommand}) it as a child. |
223 | |
224 | return super.getChildFeature(object, child); |
225 | } |
226 | |
227 | /** |
228 | * This returns ServiceExecutionContext.gif. |
229 | * <!-- begin-user-doc --> |
230 | * <!-- end-user-doc --> |
231 | * @generated |
232 | */ |
233 | @Override |
234 | public Object getImage(Object object) { |
235 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ServiceExecutionContext")); |
236 | } |
237 | |
238 | /** |
239 | * This returns the label text for the adapted class. |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | @Override |
245 | public String getText(Object object) { |
246 | ServiceExecutionContext serviceExecutionContext = (ServiceExecutionContext)object; |
247 | return getString("_UI_ServiceExecutionContext_type") + " " + serviceExecutionContext.getGlobalExecutionFrequency(); |
248 | } |
249 | |
250 | /** |
251 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
252 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
253 | * <!-- begin-user-doc --> |
254 | * <!-- end-user-doc --> |
255 | * @generated |
256 | */ |
257 | @Override |
258 | public void notifyChanged(Notification notification) { |
259 | updateChildren(notification); |
260 | |
261 | switch (notification.getFeatureID(ServiceExecutionContext.class)) { |
262 | case AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__GLOBAL_EXECUTION_FREQUENCY: |
263 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
264 | return; |
265 | case AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__AGGREGATED_RESOURCE_DEMANDS_SERVICE_EXECUTION_CONTEXT: |
266 | case AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__SENT_AGGREGATED_COMMUNICATIONS_SERVICE_EXECUTION_CONTEXT: |
267 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
268 | return; |
269 | } |
270 | super.notifyChanged(notification); |
271 | } |
272 | |
273 | /** |
274 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
275 | * that can be created under this object. |
276 | * <!-- begin-user-doc --> |
277 | * <!-- end-user-doc --> |
278 | * @generated |
279 | */ |
280 | @Override |
281 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
282 | super.collectNewChildDescriptors(newChildDescriptors, object); |
283 | |
284 | newChildDescriptors.add |
285 | (createChildParameter |
286 | (AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__AGGREGATED_RESOURCE_DEMANDS_SERVICE_EXECUTION_CONTEXT, |
287 | AggregatedUsageContextFactory.eINSTANCE.createAggregatedResourceDemand())); |
288 | |
289 | newChildDescriptors.add |
290 | (createChildParameter |
291 | (AggregatedUsageContextPackage.Literals.SERVICE_EXECUTION_CONTEXT__SENT_AGGREGATED_COMMUNICATIONS_SERVICE_EXECUTION_CONTEXT, |
292 | AggregatedUsageContextFactory.eINSTANCE.createAggregatedCommunication())); |
293 | } |
294 | |
295 | /** |
296 | * Return the resource locator for this item provider's resources. |
297 | * <!-- begin-user-doc --> |
298 | * <!-- end-user-doc --> |
299 | * @generated |
300 | */ |
301 | @Override |
302 | public ResourceLocator getResourceLocator() { |
303 | return ContextEditPlugin.INSTANCE; |
304 | } |
305 | |
306 | } |