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