Skip to content

Package: TextControlEnablementItemProviderAdapterFactory

TextControlEnablementItemProviderAdapterFactory

nameinstructionbranchcomplexitylinemethod
TextControlEnablementItemProviderAdapterFactory()
M: 0 C: 45
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 11
100%
M: 0 C: 1
100%
adapt(Notifier, Object)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
adapt(Object, Object)
M: 21 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
addListener(INotifyChangedListener)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createTextControlEnablementStylePropertyAdapter()
M: 0 C: 12
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
dispose()
M: 7 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
fireNotifyChanged(Notification)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getChildCreationExtenders()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getNewChildDescriptors(Object, EditingDomain)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getRootAdapterFactory()
M: 9 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isFactoryForType(Object)
M: 0 C: 13
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
removeListener(INotifyChangedListener)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setParentAdapterFactory(ComposedAdapterFactory)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.provider;
15:
16: import java.util.ArrayList;
17: import java.util.Collection;
18: import java.util.List;
19:
20: import org.eclipse.emf.common.notify.Adapter;
21: import org.eclipse.emf.common.notify.Notification;
22: import org.eclipse.emf.common.notify.Notifier;
23: import org.eclipse.emf.common.util.ResourceLocator;
24: import org.eclipse.emf.ecore.EObject;
25: import org.eclipse.emf.ecp.view.template.model.VTStyle;
26: import org.eclipse.emf.ecp.view.template.model.VTTemplatePackage;
27: import org.eclipse.emf.ecp.view.template.model.util.TemplateSwitch;
28: import org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.VTTextControlEnablementFactory;
29: import org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.VTTextControlEnablementPackage;
30: import org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.util.TextControlEnablementAdapterFactory;
31: import org.eclipse.emf.edit.command.CommandParameter;
32: import org.eclipse.emf.edit.domain.EditingDomain;
33: import org.eclipse.emf.edit.provider.ChangeNotifier;
34: import org.eclipse.emf.edit.provider.ChildCreationExtenderManager;
35: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
36: import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
37: import org.eclipse.emf.edit.provider.IChangeNotifier;
38: import org.eclipse.emf.edit.provider.IChildCreationExtender;
39: import org.eclipse.emf.edit.provider.IDisposable;
40: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
41: import org.eclipse.emf.edit.provider.IItemLabelProvider;
42: import org.eclipse.emf.edit.provider.IItemPropertySource;
43: import org.eclipse.emf.edit.provider.INotifyChangedListener;
44: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
45: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
46:
47: /**
48: * This is the factory that is used to provide the interfaces needed to support Viewers.
49: * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged
50: * fireNotifyChanged}.
51: * The adapters also support Eclipse property sheets.
52: * Note that most of the adapters are shared among multiple instances.
53: * <!-- begin-user-doc -->
54: * <!-- end-user-doc -->
55: *
56: * @generated
57: */
58: public class TextControlEnablementItemProviderAdapterFactory extends TextControlEnablementAdapterFactory implements
59:         ComposeableAdapterFactory, IChangeNotifier, IDisposable, IChildCreationExtender {
60:         /**
61:          * This keeps track of the root adapter factory that delegates to this adapter factory.
62:          * <!-- begin-user-doc -->
63:          * <!-- end-user-doc -->
64:          *
65:          * @generated
66:          */
67:         protected ComposedAdapterFactory parentAdapterFactory;
68:
69:         /**
70:          * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
71:          * <!-- begin-user-doc -->
72:          * <!-- end-user-doc -->
73:          *
74:          * @generated
75:          */
76:         protected IChangeNotifier changeNotifier = new ChangeNotifier();
77:
78:         /**
79:          * This helps manage the child creation extenders.
80:          * <!-- begin-user-doc -->
81:          * <!-- end-user-doc -->
82:          *
83:          * @generated
84:          */
85:         protected ChildCreationExtenderManager childCreationExtenderManager = new ChildCreationExtenderManager(
86:                 TextControlEnablementStyleEditPlugin.INSTANCE, VTTextControlEnablementPackage.eNS_URI);
87:
88:         /**
89:          * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
90:          * <!-- begin-user-doc -->
91:          * <!-- end-user-doc -->
92:          *
93:          * @generated
94:          */
95:         protected Collection<Object> supportedTypes = new ArrayList<Object>();
96:
97:         /**
98:          * This constructs an instance.
99:          * <!-- begin-user-doc -->
100:          * <!-- end-user-doc -->
101:          *
102:          * @generated
103:          */
104:         public TextControlEnablementItemProviderAdapterFactory() {
105:                 supportedTypes.add(IEditingDomainItemProvider.class);
106:                 supportedTypes.add(IStructuredItemContentProvider.class);
107:                 supportedTypes.add(ITreeItemContentProvider.class);
108:                 supportedTypes.add(IItemLabelProvider.class);
109:                 supportedTypes.add(IItemPropertySource.class);
110:         }
111:
112:         /**
113:          * This keeps track of the one adapter used for all
114:          * {@link org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.VTTextControlEnablementStyleProperty}
115:          * instances.
116:          * <!-- begin-user-doc -->
117:          * <!-- end-user-doc -->
118:          *
119:          * @generated
120:          */
121:         protected TextControlEnablementStylePropertyItemProvider textControlEnablementStylePropertyItemProvider;
122:
123:         /**
124:          * This creates an adapter for a
125:          * {@link org.eclipse.emf.ecp.view.template.style.textControlEnablement.model.VTTextControlEnablementStyleProperty}.
126:          * <!-- begin-user-doc -->
127:          * <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public Adapter createTextControlEnablementStylePropertyAdapter() {
133:•                if (textControlEnablementStylePropertyItemProvider == null) {
134:                         textControlEnablementStylePropertyItemProvider = new TextControlEnablementStylePropertyItemProvider(this);
135:                 }
136:
137:                 return textControlEnablementStylePropertyItemProvider;
138:         }
139:
140:         /**
141:          * This returns the root adapter factory that contains this factory.
142:          * <!-- begin-user-doc -->
143:          * <!-- end-user-doc -->
144:          *
145:          * @generated
146:          */
147:         @Override
148:         public ComposeableAdapterFactory getRootAdapterFactory() {
149:•                return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
150:         }
151:
152:         /**
153:          * This sets the composed adapter factory that contains this factory.
154:          * <!-- begin-user-doc -->
155:          * <!-- end-user-doc -->
156:          *
157:          * @generated
158:          */
159:         @Override
160:         public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
161:                 this.parentAdapterFactory = parentAdapterFactory;
162:         }
163:
164:         /**
165:          * <!-- begin-user-doc -->
166:          * <!-- end-user-doc -->
167:          *
168:          * @generated
169:          */
170:         @Override
171:         public boolean isFactoryForType(Object type) {
172:•                return supportedTypes.contains(type) || super.isFactoryForType(type);
173:         }
174:
175:         /**
176:          * This implementation substitutes the factory itself as the key for the adapter.
177:          * <!-- begin-user-doc -->
178:          * <!-- end-user-doc -->
179:          *
180:          * @generated
181:          */
182:         @Override
183:         public Adapter adapt(Notifier notifier, Object type) {
184:                 return super.adapt(notifier, this);
185:         }
186:
187:         /**
188:          * <!-- begin-user-doc -->
189:          * <!-- end-user-doc -->
190:          *
191:          * @generated
192:          */
193:         @Override
194:         public Object adapt(Object object, Object type) {
195:•                if (isFactoryForType(type)) {
196:                         final Object adapter = super.adapt(object, type);
197:•                        if (!(type instanceof Class<?>) || ((Class<?>) type).isInstance(adapter)) {
198:                                 return adapter;
199:                         }
200:                 }
201:
202:                 return null;
203:         }
204:
205:         /**
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         public List<IChildCreationExtender> getChildCreationExtenders() {
212:                 return childCreationExtenderManager.getChildCreationExtenders();
213:         }
214:
215:         /**
216:          * <!-- begin-user-doc -->
217:          * <!-- end-user-doc -->
218:          *
219:          * @generated
220:          */
221:         @Override
222:         public Collection<?> getNewChildDescriptors(Object object, EditingDomain editingDomain) {
223:                 return childCreationExtenderManager.getNewChildDescriptors(object, editingDomain);
224:         }
225:
226:         /**
227:          * <!-- begin-user-doc -->
228:          * <!-- end-user-doc -->
229:          *
230:          * @generated
231:          */
232:         @Override
233:         public ResourceLocator getResourceLocator() {
234:                 return childCreationExtenderManager;
235:         }
236:
237:         /**
238:          * This adds a listener.
239:          * <!-- begin-user-doc -->
240:          * <!-- end-user-doc -->
241:          *
242:          * @generated
243:          */
244:         @Override
245:         public void addListener(INotifyChangedListener notifyChangedListener) {
246:                 changeNotifier.addListener(notifyChangedListener);
247:         }
248:
249:         /**
250:          * This removes a listener.
251:          * <!-- begin-user-doc -->
252:          * <!-- end-user-doc -->
253:          *
254:          * @generated
255:          */
256:         @Override
257:         public void removeListener(INotifyChangedListener notifyChangedListener) {
258:                 changeNotifier.removeListener(notifyChangedListener);
259:         }
260:
261:         /**
262:          * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
263:          * <!-- begin-user-doc -->
264:          * <!-- end-user-doc -->
265:          *
266:          * @generated
267:          */
268:         @Override
269:         public void fireNotifyChanged(Notification notification) {
270:                 changeNotifier.fireNotifyChanged(notification);
271:
272:•                if (parentAdapterFactory != null) {
273:                         parentAdapterFactory.fireNotifyChanged(notification);
274:                 }
275:         }
276:
277:         /**
278:          * This disposes all of the item providers created by this factory.
279:          * <!-- begin-user-doc -->
280:          * <!-- end-user-doc -->
281:          *
282:          * @generated
283:          */
284:         @Override
285:         public void dispose() {
286:•                if (textControlEnablementStylePropertyItemProvider != null) {
287:                         textControlEnablementStylePropertyItemProvider.dispose();
288:                 }
289:         }
290:
291:         /**
292:          * A child creation extender for the {@link VTTemplatePackage}.
293:          * <!-- begin-user-doc -->
294:          * <!-- end-user-doc -->
295:          *
296:          * @generated
297:          */
298:         public static class TemplateChildCreationExtender implements IChildCreationExtender {
299:                 /**
300:                  * The switch for creating child descriptors specific to each extended class.
301:                  * <!-- begin-user-doc -->
302:                  * <!-- end-user-doc -->
303:                  *
304:                  * @generated
305:                  */
306:                 protected static class CreationSwitch extends TemplateSwitch<Object> {
307:                         /**
308:                          * The child descriptors being populated.
309:                          * <!-- begin-user-doc -->
310:                          * <!-- end-user-doc -->
311:                          *
312:                          * @generated
313:                          */
314:                         protected List<Object> newChildDescriptors;
315:
316:                         /**
317:                          * The domain in which to create the children.
318:                          * <!-- begin-user-doc -->
319:                          * <!-- end-user-doc -->
320:                          *
321:                          * @generated
322:                          */
323:                         protected EditingDomain editingDomain;
324:
325:                         /**
326:                          * Creates the a switch for populating child descriptors in the given domain.
327:                          * <!-- begin-user-doc -->
328:                          * <!-- end-user-doc -->
329:                          *
330:                          * @generated
331:                          */
332:                         CreationSwitch(List<Object> newChildDescriptors, EditingDomain editingDomain) {
333:                                 this.newChildDescriptors = newChildDescriptors;
334:                                 this.editingDomain = editingDomain;
335:                         }
336:
337:                         /**
338:                          * <!-- begin-user-doc -->
339:                          * <!-- end-user-doc -->
340:                          *
341:                          * @generated
342:                          */
343:                         @Override
344:                         public Object caseStyle(VTStyle object) {
345:                                 newChildDescriptors.add(createChildParameter(VTTemplatePackage.Literals.STYLE__PROPERTIES,
346:                                         VTTextControlEnablementFactory.eINSTANCE.createTextControlEnablementStyleProperty()));
347:
348:                                 return null;
349:                         }
350:
351:                         /**
352:                          * <!-- begin-user-doc -->
353:                          * <!-- end-user-doc -->
354:                          *
355:                          * @generated
356:                          */
357:                         protected CommandParameter createChildParameter(Object feature, Object child) {
358:                                 return new CommandParameter(null, feature, child);
359:                         }
360:
361:                 }
362:
363:                 /**
364:                  * <!-- begin-user-doc -->
365:                  * <!-- end-user-doc -->
366:                  *
367:                  * @generated
368:                  */
369:                 @Override
370:                 public Collection<Object> getNewChildDescriptors(Object object, EditingDomain editingDomain) {
371:                         final ArrayList<Object> result = new ArrayList<Object>();
372:                         new CreationSwitch(result, editingDomain).doSwitch((EObject) object);
373:                         return result;
374:                 }
375:
376:                 /**
377:                  * <!-- begin-user-doc -->
378:                  * <!-- end-user-doc -->
379:                  *
380:                  * @generated
381:                  */
382:                 @Override
383:                 public ResourceLocator getResourceLocator() {
384:                         return TextControlEnablementStyleEditPlugin.INSTANCE;
385:                 }
386:         }
387:
388: }