Skip to content

Package: BoolItemProviderAdapterFactory

BoolItemProviderAdapterFactory

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