1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.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.featuremodel.util.featuremodelAdapterFactory; |
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 featuremodelItemProviderAdapterFactory extends featuremodelAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
39 | /** |
40 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @generated |
44 | */ |
45 | protected ComposedAdapterFactory parentAdapterFactory; |
46 | |
47 | /** |
48 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
54 | |
55 | /** |
56 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
62 | |
63 | /** |
64 | * This constructs an instance. |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | public featuremodelItemProviderAdapterFactory() { |
70 | supportedTypes.add(IEditingDomainItemProvider.class); |
71 | supportedTypes.add(IStructuredItemContentProvider.class); |
72 | supportedTypes.add(ITreeItemContentProvider.class); |
73 | supportedTypes.add(IItemLabelProvider.class); |
74 | supportedTypes.add(IItemPropertySource.class); |
75 | } |
76 | |
77 | /** |
78 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.Feature} instances. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected FeatureItemProvider featureItemProvider; |
84 | |
85 | /** |
86 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.Feature}. |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | @Override |
92 | public Adapter createFeatureAdapter() { |
93 | if (featureItemProvider == null) { |
94 | featureItemProvider = new FeatureItemProvider(this); |
95 | } |
96 | |
97 | return featureItemProvider; |
98 | } |
99 | |
100 | /** |
101 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.Simple} instances. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | protected SimpleItemProvider simpleItemProvider; |
107 | |
108 | /** |
109 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.Simple}. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public Adapter createSimpleAdapter() { |
116 | if (simpleItemProvider == null) { |
117 | simpleItemProvider = new SimpleItemProvider(this); |
118 | } |
119 | |
120 | return simpleItemProvider; |
121 | } |
122 | |
123 | /** |
124 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.FeatureGroup} instances. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | protected FeatureGroupItemProvider featureGroupItemProvider; |
130 | |
131 | /** |
132 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.FeatureGroup}. |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | public Adapter createFeatureGroupAdapter() { |
139 | if (featureGroupItemProvider == null) { |
140 | featureGroupItemProvider = new FeatureGroupItemProvider(this); |
141 | } |
142 | |
143 | return featureGroupItemProvider; |
144 | } |
145 | |
146 | /** |
147 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.FeatureDiagram} instances. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | protected FeatureDiagramItemProvider featureDiagramItemProvider; |
153 | |
154 | /** |
155 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.FeatureDiagram}. |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | public Adapter createFeatureDiagramAdapter() { |
162 | if (featureDiagramItemProvider == null) { |
163 | featureDiagramItemProvider = new FeatureDiagramItemProvider(this); |
164 | } |
165 | |
166 | return featureDiagramItemProvider; |
167 | } |
168 | |
169 | /** |
170 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.RequiredConstraint} instances. |
171 | * <!-- begin-user-doc --> |
172 | * <!-- end-user-doc --> |
173 | * @generated |
174 | */ |
175 | protected RequiredConstraintItemProvider requiredConstraintItemProvider; |
176 | |
177 | /** |
178 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.RequiredConstraint}. |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public Adapter createRequiredConstraintAdapter() { |
185 | if (requiredConstraintItemProvider == null) { |
186 | requiredConstraintItemProvider = new RequiredConstraintItemProvider(this); |
187 | } |
188 | |
189 | return requiredConstraintItemProvider; |
190 | } |
191 | |
192 | /** |
193 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.ProhibitsConstraint} instances. |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | protected ProhibitsConstraintItemProvider prohibitsConstraintItemProvider; |
199 | |
200 | /** |
201 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.ProhibitsConstraint}. |
202 | * <!-- begin-user-doc --> |
203 | * <!-- end-user-doc --> |
204 | * @generated |
205 | */ |
206 | @Override |
207 | public Adapter createProhibitsConstraintAdapter() { |
208 | if (prohibitsConstraintItemProvider == null) { |
209 | prohibitsConstraintItemProvider = new ProhibitsConstraintItemProvider(this); |
210 | } |
211 | |
212 | return prohibitsConstraintItemProvider; |
213 | } |
214 | |
215 | /** |
216 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.IntegerIntervalRange} instances. |
217 | * <!-- begin-user-doc --> |
218 | * <!-- end-user-doc --> |
219 | * @generated |
220 | */ |
221 | protected IntegerIntervalRangeItemProvider integerIntervalRangeItemProvider; |
222 | |
223 | /** |
224 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.IntegerIntervalRange}. |
225 | * <!-- begin-user-doc --> |
226 | * <!-- end-user-doc --> |
227 | * @generated |
228 | */ |
229 | @Override |
230 | public Adapter createIntegerIntervalRangeAdapter() { |
231 | if (integerIntervalRangeItemProvider == null) { |
232 | integerIntervalRangeItemProvider = new IntegerIntervalRangeItemProvider(this); |
233 | } |
234 | |
235 | return integerIntervalRangeItemProvider; |
236 | } |
237 | |
238 | /** |
239 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.ContinousIntervalRange} instances. |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | protected ContinousIntervalRangeItemProvider continousIntervalRangeItemProvider; |
245 | |
246 | /** |
247 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.ContinousIntervalRange}. |
248 | * <!-- begin-user-doc --> |
249 | * <!-- end-user-doc --> |
250 | * @generated |
251 | */ |
252 | @Override |
253 | public Adapter createContinousIntervalRangeAdapter() { |
254 | if (continousIntervalRangeItemProvider == null) { |
255 | continousIntervalRangeItemProvider = new ContinousIntervalRangeItemProvider(this); |
256 | } |
257 | |
258 | return continousIntervalRangeItemProvider; |
259 | } |
260 | |
261 | /** |
262 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.IntegerAttribute} instances. |
263 | * <!-- begin-user-doc --> |
264 | * <!-- end-user-doc --> |
265 | * @generated |
266 | */ |
267 | protected IntegerAttributeItemProvider integerAttributeItemProvider; |
268 | |
269 | /** |
270 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.IntegerAttribute}. |
271 | * <!-- begin-user-doc --> |
272 | * <!-- end-user-doc --> |
273 | * @generated |
274 | */ |
275 | @Override |
276 | public Adapter createIntegerAttributeAdapter() { |
277 | if (integerAttributeItemProvider == null) { |
278 | integerAttributeItemProvider = new IntegerAttributeItemProvider(this); |
279 | } |
280 | |
281 | return integerAttributeItemProvider; |
282 | } |
283 | |
284 | /** |
285 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.DoubleAttribute} instances. |
286 | * <!-- begin-user-doc --> |
287 | * <!-- end-user-doc --> |
288 | * @generated |
289 | */ |
290 | protected DoubleAttributeItemProvider doubleAttributeItemProvider; |
291 | |
292 | /** |
293 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.DoubleAttribute}. |
294 | * <!-- begin-user-doc --> |
295 | * <!-- end-user-doc --> |
296 | * @generated |
297 | */ |
298 | @Override |
299 | public Adapter createDoubleAttributeAdapter() { |
300 | if (doubleAttributeItemProvider == null) { |
301 | doubleAttributeItemProvider = new DoubleAttributeItemProvider(this); |
302 | } |
303 | |
304 | return doubleAttributeItemProvider; |
305 | } |
306 | |
307 | /** |
308 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.StringAttribute} instances. |
309 | * <!-- begin-user-doc --> |
310 | * <!-- end-user-doc --> |
311 | * @generated |
312 | */ |
313 | protected StringAttributeItemProvider stringAttributeItemProvider; |
314 | |
315 | /** |
316 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.StringAttribute}. |
317 | * <!-- begin-user-doc --> |
318 | * <!-- end-user-doc --> |
319 | * @generated |
320 | */ |
321 | @Override |
322 | public Adapter createStringAttributeAdapter() { |
323 | if (stringAttributeItemProvider == null) { |
324 | stringAttributeItemProvider = new StringAttributeItemProvider(this); |
325 | } |
326 | |
327 | return stringAttributeItemProvider; |
328 | } |
329 | |
330 | /** |
331 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featuremodel.ExternalObjectAttribute} instances. |
332 | * <!-- begin-user-doc --> |
333 | * <!-- end-user-doc --> |
334 | * @generated |
335 | */ |
336 | protected ExternalObjectAttributeItemProvider externalObjectAttributeItemProvider; |
337 | |
338 | /** |
339 | * This creates an adapter for a {@link de.uka.ipd.sdq.featuremodel.ExternalObjectAttribute}. |
340 | * <!-- begin-user-doc --> |
341 | * <!-- end-user-doc --> |
342 | * @generated |
343 | */ |
344 | @Override |
345 | public Adapter createExternalObjectAttributeAdapter() { |
346 | if (externalObjectAttributeItemProvider == null) { |
347 | externalObjectAttributeItemProvider = new ExternalObjectAttributeItemProvider(this); |
348 | } |
349 | |
350 | return externalObjectAttributeItemProvider; |
351 | } |
352 | |
353 | /** |
354 | * This returns the root adapter factory that contains this factory. |
355 | * <!-- begin-user-doc --> |
356 | * <!-- end-user-doc --> |
357 | * @generated |
358 | */ |
359 | public ComposeableAdapterFactory getRootAdapterFactory() { |
360 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
361 | } |
362 | |
363 | /** |
364 | * This sets the composed adapter factory that contains this factory. |
365 | * <!-- begin-user-doc --> |
366 | * <!-- end-user-doc --> |
367 | * @generated |
368 | */ |
369 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
370 | this.parentAdapterFactory = parentAdapterFactory; |
371 | } |
372 | |
373 | /** |
374 | * <!-- begin-user-doc --> |
375 | * <!-- end-user-doc --> |
376 | * @generated |
377 | */ |
378 | @Override |
379 | public boolean isFactoryForType(Object type) { |
380 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
381 | } |
382 | |
383 | /** |
384 | * This implementation substitutes the factory itself as the key for the adapter. |
385 | * <!-- begin-user-doc --> |
386 | * <!-- end-user-doc --> |
387 | * @generated |
388 | */ |
389 | @Override |
390 | public Adapter adapt(Notifier notifier, Object type) { |
391 | return super.adapt(notifier, this); |
392 | } |
393 | |
394 | /** |
395 | * <!-- begin-user-doc --> |
396 | * <!-- end-user-doc --> |
397 | * @generated |
398 | */ |
399 | @Override |
400 | public Object adapt(Object object, Object type) { |
401 | if (isFactoryForType(type)) { |
402 | Object adapter = super.adapt(object, type); |
403 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
404 | return adapter; |
405 | } |
406 | } |
407 | |
408 | return null; |
409 | } |
410 | |
411 | /** |
412 | * This adds a listener. |
413 | * <!-- begin-user-doc --> |
414 | * <!-- end-user-doc --> |
415 | * @generated |
416 | */ |
417 | public void addListener(INotifyChangedListener notifyChangedListener) { |
418 | changeNotifier.addListener(notifyChangedListener); |
419 | } |
420 | |
421 | /** |
422 | * This removes a listener. |
423 | * <!-- begin-user-doc --> |
424 | * <!-- end-user-doc --> |
425 | * @generated |
426 | */ |
427 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
428 | changeNotifier.removeListener(notifyChangedListener); |
429 | } |
430 | |
431 | /** |
432 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
433 | * <!-- begin-user-doc --> |
434 | * <!-- end-user-doc --> |
435 | * @generated |
436 | */ |
437 | public void fireNotifyChanged(Notification notification) { |
438 | changeNotifier.fireNotifyChanged(notification); |
439 | |
440 | if (parentAdapterFactory != null) { |
441 | parentAdapterFactory.fireNotifyChanged(notification); |
442 | } |
443 | } |
444 | |
445 | /** |
446 | * This disposes all of the item providers created by this factory. |
447 | * <!-- begin-user-doc --> |
448 | * <!-- end-user-doc --> |
449 | * @generated |
450 | */ |
451 | public void dispose() { |
452 | if (featureItemProvider != null) featureItemProvider.dispose(); |
453 | if (simpleItemProvider != null) simpleItemProvider.dispose(); |
454 | if (featureGroupItemProvider != null) featureGroupItemProvider.dispose(); |
455 | if (featureDiagramItemProvider != null) featureDiagramItemProvider.dispose(); |
456 | if (requiredConstraintItemProvider != null) requiredConstraintItemProvider.dispose(); |
457 | if (prohibitsConstraintItemProvider != null) prohibitsConstraintItemProvider.dispose(); |
458 | if (integerIntervalRangeItemProvider != null) integerIntervalRangeItemProvider.dispose(); |
459 | if (continousIntervalRangeItemProvider != null) continousIntervalRangeItemProvider.dispose(); |
460 | if (integerAttributeItemProvider != null) integerAttributeItemProvider.dispose(); |
461 | if (doubleAttributeItemProvider != null) doubleAttributeItemProvider.dispose(); |
462 | if (stringAttributeItemProvider != null) stringAttributeItemProvider.dispose(); |
463 | if (externalObjectAttributeItemProvider != null) externalObjectAttributeItemProvider.dispose(); |
464 | } |
465 | |
466 | } |