1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.usagemodel.provider; |
7 | |
8 | import java.util.ArrayList; |
9 | import java.util.Collection; |
10 | |
11 | import org.eclipse.emf.common.notify.Adapter; |
12 | import org.eclipse.emf.common.notify.Notification; |
13 | import org.eclipse.emf.common.notify.Notifier; |
14 | import org.eclipse.emf.edit.provider.ChangeNotifier; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
18 | import org.eclipse.emf.edit.provider.IDisposable; |
19 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
20 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
21 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
22 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
23 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
24 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
25 | |
26 | import de.uka.ipd.sdq.pcm.usagemodel.util.UsagemodelAdapterFactory; |
27 | |
28 | /** |
29 | * This is the factory that is used to provide the interfaces needed to support Viewers. |
30 | * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. |
31 | * The adapters also support Eclipse property sheets. |
32 | * Note that most of the adapters are shared among multiple instances. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class UsagemodelItemProviderAdapterFactory extends UsagemodelAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
44 | |
45 | /** |
46 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | protected ComposedAdapterFactory parentAdapterFactory; |
52 | |
53 | /** |
54 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
60 | |
61 | /** |
62 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
68 | |
69 | /** |
70 | * This constructs an instance. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | public UsagemodelItemProviderAdapterFactory() { |
76 | supportedTypes.add(IEditingDomainItemProvider.class); |
77 | supportedTypes.add(IStructuredItemContentProvider.class); |
78 | supportedTypes.add(ITreeItemContentProvider.class); |
79 | supportedTypes.add(IItemLabelProvider.class); |
80 | supportedTypes.add(IItemPropertySource.class); |
81 | } |
82 | |
83 | /** |
84 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.UsageScenario} instances. |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | protected UsageScenarioItemProvider usageScenarioItemProvider; |
90 | |
91 | /** |
92 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.UsageScenario}. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | public Adapter createUsageScenarioAdapter() { |
99 | if (usageScenarioItemProvider == null) { |
100 | usageScenarioItemProvider = new UsageScenarioItemProvider(this); |
101 | } |
102 | |
103 | return usageScenarioItemProvider; |
104 | } |
105 | |
106 | /** |
107 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.UserData} instances. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | protected UserDataItemProvider userDataItemProvider; |
113 | |
114 | /** |
115 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.UserData}. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | public Adapter createUserDataAdapter() { |
122 | if (userDataItemProvider == null) { |
123 | userDataItemProvider = new UserDataItemProvider(this); |
124 | } |
125 | |
126 | return userDataItemProvider; |
127 | } |
128 | |
129 | /** |
130 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.UsageModel} instances. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | protected UsageModelItemProvider usageModelItemProvider; |
136 | |
137 | /** |
138 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.UsageModel}. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public Adapter createUsageModelAdapter() { |
145 | if (usageModelItemProvider == null) { |
146 | usageModelItemProvider = new UsageModelItemProvider(this); |
147 | } |
148 | |
149 | return usageModelItemProvider; |
150 | } |
151 | |
152 | /** |
153 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.EntryLevelSystemCall} instances. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | protected EntryLevelSystemCallItemProvider entryLevelSystemCallItemProvider; |
159 | |
160 | /** |
161 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.EntryLevelSystemCall}. |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | @Override |
167 | public Adapter createEntryLevelSystemCallAdapter() { |
168 | if (entryLevelSystemCallItemProvider == null) { |
169 | entryLevelSystemCallItemProvider = new EntryLevelSystemCallItemProvider(this); |
170 | } |
171 | |
172 | return entryLevelSystemCallItemProvider; |
173 | } |
174 | |
175 | /** |
176 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour} instances. |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | protected ScenarioBehaviourItemProvider scenarioBehaviourItemProvider; |
182 | |
183 | /** |
184 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour}. |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | @Override |
190 | public Adapter createScenarioBehaviourAdapter() { |
191 | if (scenarioBehaviourItemProvider == null) { |
192 | scenarioBehaviourItemProvider = new ScenarioBehaviourItemProvider(this); |
193 | } |
194 | |
195 | return scenarioBehaviourItemProvider; |
196 | } |
197 | |
198 | /** |
199 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.BranchTransition} instances. |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | protected BranchTransitionItemProvider branchTransitionItemProvider; |
205 | |
206 | /** |
207 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.BranchTransition}. |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public Adapter createBranchTransitionAdapter() { |
214 | if (branchTransitionItemProvider == null) { |
215 | branchTransitionItemProvider = new BranchTransitionItemProvider(this); |
216 | } |
217 | |
218 | return branchTransitionItemProvider; |
219 | } |
220 | |
221 | /** |
222 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.Branch} instances. |
223 | * <!-- begin-user-doc --> |
224 | * <!-- end-user-doc --> |
225 | * @generated |
226 | */ |
227 | protected BranchItemProvider branchItemProvider; |
228 | |
229 | /** |
230 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.Branch}. |
231 | * <!-- begin-user-doc --> |
232 | * <!-- end-user-doc --> |
233 | * @generated |
234 | */ |
235 | @Override |
236 | public Adapter createBranchAdapter() { |
237 | if (branchItemProvider == null) { |
238 | branchItemProvider = new BranchItemProvider(this); |
239 | } |
240 | |
241 | return branchItemProvider; |
242 | } |
243 | |
244 | /** |
245 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.Loop} instances. |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | protected LoopItemProvider loopItemProvider; |
251 | |
252 | /** |
253 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.Loop}. |
254 | * <!-- begin-user-doc --> |
255 | * <!-- end-user-doc --> |
256 | * @generated |
257 | */ |
258 | @Override |
259 | public Adapter createLoopAdapter() { |
260 | if (loopItemProvider == null) { |
261 | loopItemProvider = new LoopItemProvider(this); |
262 | } |
263 | |
264 | return loopItemProvider; |
265 | } |
266 | |
267 | /** |
268 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.Stop} instances. |
269 | * <!-- begin-user-doc --> |
270 | * <!-- end-user-doc --> |
271 | * @generated |
272 | */ |
273 | protected StopItemProvider stopItemProvider; |
274 | |
275 | /** |
276 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.Stop}. |
277 | * <!-- begin-user-doc --> |
278 | * <!-- end-user-doc --> |
279 | * @generated |
280 | */ |
281 | @Override |
282 | public Adapter createStopAdapter() { |
283 | if (stopItemProvider == null) { |
284 | stopItemProvider = new StopItemProvider(this); |
285 | } |
286 | |
287 | return stopItemProvider; |
288 | } |
289 | |
290 | /** |
291 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.Start} instances. |
292 | * <!-- begin-user-doc --> |
293 | * <!-- end-user-doc --> |
294 | * @generated |
295 | */ |
296 | protected StartItemProvider startItemProvider; |
297 | |
298 | /** |
299 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.Start}. |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | @Override |
305 | public Adapter createStartAdapter() { |
306 | if (startItemProvider == null) { |
307 | startItemProvider = new StartItemProvider(this); |
308 | } |
309 | |
310 | return startItemProvider; |
311 | } |
312 | |
313 | /** |
314 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.OpenWorkload} instances. |
315 | * <!-- begin-user-doc --> |
316 | * <!-- end-user-doc --> |
317 | * @generated |
318 | */ |
319 | protected OpenWorkloadItemProvider openWorkloadItemProvider; |
320 | |
321 | /** |
322 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.OpenWorkload}. |
323 | * <!-- begin-user-doc --> |
324 | * <!-- end-user-doc --> |
325 | * @generated |
326 | */ |
327 | @Override |
328 | public Adapter createOpenWorkloadAdapter() { |
329 | if (openWorkloadItemProvider == null) { |
330 | openWorkloadItemProvider = new OpenWorkloadItemProvider(this); |
331 | } |
332 | |
333 | return openWorkloadItemProvider; |
334 | } |
335 | |
336 | /** |
337 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.Delay} instances. |
338 | * <!-- begin-user-doc --> |
339 | * <!-- end-user-doc --> |
340 | * @generated |
341 | */ |
342 | protected DelayItemProvider delayItemProvider; |
343 | |
344 | /** |
345 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.Delay}. |
346 | * <!-- begin-user-doc --> |
347 | * <!-- end-user-doc --> |
348 | * @generated |
349 | */ |
350 | @Override |
351 | public Adapter createDelayAdapter() { |
352 | if (delayItemProvider == null) { |
353 | delayItemProvider = new DelayItemProvider(this); |
354 | } |
355 | |
356 | return delayItemProvider; |
357 | } |
358 | |
359 | /** |
360 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.usagemodel.ClosedWorkload} instances. |
361 | * <!-- begin-user-doc --> |
362 | * <!-- end-user-doc --> |
363 | * @generated |
364 | */ |
365 | protected ClosedWorkloadItemProvider closedWorkloadItemProvider; |
366 | |
367 | /** |
368 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.usagemodel.ClosedWorkload}. |
369 | * <!-- begin-user-doc --> |
370 | * <!-- end-user-doc --> |
371 | * @generated |
372 | */ |
373 | @Override |
374 | public Adapter createClosedWorkloadAdapter() { |
375 | if (closedWorkloadItemProvider == null) { |
376 | closedWorkloadItemProvider = new ClosedWorkloadItemProvider(this); |
377 | } |
378 | |
379 | return closedWorkloadItemProvider; |
380 | } |
381 | |
382 | /** |
383 | * This returns the root adapter factory that contains this factory. |
384 | * <!-- begin-user-doc --> |
385 | * <!-- end-user-doc --> |
386 | * @generated |
387 | */ |
388 | public ComposeableAdapterFactory getRootAdapterFactory() { |
389 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
390 | } |
391 | |
392 | /** |
393 | * This sets the composed adapter factory that contains this factory. |
394 | * <!-- begin-user-doc --> |
395 | * <!-- end-user-doc --> |
396 | * @generated |
397 | */ |
398 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
399 | this.parentAdapterFactory = parentAdapterFactory; |
400 | } |
401 | |
402 | /** |
403 | * <!-- begin-user-doc --> |
404 | * <!-- end-user-doc --> |
405 | * @generated |
406 | */ |
407 | @Override |
408 | public boolean isFactoryForType(Object type) { |
409 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
410 | } |
411 | |
412 | /** |
413 | * This implementation substitutes the factory itself as the key for the adapter. |
414 | * <!-- begin-user-doc --> |
415 | * <!-- end-user-doc --> |
416 | * @generated |
417 | */ |
418 | @Override |
419 | public Adapter adapt(Notifier notifier, Object type) { |
420 | return super.adapt(notifier, this); |
421 | } |
422 | |
423 | /** |
424 | * <!-- begin-user-doc --> |
425 | * <!-- end-user-doc --> |
426 | * @generated |
427 | */ |
428 | @Override |
429 | public Object adapt(Object object, Object type) { |
430 | if (isFactoryForType(type)) { |
431 | Object adapter = super.adapt(object, type); |
432 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
433 | return adapter; |
434 | } |
435 | } |
436 | |
437 | return null; |
438 | } |
439 | |
440 | /** |
441 | * This adds a listener. |
442 | * <!-- begin-user-doc --> |
443 | * <!-- end-user-doc --> |
444 | * @generated |
445 | */ |
446 | public void addListener(INotifyChangedListener notifyChangedListener) { |
447 | changeNotifier.addListener(notifyChangedListener); |
448 | } |
449 | |
450 | /** |
451 | * This removes a listener. |
452 | * <!-- begin-user-doc --> |
453 | * <!-- end-user-doc --> |
454 | * @generated |
455 | */ |
456 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
457 | changeNotifier.removeListener(notifyChangedListener); |
458 | } |
459 | |
460 | /** |
461 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
462 | * <!-- begin-user-doc --> |
463 | * <!-- end-user-doc --> |
464 | * @generated |
465 | */ |
466 | public void fireNotifyChanged(Notification notification) { |
467 | changeNotifier.fireNotifyChanged(notification); |
468 | |
469 | if (parentAdapterFactory != null) { |
470 | parentAdapterFactory.fireNotifyChanged(notification); |
471 | } |
472 | } |
473 | |
474 | /** |
475 | * This disposes all of the item providers created by this factory. |
476 | * <!-- begin-user-doc --> |
477 | * <!-- end-user-doc --> |
478 | * @generated |
479 | */ |
480 | public void dispose() { |
481 | if (usageScenarioItemProvider != null) usageScenarioItemProvider.dispose(); |
482 | if (userDataItemProvider != null) userDataItemProvider.dispose(); |
483 | if (usageModelItemProvider != null) usageModelItemProvider.dispose(); |
484 | if (entryLevelSystemCallItemProvider != null) entryLevelSystemCallItemProvider.dispose(); |
485 | if (scenarioBehaviourItemProvider != null) scenarioBehaviourItemProvider.dispose(); |
486 | if (branchTransitionItemProvider != null) branchTransitionItemProvider.dispose(); |
487 | if (branchItemProvider != null) branchItemProvider.dispose(); |
488 | if (loopItemProvider != null) loopItemProvider.dispose(); |
489 | if (stopItemProvider != null) stopItemProvider.dispose(); |
490 | if (startItemProvider != null) startItemProvider.dispose(); |
491 | if (openWorkloadItemProvider != null) openWorkloadItemProvider.dispose(); |
492 | if (delayItemProvider != null) delayItemProvider.dispose(); |
493 | if (closedWorkloadItemProvider != null) closedWorkloadItemProvider.dispose(); |
494 | } |
495 | |
496 | } |