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