1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.cost.provider; |
8 | |
9 | import de.uka.ipd.sdq.pcm.cost.util.costAdapterFactory; |
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 costItemProviderAdapterFactory extends costAdapterFactory 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 costItemProviderAdapterFactory() { |
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.cost.ComponentCost} instances. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected ComponentCostItemProvider componentCostItemProvider; |
85 | |
86 | /** |
87 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.ComponentCost}. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | @Override |
93 | public Adapter createComponentCostAdapter() { |
94 | if (componentCostItemProvider == null) { |
95 | componentCostItemProvider = new ComponentCostItemProvider(this); |
96 | } |
97 | |
98 | return componentCostItemProvider; |
99 | } |
100 | |
101 | /** |
102 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.FixedLinkingResourceCost} instances. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected FixedLinkingResourceCostItemProvider fixedLinkingResourceCostItemProvider; |
108 | |
109 | /** |
110 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.FixedLinkingResourceCost}. |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | public Adapter createFixedLinkingResourceCostAdapter() { |
117 | if (fixedLinkingResourceCostItemProvider == null) { |
118 | fixedLinkingResourceCostItemProvider = new FixedLinkingResourceCostItemProvider(this); |
119 | } |
120 | |
121 | return fixedLinkingResourceCostItemProvider; |
122 | } |
123 | |
124 | /** |
125 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.FixedProcessingResourceCost} instances. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | protected FixedProcessingResourceCostItemProvider fixedProcessingResourceCostItemProvider; |
131 | |
132 | /** |
133 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.FixedProcessingResourceCost}. |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Adapter createFixedProcessingResourceCostAdapter() { |
140 | if (fixedProcessingResourceCostItemProvider == null) { |
141 | fixedProcessingResourceCostItemProvider = new FixedProcessingResourceCostItemProvider(this); |
142 | } |
143 | |
144 | return fixedProcessingResourceCostItemProvider; |
145 | } |
146 | |
147 | /** |
148 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.VariableLinkingResourceCost} instances. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | protected VariableLinkingResourceCostItemProvider variableLinkingResourceCostItemProvider; |
154 | |
155 | /** |
156 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.VariableLinkingResourceCost}. |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | public Adapter createVariableLinkingResourceCostAdapter() { |
163 | if (variableLinkingResourceCostItemProvider == null) { |
164 | variableLinkingResourceCostItemProvider = new VariableLinkingResourceCostItemProvider(this); |
165 | } |
166 | |
167 | return variableLinkingResourceCostItemProvider; |
168 | } |
169 | |
170 | /** |
171 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.VariableProcessingResourceCost} instances. |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | protected VariableProcessingResourceCostItemProvider variableProcessingResourceCostItemProvider; |
177 | |
178 | /** |
179 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.VariableProcessingResourceCost}. |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | @Override |
185 | public Adapter createVariableProcessingResourceCostAdapter() { |
186 | if (variableProcessingResourceCostItemProvider == null) { |
187 | variableProcessingResourceCostItemProvider = new VariableProcessingResourceCostItemProvider(this); |
188 | } |
189 | |
190 | return variableProcessingResourceCostItemProvider; |
191 | } |
192 | |
193 | /** |
194 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.ScalarFunction} instances. |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | protected ScalarFunctionItemProvider scalarFunctionItemProvider; |
200 | |
201 | /** |
202 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.ScalarFunction}. |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | public Adapter createScalarFunctionAdapter() { |
209 | if (scalarFunctionItemProvider == null) { |
210 | scalarFunctionItemProvider = new ScalarFunctionItemProvider(this); |
211 | } |
212 | |
213 | return scalarFunctionItemProvider; |
214 | } |
215 | |
216 | /** |
217 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.CostRepository} instances. |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | protected CostRepositoryItemProvider costRepositoryItemProvider; |
223 | |
224 | /** |
225 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.CostRepository}. |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @Override |
231 | public Adapter createCostRepositoryAdapter() { |
232 | if (costRepositoryItemProvider == null) { |
233 | costRepositoryItemProvider = new CostRepositoryItemProvider(this); |
234 | } |
235 | |
236 | return costRepositoryItemProvider; |
237 | } |
238 | |
239 | /** |
240 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.cost.ComponentCostPerInstance} instances. |
241 | * <!-- begin-user-doc --> |
242 | * <!-- end-user-doc --> |
243 | * @generated |
244 | */ |
245 | protected ComponentCostPerInstanceItemProvider componentCostPerInstanceItemProvider; |
246 | |
247 | /** |
248 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.cost.ComponentCostPerInstance}. |
249 | * <!-- begin-user-doc --> |
250 | * <!-- end-user-doc --> |
251 | * @generated |
252 | */ |
253 | @Override |
254 | public Adapter createComponentCostPerInstanceAdapter() { |
255 | if (componentCostPerInstanceItemProvider == null) { |
256 | componentCostPerInstanceItemProvider = new ComponentCostPerInstanceItemProvider(this); |
257 | } |
258 | |
259 | return componentCostPerInstanceItemProvider; |
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 (componentCostItemProvider != null) componentCostItemProvider.dispose(); |
362 | if (fixedLinkingResourceCostItemProvider != null) fixedLinkingResourceCostItemProvider.dispose(); |
363 | if (fixedProcessingResourceCostItemProvider != null) fixedProcessingResourceCostItemProvider.dispose(); |
364 | if (variableLinkingResourceCostItemProvider != null) variableLinkingResourceCostItemProvider.dispose(); |
365 | if (variableProcessingResourceCostItemProvider != null) variableProcessingResourceCostItemProvider.dispose(); |
366 | if (scalarFunctionItemProvider != null) scalarFunctionItemProvider.dispose(); |
367 | if (costRepositoryItemProvider != null) costRepositoryItemProvider.dispose(); |
368 | if (componentCostPerInstanceItemProvider != null) componentCostPerInstanceItemProvider.dispose(); |
369 | } |
370 | |
371 | } |