1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.provider; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.util.QMLContractAdapterFactory; |
10 | |
11 | import java.util.ArrayList; |
12 | import java.util.Collection; |
13 | |
14 | import org.eclipse.emf.common.notify.Adapter; |
15 | import org.eclipse.emf.common.notify.Notification; |
16 | import org.eclipse.emf.common.notify.Notifier; |
17 | |
18 | import org.eclipse.emf.edit.provider.ChangeNotifier; |
19 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
20 | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
21 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
22 | import org.eclipse.emf.edit.provider.IDisposable; |
23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
25 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
26 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
29 | |
30 | /** |
31 | * This is the factory that is used to provide the interfaces needed to support Viewers. |
32 | * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. |
33 | * The adapters also support Eclipse property sheets. |
34 | * Note that most of the adapters are shared among multiple instances. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class QMLContractItemProviderAdapterFactory extends QMLContractAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
40 | /** |
41 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | protected ComposedAdapterFactory parentAdapterFactory; |
47 | |
48 | /** |
49 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
55 | |
56 | /** |
57 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
63 | |
64 | /** |
65 | * This constructs an instance. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | public QMLContractItemProviderAdapterFactory() { |
71 | supportedTypes.add(IEditingDomainItemProvider.class); |
72 | supportedTypes.add(IStructuredItemContentProvider.class); |
73 | supportedTypes.add(ITreeItemContentProvider.class); |
74 | supportedTypes.add(IItemLabelProvider.class); |
75 | supportedTypes.add(IItemPropertySource.class); |
76 | } |
77 | |
78 | /** |
79 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.SimpleQMLContract} instances. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected SimpleQMLContractItemProvider simpleQMLContractItemProvider; |
85 | |
86 | /** |
87 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.SimpleQMLContract}. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | @Override |
93 | public Adapter createSimpleQMLContractAdapter() { |
94 | if (simpleQMLContractItemProvider == null) { |
95 | simpleQMLContractItemProvider = new SimpleQMLContractItemProvider(this); |
96 | } |
97 | |
98 | return simpleQMLContractItemProvider; |
99 | } |
100 | |
101 | /** |
102 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Percentile} instances. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected PercentileItemProvider percentileItemProvider; |
108 | |
109 | /** |
110 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Percentile}. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public Adapter createPercentileAdapter() { |
117 | if (percentileItemProvider == null) { |
118 | percentileItemProvider = new PercentileItemProvider(this); |
119 | } |
120 | |
121 | return percentileItemProvider; |
122 | } |
123 | |
124 | /** |
125 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Frequency} instances. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | protected FrequencyItemProvider frequencyItemProvider; |
131 | |
132 | /** |
133 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Frequency}. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Adapter createFrequencyAdapter() { |
140 | if (frequencyItemProvider == null) { |
141 | frequencyItemProvider = new FrequencyItemProvider(this); |
142 | } |
143 | |
144 | return frequencyItemProvider; |
145 | } |
146 | |
147 | /** |
148 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.RangeValue} instances. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | protected RangeValueItemProvider rangeValueItemProvider; |
154 | |
155 | /** |
156 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.RangeValue}. |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | public Adapter createRangeValueAdapter() { |
163 | if (rangeValueItemProvider == null) { |
164 | rangeValueItemProvider = new RangeValueItemProvider(this); |
165 | } |
166 | |
167 | return rangeValueItemProvider; |
168 | } |
169 | |
170 | /** |
171 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Mean} instances. |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | protected MeanItemProvider meanItemProvider; |
177 | |
178 | /** |
179 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Mean}. |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public Adapter createMeanAdapter() { |
186 | if (meanItemProvider == null) { |
187 | meanItemProvider = new MeanItemProvider(this); |
188 | } |
189 | |
190 | return meanItemProvider; |
191 | } |
192 | |
193 | /** |
194 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Variance} instances. |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | protected VarianceItemProvider varianceItemProvider; |
200 | |
201 | /** |
202 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Variance}. |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | public Adapter createVarianceAdapter() { |
209 | if (varianceItemProvider == null) { |
210 | varianceItemProvider = new VarianceItemProvider(this); |
211 | } |
212 | |
213 | return varianceItemProvider; |
214 | } |
215 | |
216 | /** |
217 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.NumericLiteral} instances. |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | protected NumericLiteralItemProvider numericLiteralItemProvider; |
223 | |
224 | /** |
225 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.NumericLiteral}. |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @Override |
231 | public Adapter createNumericLiteralAdapter() { |
232 | if (numericLiteralItemProvider == null) { |
233 | numericLiteralItemProvider = new NumericLiteralItemProvider(this); |
234 | } |
235 | |
236 | return numericLiteralItemProvider; |
237 | } |
238 | |
239 | /** |
240 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EnumLiteral} instances. |
241 | * <!-- begin-user-doc --> |
242 | * <!-- end-user-doc --> |
243 | * @generated |
244 | */ |
245 | protected EnumLiteralItemProvider enumLiteralItemProvider; |
246 | |
247 | /** |
248 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EnumLiteral}. |
249 | * <!-- begin-user-doc --> |
250 | * <!-- end-user-doc --> |
251 | * @generated |
252 | */ |
253 | @Override |
254 | public Adapter createEnumLiteralAdapter() { |
255 | if (enumLiteralItemProvider == null) { |
256 | enumLiteralItemProvider = new EnumLiteralItemProvider(this); |
257 | } |
258 | |
259 | return enumLiteralItemProvider; |
260 | } |
261 | |
262 | /** |
263 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.SetLiteral} instances. |
264 | * <!-- begin-user-doc --> |
265 | * <!-- end-user-doc --> |
266 | * @generated |
267 | */ |
268 | protected SetLiteralItemProvider setLiteralItemProvider; |
269 | |
270 | /** |
271 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.SetLiteral}. |
272 | * <!-- begin-user-doc --> |
273 | * <!-- end-user-doc --> |
274 | * @generated |
275 | */ |
276 | @Override |
277 | public Adapter createSetLiteralAdapter() { |
278 | if (setLiteralItemProvider == null) { |
279 | setLiteralItemProvider = new SetLiteralItemProvider(this); |
280 | } |
281 | |
282 | return setLiteralItemProvider; |
283 | } |
284 | |
285 | /** |
286 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.RefinedQMLContract} instances. |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | protected RefinedQMLContractItemProvider refinedQMLContractItemProvider; |
292 | |
293 | /** |
294 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.RefinedQMLContract}. |
295 | * <!-- begin-user-doc --> |
296 | * <!-- end-user-doc --> |
297 | * @generated |
298 | */ |
299 | @Override |
300 | public Adapter createRefinedQMLContractAdapter() { |
301 | if (refinedQMLContractItemProvider == null) { |
302 | refinedQMLContractItemProvider = new RefinedQMLContractItemProvider(this); |
303 | } |
304 | |
305 | return refinedQMLContractItemProvider; |
306 | } |
307 | |
308 | /** |
309 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Value} instances. |
310 | * <!-- begin-user-doc --> |
311 | * <!-- end-user-doc --> |
312 | * @generated |
313 | */ |
314 | protected ValueItemProvider valueItemProvider; |
315 | |
316 | /** |
317 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Value}. |
318 | * <!-- begin-user-doc --> |
319 | * <!-- end-user-doc --> |
320 | * @generated |
321 | */ |
322 | @Override |
323 | public Adapter createValueAdapter() { |
324 | if (valueItemProvider == null) { |
325 | valueItemProvider = new ValueItemProvider(this); |
326 | } |
327 | |
328 | return valueItemProvider; |
329 | } |
330 | |
331 | /** |
332 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Objective} instances. |
333 | * <!-- begin-user-doc --> |
334 | * <!-- end-user-doc --> |
335 | * @generated |
336 | */ |
337 | protected ObjectiveItemProvider objectiveItemProvider; |
338 | |
339 | /** |
340 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Objective}. |
341 | * <!-- begin-user-doc --> |
342 | * <!-- end-user-doc --> |
343 | * @generated |
344 | */ |
345 | @Override |
346 | public Adapter createObjectiveAdapter() { |
347 | if (objectiveItemProvider == null) { |
348 | objectiveItemProvider = new ObjectiveItemProvider(this); |
349 | } |
350 | |
351 | return objectiveItemProvider; |
352 | } |
353 | |
354 | /** |
355 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Constraint} instances. |
356 | * <!-- begin-user-doc --> |
357 | * <!-- end-user-doc --> |
358 | * @generated |
359 | */ |
360 | protected ConstraintItemProvider constraintItemProvider; |
361 | |
362 | /** |
363 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Constraint}. |
364 | * <!-- begin-user-doc --> |
365 | * <!-- end-user-doc --> |
366 | * @generated |
367 | */ |
368 | @Override |
369 | public Adapter createConstraintAdapter() { |
370 | if (constraintItemProvider == null) { |
371 | constraintItemProvider = new ConstraintItemProvider(this); |
372 | } |
373 | |
374 | return constraintItemProvider; |
375 | } |
376 | |
377 | /** |
378 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Restriction} instances. |
379 | * <!-- begin-user-doc --> |
380 | * <!-- end-user-doc --> |
381 | * @generated |
382 | */ |
383 | protected RestrictionItemProvider restrictionItemProvider; |
384 | |
385 | /** |
386 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Restriction}. |
387 | * <!-- begin-user-doc --> |
388 | * <!-- end-user-doc --> |
389 | * @generated |
390 | */ |
391 | @Override |
392 | public Adapter createRestrictionAdapter() { |
393 | if (restrictionItemProvider == null) { |
394 | restrictionItemProvider = new RestrictionItemProvider(this); |
395 | } |
396 | |
397 | return restrictionItemProvider; |
398 | } |
399 | |
400 | /** |
401 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Goal} instances. |
402 | * <!-- begin-user-doc --> |
403 | * <!-- end-user-doc --> |
404 | * @generated |
405 | */ |
406 | protected GoalItemProvider goalItemProvider; |
407 | |
408 | /** |
409 | * This creates an adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.Goal}. |
410 | * <!-- begin-user-doc --> |
411 | * <!-- end-user-doc --> |
412 | * @generated |
413 | */ |
414 | @Override |
415 | public Adapter createGoalAdapter() { |
416 | if (goalItemProvider == null) { |
417 | goalItemProvider = new GoalItemProvider(this); |
418 | } |
419 | |
420 | return goalItemProvider; |
421 | } |
422 | |
423 | /** |
424 | * This returns the root adapter factory that contains this factory. |
425 | * <!-- begin-user-doc --> |
426 | * <!-- end-user-doc --> |
427 | * @generated |
428 | */ |
429 | public ComposeableAdapterFactory getRootAdapterFactory() { |
430 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
431 | } |
432 | |
433 | /** |
434 | * This sets the composed adapter factory that contains this factory. |
435 | * <!-- begin-user-doc --> |
436 | * <!-- end-user-doc --> |
437 | * @generated |
438 | */ |
439 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
440 | this.parentAdapterFactory = parentAdapterFactory; |
441 | } |
442 | |
443 | /** |
444 | * <!-- begin-user-doc --> |
445 | * <!-- end-user-doc --> |
446 | * @generated |
447 | */ |
448 | @Override |
449 | public boolean isFactoryForType(Object type) { |
450 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
451 | } |
452 | |
453 | /** |
454 | * This implementation substitutes the factory itself as the key for the adapter. |
455 | * <!-- begin-user-doc --> |
456 | * <!-- end-user-doc --> |
457 | * @generated |
458 | */ |
459 | @Override |
460 | public Adapter adapt(Notifier notifier, Object type) { |
461 | return super.adapt(notifier, this); |
462 | } |
463 | |
464 | /** |
465 | * <!-- begin-user-doc --> |
466 | * <!-- end-user-doc --> |
467 | * @generated |
468 | */ |
469 | @Override |
470 | public Object adapt(Object object, Object type) { |
471 | if (isFactoryForType(type)) { |
472 | Object adapter = super.adapt(object, type); |
473 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
474 | return adapter; |
475 | } |
476 | } |
477 | |
478 | return null; |
479 | } |
480 | |
481 | /** |
482 | * This adds a listener. |
483 | * <!-- begin-user-doc --> |
484 | * <!-- end-user-doc --> |
485 | * @generated |
486 | */ |
487 | public void addListener(INotifyChangedListener notifyChangedListener) { |
488 | changeNotifier.addListener(notifyChangedListener); |
489 | } |
490 | |
491 | /** |
492 | * This removes a listener. |
493 | * <!-- begin-user-doc --> |
494 | * <!-- end-user-doc --> |
495 | * @generated |
496 | */ |
497 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
498 | changeNotifier.removeListener(notifyChangedListener); |
499 | } |
500 | |
501 | /** |
502 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
503 | * <!-- begin-user-doc --> |
504 | * <!-- end-user-doc --> |
505 | * @generated |
506 | */ |
507 | public void fireNotifyChanged(Notification notification) { |
508 | changeNotifier.fireNotifyChanged(notification); |
509 | |
510 | if (parentAdapterFactory != null) { |
511 | parentAdapterFactory.fireNotifyChanged(notification); |
512 | } |
513 | } |
514 | |
515 | /** |
516 | * This disposes all of the item providers created by this factory. |
517 | * <!-- begin-user-doc --> |
518 | * <!-- end-user-doc --> |
519 | * @generated |
520 | */ |
521 | public void dispose() { |
522 | if (simpleQMLContractItemProvider != null) simpleQMLContractItemProvider.dispose(); |
523 | if (percentileItemProvider != null) percentileItemProvider.dispose(); |
524 | if (frequencyItemProvider != null) frequencyItemProvider.dispose(); |
525 | if (rangeValueItemProvider != null) rangeValueItemProvider.dispose(); |
526 | if (meanItemProvider != null) meanItemProvider.dispose(); |
527 | if (varianceItemProvider != null) varianceItemProvider.dispose(); |
528 | if (numericLiteralItemProvider != null) numericLiteralItemProvider.dispose(); |
529 | if (enumLiteralItemProvider != null) enumLiteralItemProvider.dispose(); |
530 | if (setLiteralItemProvider != null) setLiteralItemProvider.dispose(); |
531 | if (refinedQMLContractItemProvider != null) refinedQMLContractItemProvider.dispose(); |
532 | if (valueItemProvider != null) valueItemProvider.dispose(); |
533 | if (objectiveItemProvider != null) objectiveItemProvider.dispose(); |
534 | if (constraintItemProvider != null) constraintItemProvider.dispose(); |
535 | if (restrictionItemProvider != null) restrictionItemProvider.dispose(); |
536 | if (goalItemProvider != null) goalItemProvider.dispose(); |
537 | } |
538 | |
539 | } |