1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.aggregatedUsageContext.provider; |
7 | |
8 | import de.uka.ipd.sdq.context.aggregatedUsageContext.util.AggregatedUsageContextAdapterFactory; |
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 AggregatedUsageContextItemProviderAdapterFactory extends AggregatedUsageContextAdapterFactory 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 AggregatedUsageContextItemProviderAdapterFactory() { |
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.aggregatedUsageContext.ServiceExecutionContext} instances. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | protected ServiceExecutionContextItemProvider serviceExecutionContextItemProvider; |
91 | |
92 | /** |
93 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.ServiceExecutionContext}. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | @Override |
99 | public Adapter createServiceExecutionContextAdapter() { |
100 | if (serviceExecutionContextItemProvider == null) { |
101 | serviceExecutionContextItemProvider = new ServiceExecutionContextItemProvider(this); |
102 | } |
103 | |
104 | return serviceExecutionContextItemProvider; |
105 | } |
106 | |
107 | /** |
108 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedResourceDemand} instances. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | protected AggregatedResourceDemandItemProvider aggregatedResourceDemandItemProvider; |
114 | |
115 | /** |
116 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedResourceDemand}. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public Adapter createAggregatedResourceDemandAdapter() { |
123 | if (aggregatedResourceDemandItemProvider == null) { |
124 | aggregatedResourceDemandItemProvider = new AggregatedResourceDemandItemProvider(this); |
125 | } |
126 | |
127 | return aggregatedResourceDemandItemProvider; |
128 | } |
129 | |
130 | /** |
131 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedCommunication} instances. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | protected AggregatedCommunicationItemProvider aggregatedCommunicationItemProvider; |
137 | |
138 | /** |
139 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedCommunication}. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public Adapter createAggregatedCommunicationAdapter() { |
146 | if (aggregatedCommunicationItemProvider == null) { |
147 | aggregatedCommunicationItemProvider = new AggregatedCommunicationItemProvider(this); |
148 | } |
149 | |
150 | return aggregatedCommunicationItemProvider; |
151 | } |
152 | |
153 | /** |
154 | * This keeps track of the one adapter used for all {@link de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage} instances. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | protected ComputedAggregatedUsageItemProvider computedAggregatedUsageItemProvider; |
160 | |
161 | /** |
162 | * This creates an adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage}. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public Adapter createComputedAggregatedUsageAdapter() { |
169 | if (computedAggregatedUsageItemProvider == null) { |
170 | computedAggregatedUsageItemProvider = new ComputedAggregatedUsageItemProvider(this); |
171 | } |
172 | |
173 | return computedAggregatedUsageItemProvider; |
174 | } |
175 | |
176 | /** |
177 | * This returns the root adapter factory that contains this factory. |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public ComposeableAdapterFactory getRootAdapterFactory() { |
183 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
184 | } |
185 | |
186 | /** |
187 | * This sets the composed adapter factory that contains this factory. |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
193 | this.parentAdapterFactory = parentAdapterFactory; |
194 | } |
195 | |
196 | /** |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | @Override |
202 | public boolean isFactoryForType(Object type) { |
203 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
204 | } |
205 | |
206 | /** |
207 | * This implementation substitutes the factory itself as the key for the adapter. |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public Adapter adapt(Notifier notifier, Object type) { |
214 | return super.adapt(notifier, this); |
215 | } |
216 | |
217 | /** |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | @Override |
223 | public Object adapt(Object object, Object type) { |
224 | if (isFactoryForType(type)) { |
225 | Object adapter = super.adapt(object, type); |
226 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
227 | return adapter; |
228 | } |
229 | } |
230 | |
231 | return null; |
232 | } |
233 | |
234 | /** |
235 | * This adds a listener. |
236 | * <!-- begin-user-doc --> |
237 | * <!-- end-user-doc --> |
238 | * @generated |
239 | */ |
240 | public void addListener(INotifyChangedListener notifyChangedListener) { |
241 | changeNotifier.addListener(notifyChangedListener); |
242 | } |
243 | |
244 | /** |
245 | * This removes a listener. |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
251 | changeNotifier.removeListener(notifyChangedListener); |
252 | } |
253 | |
254 | /** |
255 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | public void fireNotifyChanged(Notification notification) { |
261 | changeNotifier.fireNotifyChanged(notification); |
262 | |
263 | if (parentAdapterFactory != null) { |
264 | parentAdapterFactory.fireNotifyChanged(notification); |
265 | } |
266 | } |
267 | |
268 | /** |
269 | * This disposes all of the item providers created by this factory. |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | public void dispose() { |
275 | if (serviceExecutionContextItemProvider != null) serviceExecutionContextItemProvider.dispose(); |
276 | if (aggregatedResourceDemandItemProvider != null) aggregatedResourceDemandItemProvider.dispose(); |
277 | if (aggregatedCommunicationItemProvider != null) aggregatedCommunicationItemProvider.dispose(); |
278 | if (computedAggregatedUsageItemProvider != null) computedAggregatedUsageItemProvider.dispose(); |
279 | } |
280 | |
281 | } |