1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.seff_performance.provider; |
7 | |
8 | import java.util.ArrayList; |
9 | import java.util.Collection; |
10 | |
11 | import org.eclipse.emf.common.notify.Adapter; |
12 | import org.eclipse.emf.common.notify.Notification; |
13 | import org.eclipse.emf.common.notify.Notifier; |
14 | import org.eclipse.emf.edit.provider.ChangeNotifier; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
18 | import org.eclipse.emf.edit.provider.IDisposable; |
19 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
20 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
21 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
22 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
23 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
24 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
25 | |
26 | import de.uka.ipd.sdq.pcm.seff.seff_performance.util.Seff_performanceAdapterFactory; |
27 | |
28 | /** |
29 | * This is the factory that is used to provide the interfaces needed to support Viewers. |
30 | * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. |
31 | * The adapters also support Eclipse property sheets. |
32 | * Note that most of the adapters are shared among multiple instances. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class Seff_performanceItemProviderAdapterFactory extends Seff_performanceAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
44 | |
45 | /** |
46 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | protected ComposedAdapterFactory parentAdapterFactory; |
52 | |
53 | /** |
54 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
60 | |
61 | /** |
62 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
68 | |
69 | /** |
70 | * This constructs an instance. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | public Seff_performanceItemProviderAdapterFactory() { |
76 | supportedTypes.add(IEditingDomainItemProvider.class); |
77 | supportedTypes.add(IStructuredItemContentProvider.class); |
78 | supportedTypes.add(ITreeItemContentProvider.class); |
79 | supportedTypes.add(IItemLabelProvider.class); |
80 | supportedTypes.add(IItemPropertySource.class); |
81 | } |
82 | |
83 | /** |
84 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall} instances. |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | protected InfrastructureCallItemProvider infrastructureCallItemProvider; |
90 | |
91 | /** |
92 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall}. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | public Adapter createInfrastructureCallAdapter() { |
99 | if (infrastructureCallItemProvider == null) { |
100 | infrastructureCallItemProvider = new InfrastructureCallItemProvider(this); |
101 | } |
102 | |
103 | return infrastructureCallItemProvider; |
104 | } |
105 | |
106 | /** |
107 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall} instances. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | protected ResourceCallItemProvider resourceCallItemProvider; |
113 | |
114 | /** |
115 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall}. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | public Adapter createResourceCallAdapter() { |
122 | if (resourceCallItemProvider == null) { |
123 | resourceCallItemProvider = new ResourceCallItemProvider(this); |
124 | } |
125 | |
126 | return resourceCallItemProvider; |
127 | } |
128 | |
129 | /** |
130 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand} instances. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | protected ParametricResourceDemandItemProvider parametricResourceDemandItemProvider; |
136 | |
137 | /** |
138 | * This creates an adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand}. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public Adapter createParametricResourceDemandAdapter() { |
145 | if (parametricResourceDemandItemProvider == null) { |
146 | parametricResourceDemandItemProvider = new ParametricResourceDemandItemProvider(this); |
147 | } |
148 | |
149 | return parametricResourceDemandItemProvider; |
150 | } |
151 | |
152 | /** |
153 | * This returns the root adapter factory that contains this factory. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | public ComposeableAdapterFactory getRootAdapterFactory() { |
159 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
160 | } |
161 | |
162 | /** |
163 | * This sets the composed adapter factory that contains this factory. |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
169 | this.parentAdapterFactory = parentAdapterFactory; |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @Override |
178 | public boolean isFactoryForType(Object type) { |
179 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
180 | } |
181 | |
182 | /** |
183 | * This implementation substitutes the factory itself as the key for the adapter. |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | @Override |
189 | public Adapter adapt(Notifier notifier, Object type) { |
190 | return super.adapt(notifier, this); |
191 | } |
192 | |
193 | /** |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | @Override |
199 | public Object adapt(Object object, Object type) { |
200 | if (isFactoryForType(type)) { |
201 | Object adapter = super.adapt(object, type); |
202 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
203 | return adapter; |
204 | } |
205 | } |
206 | |
207 | return null; |
208 | } |
209 | |
210 | /** |
211 | * This adds a listener. |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | public void addListener(INotifyChangedListener notifyChangedListener) { |
217 | changeNotifier.addListener(notifyChangedListener); |
218 | } |
219 | |
220 | /** |
221 | * This removes a listener. |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @generated |
225 | */ |
226 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
227 | changeNotifier.removeListener(notifyChangedListener); |
228 | } |
229 | |
230 | /** |
231 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | public void fireNotifyChanged(Notification notification) { |
237 | changeNotifier.fireNotifyChanged(notification); |
238 | |
239 | if (parentAdapterFactory != null) { |
240 | parentAdapterFactory.fireNotifyChanged(notification); |
241 | } |
242 | } |
243 | |
244 | /** |
245 | * This disposes all of the item providers created by this factory. |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | public void dispose() { |
251 | if (infrastructureCallItemProvider != null) infrastructureCallItemProvider.dispose(); |
252 | if (resourceCallItemProvider != null) resourceCallItemProvider.dispose(); |
253 | if (parametricResourceDemandItemProvider != null) parametricResourceDemandItemProvider.dispose(); |
254 | } |
255 | |
256 | } |