1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package edu.kit.ipd.sdq.completionfeaturemodel.provider; |
8 | |
9 | import edu.kit.ipd.sdq.completionfeaturemodel.util.completionfeaturemodelAdapterFactory; |
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.IItemColorProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
27 | import org.eclipse.emf.edit.provider.INotifyChangedListener; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | |
31 | /** |
32 | * This is the factory that is used to provide the interfaces needed to support Viewers. |
33 | * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. |
34 | * The adapters also support Eclipse property sheets. |
35 | * Note that most of the adapters are shared among multiple instances. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class completionfeaturemodelItemProviderAdapterFactory extends completionfeaturemodelAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { |
41 | /** |
42 | * This keeps track of the root adapter factory that delegates to this adapter factory. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | protected ComposedAdapterFactory parentAdapterFactory; |
48 | |
49 | /** |
50 | * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | protected IChangeNotifier changeNotifier = new ChangeNotifier(); |
56 | |
57 | /** |
58 | * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | protected Collection<Object> supportedTypes = new ArrayList<Object>(); |
64 | |
65 | /** |
66 | * This constructs an instance. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | public completionfeaturemodelItemProviderAdapterFactory() { |
72 | supportedTypes.add(IEditingDomainItemProvider.class); |
73 | supportedTypes.add(IStructuredItemContentProvider.class); |
74 | supportedTypes.add(ITreeItemContentProvider.class); |
75 | supportedTypes.add(IItemLabelProvider.class); |
76 | supportedTypes.add(IItemPropertySource.class); |
77 | supportedTypes.add(IItemColorProvider.class); |
78 | } |
79 | |
80 | /** |
81 | * This keeps track of the one adapter used for all {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeature} instances. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | protected CompletionFeatureItemProvider completionFeatureItemProvider; |
87 | |
88 | /** |
89 | * This creates an adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeature}. |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | @Override |
95 | public Adapter createCompletionFeatureAdapter() { |
96 | if (completionFeatureItemProvider == null) { |
97 | completionFeatureItemProvider = new CompletionFeatureItemProvider(this); |
98 | } |
99 | |
100 | return completionFeatureItemProvider; |
101 | } |
102 | |
103 | /** |
104 | * This keeps track of the one adapter used for all {@link edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule} instances. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | protected DisambiguationRuleItemProvider disambiguationRuleItemProvider; |
110 | |
111 | /** |
112 | * This creates an adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule}. |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | @Override |
118 | public Adapter createDisambiguationRuleAdapter() { |
119 | if (disambiguationRuleItemProvider == null) { |
120 | disambiguationRuleItemProvider = new DisambiguationRuleItemProvider(this); |
121 | } |
122 | |
123 | return disambiguationRuleItemProvider; |
124 | } |
125 | |
126 | /** |
127 | * This keeps track of the one adapter used for all {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureDiagram} instances. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | protected CompletionFeatureDiagramItemProvider completionFeatureDiagramItemProvider; |
133 | |
134 | /** |
135 | * This creates an adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureDiagram}. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public Adapter createCompletionFeatureDiagramAdapter() { |
142 | if (completionFeatureDiagramItemProvider == null) { |
143 | completionFeatureDiagramItemProvider = new CompletionFeatureDiagramItemProvider(this); |
144 | } |
145 | |
146 | return completionFeatureDiagramItemProvider; |
147 | } |
148 | |
149 | /** |
150 | * This keeps track of the one adapter used for all {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionSimple} instances. |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | protected CompletionSimpleItemProvider completionSimpleItemProvider; |
156 | |
157 | /** |
158 | * This creates an adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionSimple}. |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | @Override |
164 | public Adapter createCompletionSimpleAdapter() { |
165 | if (completionSimpleItemProvider == null) { |
166 | completionSimpleItemProvider = new CompletionSimpleItemProvider(this); |
167 | } |
168 | |
169 | return completionSimpleItemProvider; |
170 | } |
171 | |
172 | /** |
173 | * This keeps track of the one adapter used for all {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureGroup} instances. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | protected CompletionFeatureGroupItemProvider completionFeatureGroupItemProvider; |
179 | |
180 | /** |
181 | * This creates an adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureGroup}. |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | public Adapter createCompletionFeatureGroupAdapter() { |
188 | if (completionFeatureGroupItemProvider == null) { |
189 | completionFeatureGroupItemProvider = new CompletionFeatureGroupItemProvider(this); |
190 | } |
191 | |
192 | return completionFeatureGroupItemProvider; |
193 | } |
194 | |
195 | /** |
196 | * This returns the root adapter factory that contains this factory. |
197 | * <!-- begin-user-doc --> |
198 | * <!-- end-user-doc --> |
199 | * @generated |
200 | */ |
201 | public ComposeableAdapterFactory getRootAdapterFactory() { |
202 | return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); |
203 | } |
204 | |
205 | /** |
206 | * This sets the composed adapter factory that contains this factory. |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { |
212 | this.parentAdapterFactory = parentAdapterFactory; |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @Override |
221 | public boolean isFactoryForType(Object type) { |
222 | return supportedTypes.contains(type) || super.isFactoryForType(type); |
223 | } |
224 | |
225 | /** |
226 | * This implementation substitutes the factory itself as the key for the adapter. |
227 | * <!-- begin-user-doc --> |
228 | * <!-- end-user-doc --> |
229 | * @generated |
230 | */ |
231 | @Override |
232 | public Adapter adapt(Notifier notifier, Object type) { |
233 | return super.adapt(notifier, this); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | @Override |
242 | public Object adapt(Object object, Object type) { |
243 | if (isFactoryForType(type)) { |
244 | Object adapter = super.adapt(object, type); |
245 | if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) { |
246 | return adapter; |
247 | } |
248 | } |
249 | |
250 | return null; |
251 | } |
252 | |
253 | /** |
254 | * This adds a listener. |
255 | * <!-- begin-user-doc --> |
256 | * <!-- end-user-doc --> |
257 | * @generated |
258 | */ |
259 | public void addListener(INotifyChangedListener notifyChangedListener) { |
260 | changeNotifier.addListener(notifyChangedListener); |
261 | } |
262 | |
263 | /** |
264 | * This removes a listener. |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | public void removeListener(INotifyChangedListener notifyChangedListener) { |
270 | changeNotifier.removeListener(notifyChangedListener); |
271 | } |
272 | |
273 | /** |
274 | * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. |
275 | * <!-- begin-user-doc --> |
276 | * <!-- end-user-doc --> |
277 | * @generated |
278 | */ |
279 | public void fireNotifyChanged(Notification notification) { |
280 | changeNotifier.fireNotifyChanged(notification); |
281 | |
282 | if (parentAdapterFactory != null) { |
283 | parentAdapterFactory.fireNotifyChanged(notification); |
284 | } |
285 | } |
286 | |
287 | /** |
288 | * This disposes all of the item providers created by this factory. |
289 | * <!-- begin-user-doc --> |
290 | * <!-- end-user-doc --> |
291 | * @generated |
292 | */ |
293 | public void dispose() { |
294 | if (completionFeatureItemProvider != null) completionFeatureItemProvider.dispose(); |
295 | if (disambiguationRuleItemProvider != null) disambiguationRuleItemProvider.dispose(); |
296 | if (completionFeatureDiagramItemProvider != null) completionFeatureDiagramItemProvider.dispose(); |
297 | if (completionSimpleItemProvider != null) completionSimpleItemProvider.dispose(); |
298 | if (completionFeatureGroupItemProvider != null) completionFeatureGroupItemProvider.dispose(); |
299 | } |
300 | |
301 | } |