1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.probfunction.provider; |
8 | |
9 | import java.util.ArrayList; |
10 | import java.util.Collection; |
11 | |
12 | import org.eclipse.emf.common.notify.Adapter; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.common.notify.Notifier; |
15 | import org.eclipse.emf.edit.provider.ChangeNotifier; |
16 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
18 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
19 | import org.eclipse.emf.edit.provider.IDisposable; |
20 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
21 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
22 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
23 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
24 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
25 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
26 | |
27 | import de.uka.ipd.sdq.probfunction.util.ProbfunctionAdapterFactory; |
28 | |
29 | /** |
30 | * This is the factory that is used to provide the interfaces needed to support Viewers. |
31 | * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. |
32 | * The adapters also support Eclipse property sheets. |
33 | * Note that most of the adapters are shared among multiple instances. |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @generated |
37 | */ |
38 | public class ProbfunctionItemProviderAdapterFactory extends ProbfunctionAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
39 | /** |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
45 | |
46 | /** |
47 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | protected ComposedAdapterFactory parentAdapterFactory; |
53 | |
54 | /** |
55 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
61 | |
62 | /** |
63 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
69 | |
70 | /** |
71 | * This constructs an instance. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public ProbfunctionItemProviderAdapterFactory() { |
77 | supportedTypes.add(IEditingDomainItemProvider.class); |
78 | supportedTypes.add(IStructuredItemContentProvider.class); |
79 | supportedTypes.add(ITreeItemContentProvider.class); |
80 | supportedTypes.add(IItemLabelProvider.class); |
81 | supportedTypes.add(IItemPropertySource.class); |
82 | } |
83 | |
84 | /** |
85 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.BoxedPDF} instances. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | protected BoxedPDFItemProvider boxedPDFItemProvider; |
91 | |
92 | /** |
93 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.BoxedPDF}. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | @Override |
99 | public Adapter createBoxedPDFAdapter() { |
100 | if (boxedPDFItemProvider == null) { |
101 | boxedPDFItemProvider = new BoxedPDFItemProvider(this); |
102 | } |
103 | |
104 | return boxedPDFItemProvider; |
105 | } |
106 | |
107 | /** |
108 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.ContinuousSample} instances. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | protected ContinuousSampleItemProvider continuousSampleItemProvider; |
114 | |
115 | /** |
116 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.ContinuousSample}. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public Adapter createContinuousSampleAdapter() { |
123 | if (continuousSampleItemProvider == null) { |
124 | continuousSampleItemProvider = new ContinuousSampleItemProvider(this); |
125 | } |
126 | |
127 | return continuousSampleItemProvider; |
128 | } |
129 | |
130 | /** |
131 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.ProbabilityMassFunction} instances. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | protected ProbabilityMassFunctionItemProvider probabilityMassFunctionItemProvider; |
137 | |
138 | /** |
139 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.ProbabilityMassFunction}. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public Adapter createProbabilityMassFunctionAdapter() { |
146 | if (probabilityMassFunctionItemProvider == null) { |
147 | probabilityMassFunctionItemProvider = new ProbabilityMassFunctionItemProvider(this); |
148 | } |
149 | |
150 | return probabilityMassFunctionItemProvider; |
151 | } |
152 | |
153 | /** |
154 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.Sample} instances. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | protected SampleItemProvider sampleItemProvider; |
160 | |
161 | /** |
162 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.Sample}. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public Adapter createSampleAdapter() { |
169 | if (sampleItemProvider == null) { |
170 | sampleItemProvider = new SampleItemProvider(this); |
171 | } |
172 | |
173 | return sampleItemProvider; |
174 | } |
175 | |
176 | /** |
177 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.SamplePDF} instances. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | protected SamplePDFItemProvider samplePDFItemProvider; |
183 | |
184 | /** |
185 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.SamplePDF}. |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | @Override |
191 | public Adapter createSamplePDFAdapter() { |
192 | if (samplePDFItemProvider == null) { |
193 | samplePDFItemProvider = new SamplePDFItemProvider(this); |
194 | } |
195 | |
196 | return samplePDFItemProvider; |
197 | } |
198 | |
199 | /** |
200 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.Complex} instances. |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | protected ComplexItemProvider complexItemProvider; |
206 | |
207 | /** |
208 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.Complex}. |
209 | * <!-- begin-user-doc --> |
210 | * <!-- end-user-doc --> |
211 | * @generated |
212 | */ |
213 | @Override |
214 | public Adapter createComplexAdapter() { |
215 | if (complexItemProvider == null) { |
216 | complexItemProvider = new ComplexItemProvider(this); |
217 | } |
218 | |
219 | return complexItemProvider; |
220 | } |
221 | |
222 | /** |
223 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.ExponentialDistribution} instances. |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | protected ExponentialDistributionItemProvider exponentialDistributionItemProvider; |
229 | |
230 | /** |
231 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.ExponentialDistribution}. |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | @Override |
237 | public Adapter createExponentialDistributionAdapter() { |
238 | if (exponentialDistributionItemProvider == null) { |
239 | exponentialDistributionItemProvider = new ExponentialDistributionItemProvider(this); |
240 | } |
241 | |
242 | return exponentialDistributionItemProvider; |
243 | } |
244 | |
245 | /** |
246 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.NormalDistribution} instances. |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | protected NormalDistributionItemProvider normalDistributionItemProvider; |
252 | |
253 | /** |
254 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.NormalDistribution}. |
255 | * <!-- begin-user-doc --> |
256 | * <!-- end-user-doc --> |
257 | * @generated |
258 | */ |
259 | @Override |
260 | public Adapter createNormalDistributionAdapter() { |
261 | if (normalDistributionItemProvider == null) { |
262 | normalDistributionItemProvider = new NormalDistributionItemProvider(this); |
263 | } |
264 | |
265 | return normalDistributionItemProvider; |
266 | } |
267 | |
268 | /** |
269 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.LognormalDistribution} instances. |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | protected LognormalDistributionItemProvider lognormalDistributionItemProvider; |
275 | |
276 | /** |
277 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.LognormalDistribution}. |
278 | * <!-- begin-user-doc --> |
279 | * <!-- end-user-doc --> |
280 | * @generated |
281 | */ |
282 | @Override |
283 | public Adapter createLognormalDistributionAdapter() { |
284 | if (lognormalDistributionItemProvider == null) { |
285 | lognormalDistributionItemProvider = new LognormalDistributionItemProvider(this); |
286 | } |
287 | |
288 | return lognormalDistributionItemProvider; |
289 | } |
290 | |
291 | /** |
292 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.probfunction.GammaDistribution} instances. |
293 | * <!-- begin-user-doc --> |
294 | * <!-- end-user-doc --> |
295 | * @generated |
296 | */ |
297 | protected GammaDistributionItemProvider gammaDistributionItemProvider; |
298 | |
299 | /** |
300 | * This creates an adapter for a {@link de.uka.ipd.sdq.probfunction.GammaDistribution}. |
301 | * <!-- begin-user-doc --> |
302 | * <!-- end-user-doc --> |
303 | * @generated |
304 | */ |
305 | @Override |
306 | public Adapter createGammaDistributionAdapter() { |
307 | if (gammaDistributionItemProvider == null) { |
308 | gammaDistributionItemProvider = new GammaDistributionItemProvider(this); |
309 | } |
310 | |
311 | return gammaDistributionItemProvider; |
312 | } |
313 | |
314 | /** |
315 | * This returns the root adapter factory that contains this factory. |
316 | * <!-- begin-user-doc --> |
317 | * <!-- end-user-doc --> |
318 | * @generated |
319 | */ |
320 | public ComposeableAdapterFactory getRootAdapterFactory() { |
321 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
322 | } |
323 | |
324 | /** |
325 | * This sets the composed adapter factory that contains this factory. |
326 | * <!-- begin-user-doc --> |
327 | * <!-- end-user-doc --> |
328 | * @generated |
329 | */ |
330 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
331 | this.parentAdapterFactory = parentAdapterFactory; |
332 | } |
333 | |
334 | /** |
335 | * <!-- begin-user-doc --> |
336 | * <!-- end-user-doc --> |
337 | * @generated |
338 | */ |
339 | @Override |
340 | public boolean isFactoryForType(Object type) { |
341 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
342 | } |
343 | |
344 | /** |
345 | * This implementation substitutes the factory itself as the key for the adapter. |
346 | * <!-- begin-user-doc --> |
347 | * <!-- end-user-doc --> |
348 | * @generated |
349 | */ |
350 | @Override |
351 | public Adapter adapt(Notifier notifier, Object type) { |
352 | return super.adapt(notifier, this); |
353 | } |
354 | |
355 | /** |
356 | * <!-- begin-user-doc --> |
357 | * <!-- end-user-doc --> |
358 | * @generated |
359 | */ |
360 | @Override |
361 | public Object adapt(Object object, Object type) { |
362 | if (isFactoryForType(type)) { |
363 | Object adapter = super.adapt(object, type); |
364 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
365 | return adapter; |
366 | } |
367 | } |
368 | |
369 | return null; |
370 | } |
371 | |
372 | /** |
373 | * This adds a listener. |
374 | * <!-- begin-user-doc --> |
375 | * <!-- end-user-doc --> |
376 | * @generated |
377 | */ |
378 | public void addListener(INotifyChangedListener notifyChangedListener) { |
379 | changeNotifier.addListener(notifyChangedListener); |
380 | } |
381 | |
382 | /** |
383 | * This removes a listener. |
384 | * <!-- begin-user-doc --> |
385 | * <!-- end-user-doc --> |
386 | * @generated |
387 | */ |
388 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
389 | changeNotifier.removeListener(notifyChangedListener); |
390 | } |
391 | |
392 | /** |
393 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
394 | * <!-- begin-user-doc --> |
395 | * <!-- end-user-doc --> |
396 | * @generated |
397 | */ |
398 | public void fireNotifyChanged(Notification notification) { |
399 | changeNotifier.fireNotifyChanged(notification); |
400 | |
401 | if (parentAdapterFactory != null) { |
402 | parentAdapterFactory.fireNotifyChanged(notification); |
403 | } |
404 | } |
405 | |
406 | /** |
407 | * This disposes all of the item providers created by this factory. |
408 | * <!-- begin-user-doc --> |
409 | * <!-- end-user-doc --> |
410 | * @generated |
411 | */ |
412 | public void dispose() { |
413 | if (boxedPDFItemProvider != null) boxedPDFItemProvider.dispose(); |
414 | if (continuousSampleItemProvider != null) continuousSampleItemProvider.dispose(); |
415 | if (probabilityMassFunctionItemProvider != null) probabilityMassFunctionItemProvider.dispose(); |
416 | if (sampleItemProvider != null) sampleItemProvider.dispose(); |
417 | if (samplePDFItemProvider != null) samplePDFItemProvider.dispose(); |
418 | if (complexItemProvider != null) complexItemProvider.dispose(); |
419 | if (exponentialDistributionItemProvider != null) exponentialDistributionItemProvider.dispose(); |
420 | if (normalDistributionItemProvider != null) normalDistributionItemProvider.dispose(); |
421 | if (lognormalDistributionItemProvider != null) lognormalDistributionItemProvider.dispose(); |
422 | if (gammaDistributionItemProvider != null) gammaDistributionItemProvider.dispose(); |
423 | } |
424 | |
425 | } |