Skip to content

Package: ComponentItemProvider

ComponentItemProvider

nameinstructionbranchcomplexitylinemethod
ComponentItemProvider(AdapterFactory)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
collectNewChildDescriptors(Collection, Object)
M: 53 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
getChildFeature(Object, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getChildrenFeatures(Object)
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getPropertyDescriptors(Object)
M: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getResourceLocator()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getText(Object)
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%
notifyChanged(Notification)
M: 33 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%

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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emfforms.coffee.model.coffee.provider;
15:
16: import java.util.Collection;
17: import java.util.List;
18:
19: import org.eclipse.emf.common.notify.AdapterFactory;
20: import org.eclipse.emf.common.notify.Notification;
21: import org.eclipse.emf.common.util.ResourceLocator;
22: import org.eclipse.emf.ecore.EStructuralFeature;
23: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
24: import org.eclipse.emf.edit.provider.IItemLabelProvider;
25: import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
26: import org.eclipse.emf.edit.provider.IItemPropertySource;
27: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
28: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
29: import org.eclipse.emf.edit.provider.ViewerNotification;
30: import org.eclipse.emfforms.coffee.model.coffee.CoffeeFactory;
31: import org.eclipse.emfforms.coffee.model.coffee.CoffeePackage;
32: import org.eclipse.emfforms.coffee.model.coffee.Component;
33:
34: /**
35: * This is the item provider adapter for a {@link org.eclipse.emfforms.coffee.model.coffee.Component} object.
36: * <!-- begin-user-doc -->
37: * <!-- end-user-doc -->
38: *
39: * @generated
40: */
41: public class ComponentItemProvider
42:         extends ItemProviderAdapter
43:         implements
44:         IEditingDomainItemProvider,
45:         ITreeItemContentProvider,
46:         IItemLabelProvider,
47:         IItemPropertySource {
48:         /**
49:          * This constructs an instance from a factory and a notifier.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @generated
54:          */
55:         public ComponentItemProvider(AdapterFactory adapterFactory) {
56:                 super(adapterFactory);
57:         }
58:
59:         /**
60:          * This returns the property descriptors for the adapted class.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @generated
65:          */
66:         @Override
67:         public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
68:•                if (itemPropertyDescriptors == null) {
69:                         super.getPropertyDescriptors(object);
70:
71:                 }
72:                 return itemPropertyDescriptors;
73:         }
74:
75:         /**
76:          * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
77:          * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
78:          * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
79:          * <!-- begin-user-doc -->
80:          * <!-- end-user-doc -->
81:          *
82:          * @generated
83:          */
84:         @Override
85:         public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
86:•                if (childrenFeatures == null) {
87:                         super.getChildrenFeatures(object);
88:                         childrenFeatures.add(CoffeePackage.Literals.COMPONENT__CHILDREN);
89:                 }
90:                 return childrenFeatures;
91:         }
92:
93:         /**
94:          * <!-- begin-user-doc -->
95:          * <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         @Override
100:         protected EStructuralFeature getChildFeature(Object object, Object child) {
101:                 // Check the type of the specified child object and return the proper feature to use for
102:                 // adding (see {@link AddCommand}) it as a child.
103:
104:                 return super.getChildFeature(object, child);
105:         }
106:
107:         /**
108:          * This returns the label text for the adapted class.
109:          * <!-- begin-user-doc -->
110:          * <!-- end-user-doc -->
111:          *
112:          * @generated
113:          */
114:         @Override
115:         public String getText(Object object) {
116:                 return getString("_UI_Component_type"); //$NON-NLS-1$
117:         }
118:
119:         /**
120:          * This handles model notifications by calling {@link #updateChildren} to update any cached
121:          * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
122:          * <!-- begin-user-doc -->
123:          * <!-- end-user-doc -->
124:          *
125:          * @generated
126:          */
127:         @Override
128:         public void notifyChanged(Notification notification) {
129:                 updateChildren(notification);
130:
131:•                switch (notification.getFeatureID(Component.class)) {
132:                 case CoffeePackage.COMPONENT__ACTIVITIES:
133:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
134:                         return;
135:                 case CoffeePackage.COMPONENT__CHILDREN:
136:                         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
137:                         return;
138:                 }
139:                 super.notifyChanged(notification);
140:         }
141:
142:         /**
143:          * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
144:          * that can be created under this object.
145:          * <!-- begin-user-doc -->
146:          * <!-- end-user-doc -->
147:          *
148:          * @generated
149:          */
150:         @Override
151:         protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
152:                 super.collectNewChildDescriptors(newChildDescriptors, object);
153:
154:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__CHILDREN,
155:                         CoffeeFactory.eINSTANCE.createMachine()));
156:
157:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__CHILDREN,
158:                         CoffeeFactory.eINSTANCE.createControlUnit()));
159:
160:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__CHILDREN,
161:                         CoffeeFactory.eINSTANCE.createBrewingUnit()));
162:
163:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__CHILDREN,
164:                         CoffeeFactory.eINSTANCE.createDipTray()));
165:
166:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__CHILDREN,
167:                         CoffeeFactory.eINSTANCE.createWaterTank()));
168:
169:                 newChildDescriptors.add(createChildParameter(CoffeePackage.Literals.COMPONENT__ACTIVITIES,
170:                         CoffeeFactory.eINSTANCE.createActivity()));
171:         }
172:
173:         /**
174:          * Return the resource locator for this item provider's resources.
175:          * <!-- begin-user-doc -->
176:          * <!-- end-user-doc -->
177:          *
178:          * @generated
179:          */
180:         @Override
181:         public ResourceLocator getResourceLocator() {
182:                 return CoffeeEditPlugin.INSTANCE;
183:         }
184:
185: }