1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featureconfig.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.featureconfig.util.featureconfigAdapterFactory; |
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 featureconfigItemProviderAdapterFactory extends featureconfigAdapterFactory 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 featureconfigItemProviderAdapterFactory() { |
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.featureconfig.ConfigNode} instances. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | protected ConfigNodeItemProvider configNodeItemProvider; |
84 | |
85 | /** |
86 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.ConfigNode}. |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | @Override |
92 | public Adapter createConfigNodeAdapter() { |
93 | if (configNodeItemProvider == null) { |
94 | configNodeItemProvider = new ConfigNodeItemProvider(this); |
95 | } |
96 | |
97 | return configNodeItemProvider; |
98 | } |
99 | |
100 | /** |
101 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.FeatureConfig} instances. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | protected FeatureConfigItemProvider featureConfigItemProvider; |
107 | |
108 | /** |
109 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.FeatureConfig}. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public Adapter createFeatureConfigAdapter() { |
116 | if (featureConfigItemProvider == null) { |
117 | featureConfigItemProvider = new FeatureConfigItemProvider(this); |
118 | } |
119 | |
120 | return featureConfigItemProvider; |
121 | } |
122 | |
123 | /** |
124 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.Configuration} instances. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | protected ConfigurationItemProvider configurationItemProvider; |
130 | |
131 | /** |
132 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.Configuration}. |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | public Adapter createConfigurationAdapter() { |
139 | if (configurationItemProvider == null) { |
140 | configurationItemProvider = new ConfigurationItemProvider(this); |
141 | } |
142 | |
143 | return configurationItemProvider; |
144 | } |
145 | |
146 | /** |
147 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.IntegerAttributeValue} instances. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | protected IntegerAttributeValueItemProvider integerAttributeValueItemProvider; |
153 | |
154 | /** |
155 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.IntegerAttributeValue}. |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | public Adapter createIntegerAttributeValueAdapter() { |
162 | if (integerAttributeValueItemProvider == null) { |
163 | integerAttributeValueItemProvider = new IntegerAttributeValueItemProvider(this); |
164 | } |
165 | |
166 | return integerAttributeValueItemProvider; |
167 | } |
168 | |
169 | /** |
170 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.DoubleAttributeValue} instances. |
171 | * <!-- begin-user-doc --> |
172 | * <!-- end-user-doc --> |
173 | * @generated |
174 | */ |
175 | protected DoubleAttributeValueItemProvider doubleAttributeValueItemProvider; |
176 | |
177 | /** |
178 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.DoubleAttributeValue}. |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public Adapter createDoubleAttributeValueAdapter() { |
185 | if (doubleAttributeValueItemProvider == null) { |
186 | doubleAttributeValueItemProvider = new DoubleAttributeValueItemProvider(this); |
187 | } |
188 | |
189 | return doubleAttributeValueItemProvider; |
190 | } |
191 | |
192 | /** |
193 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.StringAttributeValue} instances. |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | protected StringAttributeValueItemProvider stringAttributeValueItemProvider; |
199 | |
200 | /** |
201 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.StringAttributeValue}. |
202 | * <!-- begin-user-doc --> |
203 | * <!-- end-user-doc --> |
204 | * @generated |
205 | */ |
206 | @Override |
207 | public Adapter createStringAttributeValueAdapter() { |
208 | if (stringAttributeValueItemProvider == null) { |
209 | stringAttributeValueItemProvider = new StringAttributeValueItemProvider(this); |
210 | } |
211 | |
212 | return stringAttributeValueItemProvider; |
213 | } |
214 | |
215 | /** |
216 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.featureconfig.ExternalObjectAttributeValue} instances. |
217 | * <!-- begin-user-doc --> |
218 | * <!-- end-user-doc --> |
219 | * @generated |
220 | */ |
221 | protected ExternalObjectAttributeValueItemProvider externalObjectAttributeValueItemProvider; |
222 | |
223 | /** |
224 | * This creates an adapter for a {@link de.uka.ipd.sdq.featureconfig.ExternalObjectAttributeValue}. |
225 | * <!-- begin-user-doc --> |
226 | * <!-- end-user-doc --> |
227 | * @generated |
228 | */ |
229 | @Override |
230 | public Adapter createExternalObjectAttributeValueAdapter() { |
231 | if (externalObjectAttributeValueItemProvider == null) { |
232 | externalObjectAttributeValueItemProvider = new ExternalObjectAttributeValueItemProvider(this); |
233 | } |
234 | |
235 | return externalObjectAttributeValueItemProvider; |
236 | } |
237 | |
238 | /** |
239 | * This returns the root adapter factory that contains this factory. |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | public ComposeableAdapterFactory getRootAdapterFactory() { |
245 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
246 | } |
247 | |
248 | /** |
249 | * This sets the composed adapter factory that contains this factory. |
250 | * <!-- begin-user-doc --> |
251 | * <!-- end-user-doc --> |
252 | * @generated |
253 | */ |
254 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
255 | this.parentAdapterFactory = parentAdapterFactory; |
256 | } |
257 | |
258 | /** |
259 | * <!-- begin-user-doc --> |
260 | * <!-- end-user-doc --> |
261 | * @generated |
262 | */ |
263 | @Override |
264 | public boolean isFactoryForType(Object type) { |
265 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
266 | } |
267 | |
268 | /** |
269 | * This implementation substitutes the factory itself as the key for the adapter. |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | @Override |
275 | public Adapter adapt(Notifier notifier, Object type) { |
276 | return super.adapt(notifier, this); |
277 | } |
278 | |
279 | /** |
280 | * <!-- begin-user-doc --> |
281 | * <!-- end-user-doc --> |
282 | * @generated |
283 | */ |
284 | @Override |
285 | public Object adapt(Object object, Object type) { |
286 | if (isFactoryForType(type)) { |
287 | Object adapter = super.adapt(object, type); |
288 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
289 | return adapter; |
290 | } |
291 | } |
292 | |
293 | return null; |
294 | } |
295 | |
296 | /** |
297 | * This adds a listener. |
298 | * <!-- begin-user-doc --> |
299 | * <!-- end-user-doc --> |
300 | * @generated |
301 | */ |
302 | public void addListener(INotifyChangedListener notifyChangedListener) { |
303 | changeNotifier.addListener(notifyChangedListener); |
304 | } |
305 | |
306 | /** |
307 | * This removes a listener. |
308 | * <!-- begin-user-doc --> |
309 | * <!-- end-user-doc --> |
310 | * @generated |
311 | */ |
312 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
313 | changeNotifier.removeListener(notifyChangedListener); |
314 | } |
315 | |
316 | /** |
317 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
318 | * <!-- begin-user-doc --> |
319 | * <!-- end-user-doc --> |
320 | * @generated |
321 | */ |
322 | public void fireNotifyChanged(Notification notification) { |
323 | changeNotifier.fireNotifyChanged(notification); |
324 | |
325 | if (parentAdapterFactory != null) { |
326 | parentAdapterFactory.fireNotifyChanged(notification); |
327 | } |
328 | } |
329 | |
330 | /** |
331 | * This disposes all of the item providers created by this factory. |
332 | * <!-- begin-user-doc --> |
333 | * <!-- end-user-doc --> |
334 | * @generated |
335 | */ |
336 | public void dispose() { |
337 | if (configNodeItemProvider != null) configNodeItemProvider.dispose(); |
338 | if (featureConfigItemProvider != null) featureConfigItemProvider.dispose(); |
339 | if (configurationItemProvider != null) configurationItemProvider.dispose(); |
340 | if (integerAttributeValueItemProvider != null) integerAttributeValueItemProvider.dispose(); |
341 | if (doubleAttributeValueItemProvider != null) doubleAttributeValueItemProvider.dispose(); |
342 | if (stringAttributeValueItemProvider != null) stringAttributeValueItemProvider.dispose(); |
343 | if (externalObjectAttributeValueItemProvider != null) externalObjectAttributeValueItemProvider.dispose(); |
344 | } |
345 | |
346 | } |