1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.provider; |
7 | |
8 | import de.uka.ipd.sdq.context.computed_usage.util.ComputedUsageAdapterFactory; |
9 | |
10 | import java.util.ArrayList; |
11 | import java.util.Collection; |
12 | |
13 | import org.eclipse.emf.common.notify.Adapter; |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.common.notify.Notifier; |
16 | |
17 | import org.eclipse.emf.edit.provider.ChangeNotifier; |
18 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
19 | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
20 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
21 | import org.eclipse.emf.edit.provider.IDisposable; |
22 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
23 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
24 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
25 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
26 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
27 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
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 ComputedUsageItemProviderAdapterFactory extends ComputedUsageAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
39 | /** |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
45 | |
46 | /** |
47 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | protected ComposedAdapterFactory parentAdapterFactory; |
53 | |
54 | /** |
55 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
61 | |
62 | /** |
63 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
69 | |
70 | /** |
71 | * This constructs an instance. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public ComputedUsageItemProviderAdapterFactory() { |
77 | supportedTypes.add(IEditingDomainItemProvider.class); |
78 | supportedTypes.add(IStructuredItemContentProvider.class); |
79 | supportedTypes.add(ITreeItemContentProvider.class); |
80 | supportedTypes.add(IItemLabelProvider.class); |
81 | supportedTypes.add(IItemPropertySource.class); |
82 | } |
83 | |
84 | /** |
85 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.ComputedUsageContext} instances. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | protected ComputedUsageContextItemProvider computedUsageContextItemProvider; |
91 | |
92 | /** |
93 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.ComputedUsageContext}. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | @Override |
99 | public Adapter createComputedUsageContextAdapter() { |
100 | if (computedUsageContextItemProvider == null) { |
101 | computedUsageContextItemProvider = new ComputedUsageContextItemProvider(this); |
102 | } |
103 | |
104 | return computedUsageContextItemProvider; |
105 | } |
106 | |
107 | /** |
108 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.BranchProbability} instances. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | protected BranchProbabilityItemProvider branchProbabilityItemProvider; |
114 | |
115 | /** |
116 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.BranchProbability}. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public Adapter createBranchProbabilityAdapter() { |
123 | if (branchProbabilityItemProvider == null) { |
124 | branchProbabilityItemProvider = new BranchProbabilityItemProvider(this); |
125 | } |
126 | |
127 | return branchProbabilityItemProvider; |
128 | } |
129 | |
130 | /** |
131 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.LoopIteration} instances. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | protected LoopIterationItemProvider loopIterationItemProvider; |
137 | |
138 | /** |
139 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.LoopIteration}. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public Adapter createLoopIterationAdapter() { |
146 | if (loopIterationItemProvider == null) { |
147 | loopIterationItemProvider = new LoopIterationItemProvider(this); |
148 | } |
149 | |
150 | return loopIterationItemProvider; |
151 | } |
152 | |
153 | /** |
154 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.Input} instances. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | protected InputItemProvider inputItemProvider; |
160 | |
161 | /** |
162 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.Input}. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public Adapter createInputAdapter() { |
169 | if (inputItemProvider == null) { |
170 | inputItemProvider = new InputItemProvider(this); |
171 | } |
172 | |
173 | return inputItemProvider; |
174 | } |
175 | |
176 | /** |
177 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.ExternalCallOutput} instances. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | protected ExternalCallOutputItemProvider externalCallOutputItemProvider; |
183 | |
184 | /** |
185 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.ExternalCallOutput}. |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | @Override |
191 | public Adapter createExternalCallOutputAdapter() { |
192 | if (externalCallOutputItemProvider == null) { |
193 | externalCallOutputItemProvider = new ExternalCallOutputItemProvider(this); |
194 | } |
195 | |
196 | return externalCallOutputItemProvider; |
197 | } |
198 | |
199 | /** |
200 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.ExternalCallInput} instances. |
201 | * <!-- begin-user-doc --> |
202 | * <!-- end-user-doc --> |
203 | * @generated |
204 | */ |
205 | protected ExternalCallInputItemProvider externalCallInputItemProvider; |
206 | |
207 | /** |
208 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.ExternalCallInput}. |
209 | * <!-- begin-user-doc --> |
210 | * <!-- end-user-doc --> |
211 | * @generated |
212 | */ |
213 | @Override |
214 | public Adapter createExternalCallInputAdapter() { |
215 | if (externalCallInputItemProvider == null) { |
216 | externalCallInputItemProvider = new ExternalCallInputItemProvider(this); |
217 | } |
218 | |
219 | return externalCallInputItemProvider; |
220 | } |
221 | |
222 | /** |
223 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.Output} instances. |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | protected OutputItemProvider outputItemProvider; |
229 | |
230 | /** |
231 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.Output}. |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | @Override |
237 | public Adapter createOutputAdapter() { |
238 | if (outputItemProvider == null) { |
239 | outputItemProvider = new OutputItemProvider(this); |
240 | } |
241 | |
242 | return outputItemProvider; |
243 | } |
244 | |
245 | /** |
246 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.computed_usage.ComputedUsage} instances. |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | protected ComputedUsageItemProvider computedUsageItemProvider; |
252 | |
253 | /** |
254 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.computed_usage.ComputedUsage}. |
255 | * <!-- begin-user-doc --> |
256 | * <!-- end-user-doc --> |
257 | * @generated |
258 | */ |
259 | @Override |
260 | public Adapter createComputedUsageAdapter() { |
261 | if (computedUsageItemProvider == null) { |
262 | computedUsageItemProvider = new ComputedUsageItemProvider(this); |
263 | } |
264 | |
265 | return computedUsageItemProvider; |
266 | } |
267 | |
268 | /** |
269 | * This returns the root adapter factory that contains this factory. |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | public ComposeableAdapterFactory getRootAdapterFactory() { |
275 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
276 | } |
277 | |
278 | /** |
279 | * This sets the composed adapter factory that contains this factory. |
280 | * <!-- begin-user-doc --> |
281 | * <!-- end-user-doc --> |
282 | * @generated |
283 | */ |
284 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
285 | this.parentAdapterFactory = parentAdapterFactory; |
286 | } |
287 | |
288 | /** |
289 | * <!-- begin-user-doc --> |
290 | * <!-- end-user-doc --> |
291 | * @generated |
292 | */ |
293 | @Override |
294 | public boolean isFactoryForType(Object type) { |
295 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
296 | } |
297 | |
298 | /** |
299 | * This implementation substitutes the factory itself as the key for the adapter. |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | @Override |
305 | public Adapter adapt(Notifier notifier, Object type) { |
306 | return super.adapt(notifier, this); |
307 | } |
308 | |
309 | /** |
310 | * <!-- begin-user-doc --> |
311 | * <!-- end-user-doc --> |
312 | * @generated |
313 | */ |
314 | @Override |
315 | public Object adapt(Object object, Object type) { |
316 | if (isFactoryForType(type)) { |
317 | Object adapter = super.adapt(object, type); |
318 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
319 | return adapter; |
320 | } |
321 | } |
322 | |
323 | return null; |
324 | } |
325 | |
326 | /** |
327 | * This adds a listener. |
328 | * <!-- begin-user-doc --> |
329 | * <!-- end-user-doc --> |
330 | * @generated |
331 | */ |
332 | public void addListener(INotifyChangedListener notifyChangedListener) { |
333 | changeNotifier.addListener(notifyChangedListener); |
334 | } |
335 | |
336 | /** |
337 | * This removes a listener. |
338 | * <!-- begin-user-doc --> |
339 | * <!-- end-user-doc --> |
340 | * @generated |
341 | */ |
342 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
343 | changeNotifier.removeListener(notifyChangedListener); |
344 | } |
345 | |
346 | /** |
347 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
348 | * <!-- begin-user-doc --> |
349 | * <!-- end-user-doc --> |
350 | * @generated |
351 | */ |
352 | public void fireNotifyChanged(Notification notification) { |
353 | changeNotifier.fireNotifyChanged(notification); |
354 | |
355 | if (parentAdapterFactory != null) { |
356 | parentAdapterFactory.fireNotifyChanged(notification); |
357 | } |
358 | } |
359 | |
360 | /** |
361 | * This disposes all of the item providers created by this factory. |
362 | * <!-- begin-user-doc --> |
363 | * <!-- end-user-doc --> |
364 | * @generated |
365 | */ |
366 | public void dispose() { |
367 | if (computedUsageContextItemProvider != null) computedUsageContextItemProvider.dispose(); |
368 | if (branchProbabilityItemProvider != null) branchProbabilityItemProvider.dispose(); |
369 | if (loopIterationItemProvider != null) loopIterationItemProvider.dispose(); |
370 | if (inputItemProvider != null) inputItemProvider.dispose(); |
371 | if (externalCallOutputItemProvider != null) externalCallOutputItemProvider.dispose(); |
372 | if (externalCallInputItemProvider != null) externalCallInputItemProvider.dispose(); |
373 | if (outputItemProvider != null) outputItemProvider.dispose(); |
374 | if (computedUsageItemProvider != null) computedUsageItemProvider.dispose(); |
375 | } |
376 | |
377 | } |