1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package QVTRelation.provider; |
8 | |
9 | import QVTRelation.util.QVTRelationAdapterFactory; |
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 QVTRelationItemProviderAdapterFactory extends QVTRelationAdapterFactory 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 QVTRelationItemProviderAdapterFactory() { |
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 QVTRelation.DomainPattern} instances. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected DomainPatternItemProvider domainPatternItemProvider; |
85 | |
86 | /** |
87 | * This creates an adapter for a {@link QVTRelation.DomainPattern}. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | @Override |
93 | public Adapter createDomainPatternAdapter() { |
94 | if (domainPatternItemProvider == null) { |
95 | domainPatternItemProvider = new DomainPatternItemProvider(this); |
96 | } |
97 | |
98 | return domainPatternItemProvider; |
99 | } |
100 | |
101 | /** |
102 | * This keeps track of the one adapter used for all {@link QVTRelation.Key} instances. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected KeyItemProvider keyItemProvider; |
108 | |
109 | /** |
110 | * This creates an adapter for a {@link QVTRelation.Key}. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public Adapter createKeyAdapter() { |
117 | if (keyItemProvider == null) { |
118 | keyItemProvider = new KeyItemProvider(this); |
119 | } |
120 | |
121 | return keyItemProvider; |
122 | } |
123 | |
124 | /** |
125 | * This keeps track of the one adapter used for all {@link QVTRelation.OppositePropertyCallExp} instances. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | protected OppositePropertyCallExpItemProvider oppositePropertyCallExpItemProvider; |
131 | |
132 | /** |
133 | * This creates an adapter for a {@link QVTRelation.OppositePropertyCallExp}. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Adapter createOppositePropertyCallExpAdapter() { |
140 | if (oppositePropertyCallExpItemProvider == null) { |
141 | oppositePropertyCallExpItemProvider = new OppositePropertyCallExpItemProvider(this); |
142 | } |
143 | |
144 | return oppositePropertyCallExpItemProvider; |
145 | } |
146 | |
147 | /** |
148 | * This keeps track of the one adapter used for all {@link QVTRelation.Relation} instances. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | protected RelationItemProvider relationItemProvider; |
154 | |
155 | /** |
156 | * This creates an adapter for a {@link QVTRelation.Relation}. |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | public Adapter createRelationAdapter() { |
163 | if (relationItemProvider == null) { |
164 | relationItemProvider = new RelationItemProvider(this); |
165 | } |
166 | |
167 | return relationItemProvider; |
168 | } |
169 | |
170 | /** |
171 | * This keeps track of the one adapter used for all {@link QVTRelation.RelationCallExp} instances. |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | protected RelationCallExpItemProvider relationCallExpItemProvider; |
177 | |
178 | /** |
179 | * This creates an adapter for a {@link QVTRelation.RelationCallExp}. |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public Adapter createRelationCallExpAdapter() { |
186 | if (relationCallExpItemProvider == null) { |
187 | relationCallExpItemProvider = new RelationCallExpItemProvider(this); |
188 | } |
189 | |
190 | return relationCallExpItemProvider; |
191 | } |
192 | |
193 | /** |
194 | * This keeps track of the one adapter used for all {@link QVTRelation.RelationDomain} instances. |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | protected RelationDomainItemProvider relationDomainItemProvider; |
200 | |
201 | /** |
202 | * This creates an adapter for a {@link QVTRelation.RelationDomain}. |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | public Adapter createRelationDomainAdapter() { |
209 | if (relationDomainItemProvider == null) { |
210 | relationDomainItemProvider = new RelationDomainItemProvider(this); |
211 | } |
212 | |
213 | return relationDomainItemProvider; |
214 | } |
215 | |
216 | /** |
217 | * This keeps track of the one adapter used for all {@link QVTRelation.RelationDomainAssignment} instances. |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | protected RelationDomainAssignmentItemProvider relationDomainAssignmentItemProvider; |
223 | |
224 | /** |
225 | * This creates an adapter for a {@link QVTRelation.RelationDomainAssignment}. |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @Override |
231 | public Adapter createRelationDomainAssignmentAdapter() { |
232 | if (relationDomainAssignmentItemProvider == null) { |
233 | relationDomainAssignmentItemProvider = new RelationDomainAssignmentItemProvider(this); |
234 | } |
235 | |
236 | return relationDomainAssignmentItemProvider; |
237 | } |
238 | |
239 | /** |
240 | * This keeps track of the one adapter used for all {@link QVTRelation.RelationImplementation} instances. |
241 | * <!-- begin-user-doc --> |
242 | * <!-- end-user-doc --> |
243 | * @generated |
244 | */ |
245 | protected RelationImplementationItemProvider relationImplementationItemProvider; |
246 | |
247 | /** |
248 | * This creates an adapter for a {@link QVTRelation.RelationImplementation}. |
249 | * <!-- begin-user-doc --> |
250 | * <!-- end-user-doc --> |
251 | * @generated |
252 | */ |
253 | @Override |
254 | public Adapter createRelationImplementationAdapter() { |
255 | if (relationImplementationItemProvider == null) { |
256 | relationImplementationItemProvider = new RelationImplementationItemProvider(this); |
257 | } |
258 | |
259 | return relationImplementationItemProvider; |
260 | } |
261 | |
262 | /** |
263 | * This keeps track of the one adapter used for all {@link QVTRelation.RelationalTransformation} instances. |
264 | * <!-- begin-user-doc --> |
265 | * <!-- end-user-doc --> |
266 | * @generated |
267 | */ |
268 | protected RelationalTransformationItemProvider relationalTransformationItemProvider; |
269 | |
270 | /** |
271 | * This creates an adapter for a {@link QVTRelation.RelationalTransformation}. |
272 | * <!-- begin-user-doc --> |
273 | * <!-- end-user-doc --> |
274 | * @generated |
275 | */ |
276 | @Override |
277 | public Adapter createRelationalTransformationAdapter() { |
278 | if (relationalTransformationItemProvider == null) { |
279 | relationalTransformationItemProvider = new RelationalTransformationItemProvider(this); |
280 | } |
281 | |
282 | return relationalTransformationItemProvider; |
283 | } |
284 | |
285 | /** |
286 | * This returns the root adapter factory that contains this factory. |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | public ComposeableAdapterFactory getRootAdapterFactory() { |
292 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
293 | } |
294 | |
295 | /** |
296 | * This sets the composed adapter factory that contains this factory. |
297 | * <!-- begin-user-doc --> |
298 | * <!-- end-user-doc --> |
299 | * @generated |
300 | */ |
301 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
302 | this.parentAdapterFactory = parentAdapterFactory; |
303 | } |
304 | |
305 | /** |
306 | * <!-- begin-user-doc --> |
307 | * <!-- end-user-doc --> |
308 | * @generated |
309 | */ |
310 | @Override |
311 | public boolean isFactoryForType(Object type) { |
312 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
313 | } |
314 | |
315 | /** |
316 | * This implementation substitutes the factory itself as the key for the adapter. |
317 | * <!-- begin-user-doc --> |
318 | * <!-- end-user-doc --> |
319 | * @generated |
320 | */ |
321 | @Override |
322 | public Adapter adapt(Notifier notifier, Object type) { |
323 | return super.adapt(notifier, this); |
324 | } |
325 | |
326 | /** |
327 | * <!-- begin-user-doc --> |
328 | * <!-- end-user-doc --> |
329 | * @generated |
330 | */ |
331 | @Override |
332 | public Object adapt(Object object, Object type) { |
333 | if (isFactoryForType(type)) { |
334 | Object adapter = super.adapt(object, type); |
335 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
336 | return adapter; |
337 | } |
338 | } |
339 | |
340 | return null; |
341 | } |
342 | |
343 | /** |
344 | * This adds a listener. |
345 | * <!-- begin-user-doc --> |
346 | * <!-- end-user-doc --> |
347 | * @generated |
348 | */ |
349 | public void addListener(INotifyChangedListener notifyChangedListener) { |
350 | changeNotifier.addListener(notifyChangedListener); |
351 | } |
352 | |
353 | /** |
354 | * This removes a listener. |
355 | * <!-- begin-user-doc --> |
356 | * <!-- end-user-doc --> |
357 | * @generated |
358 | */ |
359 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
360 | changeNotifier.removeListener(notifyChangedListener); |
361 | } |
362 | |
363 | /** |
364 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
365 | * <!-- begin-user-doc --> |
366 | * <!-- end-user-doc --> |
367 | * @generated |
368 | */ |
369 | public void fireNotifyChanged(Notification notification) { |
370 | changeNotifier.fireNotifyChanged(notification); |
371 | |
372 | if (parentAdapterFactory != null) { |
373 | parentAdapterFactory.fireNotifyChanged(notification); |
374 | } |
375 | } |
376 | |
377 | /** |
378 | * This disposes all of the item providers created by this factory. |
379 | * <!-- begin-user-doc --> |
380 | * <!-- end-user-doc --> |
381 | * @generated |
382 | */ |
383 | public void dispose() { |
384 | if (domainPatternItemProvider != null) domainPatternItemProvider.dispose(); |
385 | if (keyItemProvider != null) keyItemProvider.dispose(); |
386 | if (oppositePropertyCallExpItemProvider != null) oppositePropertyCallExpItemProvider.dispose(); |
387 | if (relationItemProvider != null) relationItemProvider.dispose(); |
388 | if (relationCallExpItemProvider != null) relationCallExpItemProvider.dispose(); |
389 | if (relationDomainItemProvider != null) relationDomainItemProvider.dispose(); |
390 | if (relationDomainAssignmentItemProvider != null) relationDomainAssignmentItemProvider.dispose(); |
391 | if (relationImplementationItemProvider != null) relationImplementationItemProvider.dispose(); |
392 | if (relationalTransformationItemProvider != null) relationalTransformationItemProvider.dispose(); |
393 | } |
394 | |
395 | } |